Opentelemetry-java: Create a combined B3 Propagator that handle both single and multi-header cases

Created on 23 Sep 2020  路  6Comments  路  Source: open-telemetry/opentelemetry-java

Most helpful comment

Won't TraceMultiPropagator solve that?

I think we should still have this as a single B3Propagator.

All 6 comments

Won't TraceMultiPropagator solve that?

Won't TraceMultiPropagator solve that?

It might, but the spec says when you enable the B3 propagator, it should handle both cases, which we don't at the moment. Are you thinking that this should be implemented in the agent, rather than propagator itself?

Won't TraceMultiPropagator solve that?

I think we should still have this as a single B3Propagator.

i can pick this one up

I don't know if this is the proper place but I think that https://github.com/open-telemetry/opentelemetry-java/blob/master/extensions/trace_propagators/src/main/java/io/opentelemetry/extensions/trace/propagation/B3PropagatorInjectorSingleHeader.java is not really working exactly as it should. If there's a parent span id it should also get appended to the the single b3 header. You can check how they do it in Brave https://github.com/openzipkin/brave/blob/4a4d8bf49318ae049669c5ccc8e451102e826cca/brave/src/main/java/brave/propagation/B3SingleFormat.java#L114-L139

Example in Brave

traceId - spanId - sampled - parentSpanId
00000000000000010000000000000000-ac85aa59b0498d38-1-0000000000000002

Example in Brave without parentSpanId

traceId - spanId - sampled - parentSpanId
00000000000000010000000000000000-ac85aa59b0498d38-1

how it's done in OTel

traceId - spanId - sampled
00000000000000010000000000000000-0000000000000002-1

@marcingrzejszczak See https://github.com/open-telemetry/opentelemetry-specification/pull/1045 ;)

Was this page helpful?
0 / 5 - 0 ratings