Skip to content

Make Trace context propagation compatible with other Pulsar client instrumentations #249

Description

@jvmdc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions