Skip to content

Commit

Permalink
add RequestDeserialized event
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaspimentel committed Nov 18, 2019
1 parent 7d67160 commit d7d7b83
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/Datadog.Trace.TestHelpers/MockTracerAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public MockTracerAgent(int port = 8126, int retries = 5)

public event EventHandler<EventArgs<HttpListenerContext>> RequestReceived;

public event EventHandler<EventArgs<IList<IList<Span>>>> RequestDeserialized;

/// <summary>
/// Gets or sets a value indicating whether to skip serialization of traces.
/// </summary>
Expand Down Expand Up @@ -152,6 +154,11 @@ protected virtual void OnRequestReceived(HttpListenerContext context)
RequestReceived?.Invoke(this, new EventArgs<HttpListenerContext>(context));
}

protected virtual void OnRequestDeserialized(IList<IList<Span>> traces)
{
RequestDeserialized?.Invoke(this, new EventArgs<IList<IList<Span>>>(traces));
}

private void AssertHeader(
NameValueCollection headers,
string headerKey,
Expand Down Expand Up @@ -182,6 +189,7 @@ private void HandleHttpRequests()
if (ShouldDeserializeTraces)
{
var spans = MessagePackSerializer.Deserialize<IList<IList<Span>>>(ctx.Request.InputStream);
OnRequestDeserialized(spans);

lock (this)
{
Expand Down

0 comments on commit d7d7b83

Please sign in to comment.