Skip to content
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

Request for adoption in OTel SDKs of the W3C Trace Context Level 2 spec (which is now in Candidate Recommendation status) #3411

Open
kalyanaj opened this issue Apr 18, 2023 · 10 comments
Labels
spec:trace Related to the specification/trace directory triage:accepted:ready

Comments

@kalyanaj
Copy link

What are you trying to achieve?
As part of the W3C DT group, today we published the Level 2 (aka version 2) of the W3C Trace Context spec in "Candidate Recommendation" (CR) status: https://www.w3.org/TR/trace-context-2/.

Please see the above link for full details, to summarize here a main change from the Level 1 version (which OpenTelemetry has already adopted) is that the Level 2 spec includes a new trace flag in the traceparent header called the "random trace id" flag. When this flag is set, it conveys that at least the right-most 7 bytes of the trace ID have been generated in a random (or pseudo-random) manner. This can be helpful for samplers / sharding logic etc. as with this they can get stronger guarantees that traceID has been generated in a random/pseudo-random manner.

What did you expect to see?
Based on the above, want to update the OpenTelemetry community on this spec for your evaluation and to consider prototyping/adoption in OTel SDKs. Assuming the traceID is already being generated in a pseudo-random manner, this would involve setting the above new trace flag to reflect it.

Note: The exit criteria for this standard moving from the current "Candidate Recommendation" status to "Recommendation" status is to have at least two implementations.

Additional context.
https://www.w3.org/TR/trace-context-2/ has the details.

@kalyanaj kalyanaj added the spec:trace Related to the specification/trace directory label Apr 18, 2023
@dyladan
Copy link
Member

dyladan commented Apr 25, 2023

The concrete changes here that are relevant for OTel:

  1. if trace id is randomly generated (most if not all SDKs) set the random flag
  2. propagate the random flag if a traceparent is received

@Oberon00
Copy link
Member

Oberon00 commented Apr 25, 2023

  1. propagate the random flag if a traceparent is received

Isn't propagation of unknown flags already required by the previous W3C spec? Would still be good to verify I guess.

Late EDIT: This is wrong. See comment below #3411 (comment)

@carlosalberto
Copy link
Contributor

if trace id is randomly generated (most if not all SDKs) set the random flag

I wonder if we should strongly suggest all SIGs do generate random ids (if still there any SIG that doesn't).

@dyladan
Copy link
Member

dyladan commented Apr 27, 2023

3. propagate the random flag if a traceparent is received

Isn't propagation of unknown flags already required by the previous W3C spec? Would still be good to verify I guess.

no. unknown flags SHOULD be set to 0

@jmacd
Copy link
Contributor

jmacd commented Aug 4, 2023

I believe we should add flags to the protocol for Span context and links. Otherwise, a tail sampler and downstream consumer will not be able to know whether the TraceID has the random flag.

Same issue is written at least once: open-telemetry/opentelemetry-proto#382 (I'm pretty sure there's another copy of this written somewhere else).

@marcalff
Copy link
Member

Now that the following is done:

can this item, W3C Trace Context Level 2, be adopted in the specifications ?

Looking to implement it for opentelemetry-cpp.

@dyladan

This comment was marked as outdated.

@dyladan
Copy link
Member

dyladan commented Jan 30, 2024

The Trace Context level 2 is in candidate recommendation phase and the W3C is actively looking for adopters. It would be very helpful to us (w3c working group) if OpenTelemetry (including opentelemetry-cpp) can implement this at least experimentally to ensure it works as intended.

@marcalff
Copy link
Member

The Trace Context level 2 is in candidate recommendation phase and the W3C is actively looking for adopters. It would be very helpful to us (w3c working group) if OpenTelemetry (including opentelemetry-cpp) can implement this at least experimentally to ensure it works as intended.

There is a chicken and eggs problem with the process then.

Preparation work has been done already:

https://github.com/open-telemetry/opentelemetry-cpp/blob/497eaf43e5676ae7982f7119a2ac70d09211a6f5/sdk/src/trace/tracer.cc#L83-L93

I am waiting for the opentelemetry-specifications to change, to mention that supporting level 2 is ok (experimental maybe), to uncomment that code and actually support level 2 in the implementation.

@tsloughter
Copy link
Member

Currently implementations use either the right most 63 or 64 bits for sampling. We should all adopt 56 bit but only once this is adopted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:trace Related to the specification/trace directory triage:accepted:ready
Projects
Status: Spec - Priority Backlog
Development

No branches or pull requests

9 participants