Closed Azquelt closed 1 year ago
In the spec, we have listed 2 examples of getting the current span. My understand is the injected span should be always the current span.
BTW, in the example above.
String newSpanId = injectedSpan.getSpanContext();
should be
String newSpanId = injectedSpan.getSpanContext().getSpanId();
Thanks, I've updated the example.
Description
The spec says:
Does this mean that when a
Span
is injected, the implementation should callSpan.current()
to get the instance, or that callingsetAttribute
on an injectedSpan
instance should be equivalent to callingSpan.current().setAttribute
?The difference is important if the current span changes. A contrived example:
A more practical example might be if an
ApplicationScoped
bean had aSpan
injected. Would the injected span have the current span from whenever that bean was first instantiated, or would it always reflect whatever was the current span?I would push for saying that an injected
Span
should always reflect the current span. That seems more useful, even if it would be harder to implement.When we decide on the expected behaviour, we should also add a TCK test.