Implement Context Propagation through http headers#41
Conversation
| public void OnBeginRequest(HttpContext httpContext) | ||
| { | ||
| var scope = _tracer.StartActive("aspnet.request", serviceName: _serviceName); | ||
| var context = httpContext.Request.Headers.Extract(); |
There was a problem hiding this comment.
I think this behavior should be under a specific setting (distributedTracing = true maybe?). It could happen that the service is a public exposed service without headers whitelist, and so clients could inject some arbitrary IDs to mess the trace.
Just to be clear: this is not a security issue, just a safe-guard to avoid controlling IDs from unwanted services.
|
|
||
| namespace Datadog.Trace | ||
| { | ||
| // TODO test performance difference with a struct |
There was a problem hiding this comment.
If it's a long task, can we create something in our backlog? even if we're planning to solve all TODO before GA, having an idea of the numbers of TODO would be great. Thanks!
There was a problem hiding this comment.
I did the benchmark and it was worse. I removed the TODO.
| /// </summary> | ||
| /// <param name="traceId">The trace identifier.</param> | ||
| /// <param name="spanId">The span identifier.</param> | ||
| public SpanContext(ulong traceId, ulong spanId) |
There was a problem hiding this comment.
I've made this constructor public, meaning that anyone can extend the library to write their own context propagation.
* Address build warnings * Address layout issues * Address NuGet issues * Clean-up
This implements a generic way of doing context propagation through the
IHeaderCollectionabstraction and implements it forHttpHeadersused byHttpClientandIHeaderDictionaryused by Asp.Net Core.