Issue 6037 - Wrapping "invalid" SpanContexts in Span does not preserve SpanContext (#6044)
This commit is contained in:
parent
3bb221fb5d
commit
9f3456fd5d
|
@ -74,16 +74,13 @@ public interface Span extends ImplicitContextKeyed {
|
||||||
/**
|
/**
|
||||||
* Returns a non-recording {@link Span} that holds the provided {@link SpanContext} but has no
|
* Returns a non-recording {@link Span} that holds the provided {@link SpanContext} but has no
|
||||||
* functionality. It will not be exported and all tracing operations are no-op, but it can be used
|
* functionality. It will not be exported and all tracing operations are no-op, but it can be used
|
||||||
* to propagate a valid {@link SpanContext} downstream.
|
* to propagate a {@link SpanContext} downstream.
|
||||||
*/
|
*/
|
||||||
static Span wrap(SpanContext spanContext) {
|
static Span wrap(SpanContext spanContext) {
|
||||||
if (spanContext == null) {
|
if (spanContext == null) {
|
||||||
ApiUsageLogger.log("context is null");
|
ApiUsageLogger.log("context is null");
|
||||||
return getInvalid();
|
return getInvalid();
|
||||||
}
|
}
|
||||||
if (!spanContext.isValid()) {
|
|
||||||
return getInvalid();
|
|
||||||
}
|
|
||||||
return PropagatedSpan.create(spanContext);
|
return PropagatedSpan.create(spanContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue