Skip to content
New issue

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

Add local baggage and tagged baggage #33991

Open
Tracked by #35776
marcingrzejszczak opened this issue Jan 26, 2023 · 3 comments
Open
Tracked by #35776

Add local baggage and tagged baggage #33991

marcingrzejszczak opened this issue Jan 26, 2023 · 3 comments
Labels
theme: observability Issues related to observability type: enhancement A general enhancement
Milestone

Comments

@marcingrzejszczak
Copy link
Contributor

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 26, 2023
@wilkinsona wilkinsona changed the title [Observability] Add local baggage and tagged baggage Add local baggage and tagged baggage Jan 26, 2023
@wilkinsona wilkinsona added theme: observability Issues related to observability type: enhancement A general enhancement labels Jan 26, 2023
@scottfrederick scottfrederick added this to the 3.1.x milestone Jan 26, 2023
@mhalbritter mhalbritter removed the status: waiting-for-triage An issue we've not yet triaged label Jan 27, 2023
@wilkinsona wilkinsona modified the milestones: 3.1.x, 3.x Apr 17, 2023
@carlosalm-msft
Copy link

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

@wilkinsona
Copy link
Member

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

@philwebb philwebb mentioned this issue Jun 7, 2023
31 tasks
@michael-wirth
Copy link

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))
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: observability Issues related to observability type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

7 participants