If we look at Sleuth & Boot tracing Baggage features comparison we're still missing two.

  • Local Baggage - local baggage means baggage available within this JVM but one that does not get propagated over the wire
  • Tagged Baggage - tagged baggage means baggage that automatically gets added as a tag

Local Baggage Sleuth implementation

Tagged Baggage Sleuth implementation

Comment From: carlosalm-msft

hi folks, do you have any ETA on this? Thanks!

Comment From: wilkinsona

Nothing specific, no. The issue is in the 3.x milestone which means there's no definite plan for it at the moment.

Comment From: michael-wirth

Here's a little workaround for Spring Boot 3.1.x

OpenTelementry and Brave implementation behave differently.

Brave

requires the local baggage to be registered:

    @Bean
    internal fun localBaggagePropagationCustomizer() =
        brave.baggage.BaggagePropagationCustomizer { customizer ->
           customizer.add(SingleBaggageField.local(BaggageField.create("localBaggage")))
        }

Set the local baggage in a WebFilter:

    override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> =
        chain.filter(exchange)
                        .doOnSubscribe { tracer.createBaggageInScope(localBaggage, "value") }

OpenTelementry

doesn't require registering local baggage properties, but setting the baggage is more complicated: - it is possible to set only 1 baggage. calling createBaggageInScope will cancel all previous baggages - a new observation must be started with Micrometer.observation

    override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
        tracer.createBaggageInScope("localBaggage", "value")  // the value can also be set via "contextWrite", but not via "doOnSubscribe"
        return chain.filter(exchange)
            .tap(reactor.core.observability.micrometer.Micrometer.observation(registry))
    }