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

Baggage is lost when explicitly setting parent observation #882

Open
jamesmoessis opened this issue Oct 30, 2024 · 0 comments
Open

Baggage is lost when explicitly setting parent observation #882

jamesmoessis opened this issue Oct 30, 2024 · 0 comments

Comments

@jamesmoessis
Copy link
Contributor

jamesmoessis commented Oct 30, 2024

Using: id("org.springframework.boot") version "3.3.5"

I would expect baggage to be carried over when setting a parent observation. Currently it is lost. I am using the otel tracing bridge.

Example:

    @GetMapping("observation")
    public Mono<String> observation() {
        String baggageBefore = tracer.getBaggage("key").get();
        Observation parent = observationRegistry.getCurrentObservation();
        Observation o = Observation.createNotStarted("child", observationRegistry).parentObservation(parent);
        try(Observation.Scope ignored = o.openScope()) {
            String baggageAfter = tracer.getBaggage("key").get(); // expect "val" but is null
            return Mono.just("baggagebefore="+baggageBefore+", baggageAfter="+baggageAfter);
        }
    }

Full minimal reproduction in this repo: https://github.com/jamesmoessis/baggage-bug-demo

Reproduce by running it then:

$ curl http://localhost:8080/observation -H 'baggage: key=val'
baggagebefore=val, baggageAfter=null%   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant