From 9f3456fd5d81df4efb293066ea5ef74ccb4cca1f Mon Sep 17 00:00:00 2001 From: Peter Findeisen Date: Fri, 8 Dec 2023 06:24:36 -0800 Subject: [PATCH] Issue 6037 - Wrapping "invalid" SpanContexts in Span does not preserve SpanContext (#6044) --- api/all/src/main/java/io/opentelemetry/api/trace/Span.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/all/src/main/java/io/opentelemetry/api/trace/Span.java b/api/all/src/main/java/io/opentelemetry/api/trace/Span.java index 898e05a4e9d..a54e7666c9c 100644 --- a/api/all/src/main/java/io/opentelemetry/api/trace/Span.java +++ b/api/all/src/main/java/io/opentelemetry/api/trace/Span.java @@ -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); }