Description
When I first read about the new Observation
API I somehow got an idea that key-value pairs that I would add to the context (e.g. via highCardinalityKeyValues
/lowCardinalityKeyValues
) would then be automatically set on the baggage fields that I registered (e.g. via management.tracing.baggage.correlation.fields
). This would basically ensure that if I were to register a custom baggage field such as userId
and report a value for this key in, say, the implementation of ObservationConvention
in use, I would then be able to get this field easily in the MDC context and thus have it attached to all log records printed from within the observation.
After multiple attempts to make this work, I've checked the implementation of TracingObservationHandler.java and the only thing that is happening with the context key-value pairs is that they are used to tag the span.
Looking at the old Spring Sleuth docs, I see that there used to be spring.sleuth.baggage.tag-fields
property that would allow to specify which tag fields should be added to baggage, but this is not available in Micrometer Tracing / current Spring Boot as far as I can tell.
Is this something that will be implement by Micrometer / Spring at some point or we should work on some work-arounds on our end?
P.S. Right now we kinda have to work with both Observation API (e.g. to avoid working with Trace/Span directly), and at the same time call tracer.createBaggageInScope
to make sure custom attributes end up in the logs (via baggage to MDC propagation).
Activity
marcingrzejszczak commentedon Dec 8, 2023
The problem currently is that Observation has no notion of baggage. I'm kind of on the fence whether it should be publicly available in Micrometer Observation API. Any opinions @jonatan-ivanov @shakuzen @ttddyy ? I know that @chemicL was thinking that most likely Baggage should become the first class citizen of the Observation API, is it still correct?
github-actions commentedon Dec 15, 2023
nmadhavi33 commentedon Dec 15, 2023
@ilya40umov did you get solution for above issue?
marcingrzejszczak commentedon Dec 18, 2023
This is still in progress. The feedback related labels were added by the bot that we are experimenting with
Added an option to have baggage through Observation API
5 remaining items