You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The static method in the Span interface wrap(SpanContext spanContext) is expected to create a Span object corresponding to the provided spanContext. However, if the provided context is "invalid", it is not used, and a generic invalid Span is returned.
Steps to reproduce
Create an "invalid" SpanContext by calling Span span = SpanContext.create("0", "0", TraceFlags.getDefault(), myTraceState)
where myTraceState is a TraceState that I want to use.
What did you expect to see?
I expect that span.getSpanContext().getTraceState() will return an object equivalent to myTraceState that I supplied,
What did you see instead?
Instead I see the default (empty) TraceState returned.
What version and what artifacts are you using?
opentelemetry-java-sdk, version 1.31
Additional context
The bigger picture: When working on client session sampling, we want all traces comprising the session to be sampled as a group - either all of them are dropped or all of them are sampled. Using consistent probability sampling, this can be achieved by setting the same randomness (via TraceState) for all traces belonging to a session. This needs to be done before the sampling decision for the root spans is made, thus necessitating manipulation of "invalid" SpanContexts.
The text was updated successfully, but these errors were encountered:
@PeterF778 can you reference a part of the specification that describes what the API should do in this case? If not, we should get spec clarification before changing it.
@PeterF778 can you reference a part of the specification that describes what the API should do in this case? If not, we should get spec clarification before changing it.
Here is the relevant part of the specification. When describing wrapping SpanContext in Spans it says "GetContext MUST return the wrapped SpanContext", it does not say that this behavior is expected only for validSpanContexts.
Describe the bug
The static method in the
Span
interfacewrap(SpanContext spanContext)
is expected to create a Span object corresponding to the providedspanContext
. However, if the provided context is "invalid", it is not used, and a generic invalid Span is returned.Steps to reproduce
Create an "invalid" SpanContext by calling
Span span = SpanContext.create("0", "0", TraceFlags.getDefault(), myTraceState)
where
myTraceState
is aTraceState
that I want to use.What did you expect to see?
I expect that
span.getSpanContext().getTraceState()
will return an object equivalent tomyTraceState
that I supplied,What did you see instead?
Instead I see the default (empty) TraceState returned.
What version and what artifacts are you using?
opentelemetry-java-sdk, version 1.31
Additional context
The bigger picture: When working on client session sampling, we want all traces comprising the session to be sampled as a group - either all of them are dropped or all of them are sampled. Using consistent probability sampling, this can be achieved by setting the same randomness (via
TraceState
) for all traces belonging to a session. This needs to be done before the sampling decision for the root spans is made, thus necessitating manipulation of "invalid" SpanContexts.The text was updated successfully, but these errors were encountered: