-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
B3 consistent handling of debug flags and parent span id #1004
Comments
from the issue triage mtg today with TC, moving this to after ga. @mwear if you think this should be an editorial change before ga, please let us know. |
Thinking about this a little more. I don't think that we can propagate a parent span id with the spec in its current form, as there is not a parent span id reader on anything other than span data. If we decide that we are going to omit parent span id from B3 context propagation, then we can push this out. If we want to propagate it, it will require an API change. |
The python SIG had a lengthy discussion about propagating parent span id: open-telemetry/opentelemetry-python#236 and ultimately decided not to propagate it. |
The issues point at the reason for why zipkin supports propagating a parent span id. The tl;dr is that Zipkin allows the client and server spans of a request to share the same span id. OpenTelemetry explicitly requires each span to have a unique id, so this is not functionality that we need to support. As a result, we can probably safely ignore propagating parent span id. The second point is forcing a debug trace, which is another Zipkin feature that OpenTelemetry does not support. I think we can probably safely convert a debug flag into a sampled trace flag. Do people agree with this? |
This is what the Go implementation does:
I'm not sure we could say we implement the B3 specification if we choose to do this. It states ...
Which means we would be doing the opposite. Additionally, systems often use this propagation scheme as a troubleshooting aid. Meaning that spans can take different forms based on this flag and usually report |
Based on the feedback here and from the spec SIG we should:
I'll update the spec the reflect these decisions. |
Sorry for the late comment - just curious why does "OpenTelemetry explicitly requires each span to have a unique id"? There doesn't seem to be anything in the API, propagation, exporter concepts where this wouldn't work and could be left up to backends. Is there a reason for explicitly disallowing it? |
I should clarify, that I believe the spec indicates a spans should have unique ids within a given trace. The spec mentions that a span has:
I interpret this to mean if two spans share a trace id, then they must have separate span ids. It's possible I'm reading into this too deeply. Although, I could see this being a requirement for some tracing backends. It wouldn't be easy to work around duplicate span ids for the same trace unless a backend has explicit support for it. It also complicates context propagation, as mentioned in this issue, supporting shared span ids means that a parent id needs to be propagated in addition to the current span id. While this is allowed in the B3 spec, it's not part of W3C trace context. |
Marking this as Allowed-for-GA was we will clarify this part as part of the existing related #1045 PR. |
What are you trying to achieve?
Consistency in OTel around handling B3 debug flags and parent span id.
Additional context.
B3 context propagation brings some zipkin concepts that do not map cleanly onto OpenTelemetry, namely, the debug trace flags, and propagation of parent span id (in addition to the current span id). There are reasonable solutions to both of these issues, we just need to agree on an approach.
Trace Flags
There is a single trace flag, which signals that a debug trace should be collected. This does not match the trace flags that we store on a span context. I'd propose we workaround this as follows:
This means an OTel app would not continue to propagate the debug trace flags.
Alternative:
It would be possible to preserve the debug trace flag by storing additional B3 metadata in an extracted context. It would allow us to propagate what was received. Since OTel doesn't support a debug flag natively, we'd probably still have to convert it to a sampled flag internally.
Parent Span ID
B3 propagates a parent span id in addition to the span id of the current operation. This effectively makes it a grand parent id when it's extracted. This doesn't fit cleanly on the span context.
According to the B3 spec, it's optional, so we could omit altogether.
Alternatively we could:
Summary
It seems like there are two pretty clear paths forward, we just need to pick one. We can
Does anyone have any opinions, or other approaches we should consider?
The text was updated successfully, but these errors were encountered: