Skip to content

Commit

Permalink
add RequestDeserialized event
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaspimentel committed Sep 3, 2019
1 parent 09b6539 commit a52ea35
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 @@ -148,6 +150,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 @@ -178,6 +185,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 a52ea35

Please sign in to comment.