-
Book Overview & Buying
-
Table Of Contents
Modern Distributed Tracing in .NET
By :
When instrumenting new systems, using W3C trace context propagation is the default and the easiest option – it does not need any explicit configuration since .NET and OpenTelemetry use it by default. However, existing systems may employ legacy context propagation conventions.
To support them, we can configure a custom global propagator on OpenTelemetry using Sdk.SetDefaultTextMapPropagator. For example, if one of your old client applications still uses some variation of custom correlation ID, you can still read it from request headers and convert it to a trace-id-compatible format (or move it to baggage).
You can use a composite propagator and support multiple standards at once as shown in this example:
XCorrelationIdPropagator.cs
Sdk.SetDefaultTextMapPropagator(
new CompositeTextMapPropagator(new TextMapPropagator[] {
new B3Propagator(true),
new XCorrelationIdPropagator(...