We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example that should work:
@RequestMapping("/") Mono<String> baggageTest() { try (BaggageInScope scope = this.tracer.createBaggageInScope("test", "42")) { return webClient.get().uri("/").retrieve().bodyToMono(String.class); } }
The text was updated successfully, but these errors were encountered:
For Tracing 1.0.x I've written such a test
1.0.x
@Test void baggageWithContextPropagation() { Hooks.enableAutomaticContextPropagation(); Span span = tracer.nextSpan().start(); try (Tracer.SpanInScope spanInScope = tracer.withSpan(span)) { try (BaggageInScope scope = this.tracer.createBaggage(KEY_1, VALUE_1).makeCurrent()) { String baggageOutside = this.tracer.getBaggage(KEY_1).get(); then(baggageOutside).isEqualTo(VALUE_1); log.info("BAGGAGE OUTSIDE OF REACTOR [" + baggageOutside + "], thread [" + Thread.currentThread() + "]"); Baggage baggageFromReactor = Mono.just(KEY_1) .publishOn(Schedulers.boundedElastic()) .flatMap(s -> Mono.just(this.tracer.getBaggage(s)) .doOnNext(baggage -> log.info("BAGGAGE IN OF REACTOR [" + baggageOutside + "], thread [" + Thread.currentThread() + "]"))) .block(); then(baggageFromReactor).isNotNull(); then(baggageFromReactor.get()).isEqualTo(VALUE_1); } } }
And it's passing 🤷 , logs
Aug 18, 2023 1:30:27 PM io.micrometer.tracing.otel.bridge.BaggageTests baggageWithContextPropagation INFO: BAGGAGE OUTSIDE OF REACTOR [value1], thread [Thread[Test worker,5,main]] Aug 18, 2023 1:30:27 PM io.micrometer.tracing.otel.bridge.BaggageTests lambda$baggageWithContextPropagation$1 INFO: BAGGAGE IN OF REACTOR [value1], thread [Thread[boundedElastic-1,5,main]]
It's working both for OTel and Brave.
UPDATE: It's working cause get() is called in the same thread as Reactor...
get()
Sorry, something went wrong.
0a2f242
No branches or pull requests
Example that should work:
The text was updated successfully, but these errors were encountered: