Skip to content

Commit 7d0005d

Browse files
authored
Remove unused properties from MockTelemetryAgent (#8020)
## Summary of changes Removes unused properties and functionality from `MockTelemetryAgent` ## Reason for change Noticed the obsolete behaviour while working on something else. The `OptionalHeaders` option was added as part of the original crashtracking work, and was partially removed as no longer required in #6835, and the parts here were just missed. ## Implementation details Delete unused code ## Test coverage As long as the tests still pass, we're good ## Other details Noticed while working on #8017
1 parent 02f5187 commit 7d0005d

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

tracer/test/Datadog.Trace.TestHelpers/MockTelemetryAgent.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ public MockTelemetryAgent(int port = 8524, int retries = 5)
7474
}
7575
}
7676

77-
public bool OptionalHeaders { get; set; }
78-
79-
/// <summary>
80-
/// Gets or sets a value indicating whether to skip serialization of traces.
81-
/// </summary>
82-
public bool ShouldDeserializeTraces { get; set; } = true;
83-
8477
/// <summary>
8578
/// Gets the TCP port that this Agent is listening on.
8679
/// Can be different from <see cref="MockTelemetryAgent"/>'s <c>initialPort</c>
@@ -165,20 +158,7 @@ protected virtual void HandleHttpRequest(HttpListenerContext ctx)
165158
var requestType = ctx.Request.Headers[TelemetryConstants.RequestTypeHeader];
166159
var compressed = ctx.Request.Headers["Content-Encoding"].Equals("gzip", StringComparison.OrdinalIgnoreCase);
167160

168-
var inputStream = ctx.Request.InputStream;
169-
170-
if (OptionalHeaders && (apiVersion == null || requestType == null))
171-
{
172-
using var sr = new StreamReader(inputStream);
173-
var text = sr.ReadToEnd();
174-
175-
var json = JObject.Parse(text);
176-
apiVersion = json["api_version"].Value<string>();
177-
requestType = json["request_type"].Value<string>();
178-
inputStream = new MemoryStream(Encoding.UTF8.GetBytes(text));
179-
}
180-
181-
var telemetry = DeserializeResponse(inputStream, apiVersion, requestType, compressed);
161+
var telemetry = DeserializeResponse(ctx.Request.InputStream, apiVersion, requestType, compressed);
182162
Telemetry.Push(telemetry);
183163

184164
lock (this)

0 commit comments

Comments
 (0)