Issue 6037 - Wrapping "invalid" SpanContexts in Span does not preserve SpanContext (#6044)

This commit is contained in:
Peter Findeisen 2023-12-08 06:24:36 -08:00 committed by GitHub
parent 3bb221fb5d
commit 9f3456fd5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -74,16 +74,13 @@ public interface Span extends ImplicitContextKeyed {
/**
* 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
* to propagate a valid {@link SpanContext} downstream.
* to propagate a {@link SpanContext} downstream.
*/
static Span wrap(SpanContext spanContext) {
if (spanContext == null) {
ApiUsageLogger.log("context is null");
return getInvalid();
}
if (!spanContext.isValid()) {
return getInvalid();
}
return PropagatedSpan.create(spanContext);
}