Description
Problem Description
Distributed tracing can be supported by .NET applications by instrumenting them using System.Diagnostics.Activity
API. In addition, there are two APIs to be used to produce and consume events generated by instrumented application:
System.Diagnostics.DiagnosticSource
/System.Diagnostics.DiagnosticListener
System.Diagnostics.ActivitySource
/System.Diagnostics.ActivityListener
The latter API were introduced recently and reflects OpenTelemetry specifications for tracing. By contrast the former is the legacy .NET-specific API were used to implement instrumentation for distributed tracing initially.
Currently, HttpClient
still leverages System.Diagnostics.DiagnosticSource
for distributed tracing instrumentation which requires OpenTelemetry SDK to use hacks and reflection. Going forward, this may also make it harder to stay up-to-date with progress done in OpenTelemetry specifications bringing even more complexity to OpenTelemetry SDK. For example, HTTP retries and redirects implementation require SpanLink objects (as per proposal here) that can only be supported by System.Diagnostics.ActivitySource
.
Additional Information
- PR: Scope and roadmap for bringing the existing HTTP semantic conventions for tracing to an initial stable state.
- PR: Implementation of HTTP retries and redirects instrumentation in .NET OpenTelemetry SDK.