Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Shims

* OpenTracing: Return null from `Tracer.extract` when the carrier has no span context
([#8505](https://github.com/open-telemetry/opentelemetry-java/pull/8505))

## Version 1.63.0 (2026-06-05)

### API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <C> SpanContextShim extractTextMap(Format<C> format, TextMapExtract carrier) {
carrierMap.put(entry.getKey(), entry.getValue());
}

Context context = getPropagator(format).extract(Context.current(), carrierMap, GETTER_INSTANCE);
Context context = getPropagator(format).extract(Context.root(), carrierMap, GETTER_INSTANCE);

Span span = Span.fromContext(context);
Baggage baggage = Baggage.fromContext(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ void extract_onlyBaggage() {
assertThat(spanContextShim.getBaggage()).isEqualTo(baggage);
}

@Test
void extract_emptyCarrier_withActiveSpan_returnsNull() {
Span span = tracerShim.buildSpan("one").start();
try (Scope scope = tracerShim.activateSpan(span)) {
SpanContext result =
tracerShim.extract(Format.Builtin.TEXT_MAP, new TextMapAdapter(Collections.emptyMap()));
assertThat(result).isNull();
} finally {
span.finish();
}
}

@Test
@SuppressLogger(TracerShim.class)
void close_OpenTelemetrySdk() {
Expand Down
Loading