apache / apache/pulsar-dotpulsar
Make Trace context propagation compatible with other Pulsar client instrumentations
- Dominant language
- C#
- Stars
- 271
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
### Is your feature request related to a problem? Please describe
When propagating tracing context, DotPulsar uses `messaging.trace_parent` and `messaging.trace_state` properties, both on the Producer and Consumer side.
Other clients use the TextMapPropagator from OpenTelemetry which uses other fields:
| **Client** | **Type** | **Source** |
|------------------------------------------------------------- |---------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| pulsar-client-go | Producer | https://github.com/apache/pulsar-client-go/blob/v0.14.0/pulsar/internal/pulsartracing/message_carrier_util.go#L43 |
| | Consumer | https://github.com/apache/pulsar-client-go/blob/v0.14.0/pulsar/internal/pulsartracing/message_carrier_util.go#L55 |
| pulsar-client-dotnet | Producer | https://github.com/fsprojects/pulsar-client-dotnet/blob/3.6.1/src/Pulsar.Client.Otel/OTelProducerInterceptor.fs#L14 |
| | Consumer | https://github.com/fsprojects/pulsar-client-dotnet/blob/3.6.1/src/Pulsar.Client.Otel/OtelConsumerInterceptor.fs#L26 |
| Java client (Through OpenTelemetry instrumentation package) | Producer | https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/v2.12.0/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarSingletons.java#L151 |
| | Consumer | https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/v2.12.0/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarSingletons.java#L177 |
Behind the scenes, `TextMapPropagator` uses `traceparent` and `tracestate` across all implementations as defined by the W3C Trace Context recommendation (https://www.w3.org/TR/trace-context/) - Although this document sets recommendations for HTTP headers, it is widely used in other carriers.
The result is that context propagation does not work between DotPulsar and the other client implementations.
### Describe the solution you'd like and alternatives you've considered
Implement PIP 23 from Pulsar: https://github.com/apache/pulsar/wiki/PIP-23:-Message-Tracing-By-Interceptors to allow Interceptors to hook into DotPulsar and create an OpenTelemetry contrib package that will live here: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src and which will depend on the OpenTelemetry.API package and its standardized extractors.
By doing so, full OpenTelemetry support can be added (including Baggage and other propagation elements) without OpenTelemetry becoming a dependency in DotPulsar itself
Contributor guide
Research direction
Start by reviewing PIP 23 and the existing DotPulsar producer and consumer tracing propagation, then compare the referenced Pulsar client implementations. Define the interceptor and OpenTelemetry contrib-package boundaries before coding; done means compatible trace context propagation without adding OpenTelemetry as a DotPulsar dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100