-
Notifications
You must be signed in to change notification settings - Fork 897
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
Having both local and remote span parents? #949
Comments
From the spec:
Based on that I would say that Span can have either remote parent or local parent but not both. |
In that case the local parent applies. See https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#determining-the-parent-span-from-a-context |
Hmm, actually that spec is quite strange. It basically means that if you extract into a Context that already has a Span in it, the extracted SpanContext will be ignored. At least that is my reading. And Java would then mis-implement the spec by storing a Span instead of a SpanContext in the Context. CC @carlosalberto @bogdandrutu
(bold added by me) |
from the spec sig mtg today, set priority to p1. @bogdandrutu to describe how this works in java. can then find an assignee. |
I completely agree with @rakyll, and that's why in Java I pushed to not have 2 different entries in the Context:
The implementation in Java is much simpler, we have only one entry in the This way we simplify the logic about things that are present in the Context and simplify the usage of our API. |
I agree with @bogdandrutu. We should do what Java has done in the Go package. It's error prone and creates a lot of confusion what it means to have two entries especially given users can access to both via public APIs. |
I don't see how this can be done without having 2 entries in the context? But I also don't see how it is confusing to users to have a remote extracted context, they shouldn't be touching it. Maybe that is the issue with Go's implementation? In the Erlang impl we use a separate entry for the "external span context". The propagators extract the trace context, if it exists, to this entry and then it is looked at as the parent if there is no local parent. The spec is clear that if no local or explicit parent is given then the remote parent is checked for. |
In the Go trace package, the following functions uses different keys to store the local and remote span contexts and allow a context to have both a local and remote parent:
https://pkg.go.dev/go.opentelemetry.io/otel@v0.11.0/api/trace?tab=doc#ContextWithRemoteSpanContext
https://pkg.go.dev/go.opentelemetry.io/otel@v0.11.0/api/trace?tab=doc#ContextWithSpan
I'm not sure if this is permitted by the spec and if so, it's not clear in the spec what use cases it enables. What's the expected behavior It'd be good to document it at https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#determining-the-parent-span-from-a-context.
The text was updated successfully, but these errors were encountered: