Skip to content

Commit

Permalink
OpenTracing shim: baggage of active span was not used (open-telemetry…
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger authored Jul 8, 2022
1 parent eb373a3 commit 198aecd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ public Span start() {
Context.root()
.with(io.opentelemetry.api.trace.Span.wrap(parentSpanContext.getSpanContext())));
baggage = parentSpanContext.getBaggage();
} else {
baggage = Baggage.current();
}

for (io.opentelemetry.api.trace.SpanContext link : parentLinks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ void activateSpan_withBaggage() {

assertThat(io.opentelemetry.api.trace.Span.current()).isSameAs(actualSpan);
assertThat(io.opentelemetry.api.baggage.Baggage.current()).isSameAs(actualBaggage);

Span child = tracerShim.buildSpan("child").start();
assertThat(child.getBaggageItem("foo")).isEqualTo("bar");
}

assertThat(tracerShim.activeSpan()).isNull();
Expand Down

0 comments on commit 198aecd

Please sign in to comment.