HttpClient Diagnostics
06/26/2022
HttpClient has the capability to propagate correlation Id-s in the HTTP headers of traceparent and tracestate. Every recent .NET release had changes in this scope, for the last few releases the followings has changed:
Automatic Id propagation
AspNet Core creates a new parent activity for each request (by default)
Actvitity's DefaultIdFormat changed in .NET 5
ActivitySource
introduced
In .NET 6 HttpClient allows greater control on how traceIds and spanIds are propagated on downstream HTTP calls. It accomplishes this with the help of DistributedContextPropagator
, which comes with a few built in propagator strategies. In this post I will look into testing these strategies work with OpenTelemetry and Jaeger.