-
Notifications
You must be signed in to change notification settings - Fork 47
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
Comments
Typically I would expect creating the child observation in the opened scope from the parent observation, which would allow this to work. Is there a reason in your code you can't do that? Edit: for completeness, I changed your controller method to this: @GetMapping("observation")
public Mono<String> observation() {
String baggageBefore = tracer.getBaggage("key").get();
Observation parent = observationRegistry.getCurrentObservation();
try(Observation.Scope ignored = parent.openScope()) {
Observation o = Observation.createNotStarted("child", observationRegistry);
System.out.println(parent.equals(o.getContext().getParentObservation()));
String baggageAfter = tracer.getBaggage("key").get();
return Mono.just("baggagebefore="+baggageBefore+", baggageAfter="+baggageAfter);
}
} And I get:
And sysout prints |
@shakuzen thanks for clarifying. Given that #455 was only recently closed, we can assume this feature is supported now. I assume it wasn't supported when I raised this issue initially.
I suppose there's many scenarios in which a context is not in current threadlocal scope, but yet you still want to use it as a parent context, but it's kind of beside the point. It's unclear why I would need parent context to be the current active context in order for this to work. It doesn't work like that for trace context, and as far as I understand this is not documented behaviour. I oversee the usage of this library at our company for hundreds of service, and people use it in all kinds of ways. They come to me with their issues using this library. If the API supports it, it should work - and oftentimes the API just does not work and I come here to raise an issue. It's simply too brittle to use at this scale, and this is another example. It's a shame because I would like to recommend a single observability API that integrates with Spring well, but unfortunately it's too buggy so I just point people towards the OTel API which does what it says on the tin. |
We're sorry that you find the API too brittle. You're providing the baggage being lost when using explicitly as one example and I can understand that. Are there any others that you can mention? We don't see too many issue tickets related to the API and bugs so that's quite some news to us. |
Also with reactor we explain how to use the baggage over here https://docs.micrometer.io/tracing/reference/configuring.html#_context_propagation_with_micrometer_tracing |
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:
Full minimal reproduction in this repo: https://github.com/jamesmoessis/baggage-bug-demo
Reproduce by running it then:
The text was updated successfully, but these errors were encountered: