Skip to content

Commit

Permalink
Issue 6037 - Wrapping "invalid" SpanContexts in Span does not preserv…
Browse files Browse the repository at this point in the history
…e SpanContext (#6044)
  • Loading branch information
PeterF778 authored Dec 8, 2023
1 parent 3bb221f commit 9f3456f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions api/all/src/main/java/io/opentelemetry/api/trace/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,13 @@ static Span getInvalid() {
/**
* 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);
}

Expand Down

0 comments on commit 9f3456f

Please sign in to comment.