Currently with the following config example it's not possible to use BaggageField.getByName, BaggageField.updateValue for example.
management:
tracing:
baggage:
correlation:
fields:
- some_local_field
- some_remote_field
remote-fields:
- some_remote_field
Only the "some_remote_field" can be retrieved and updated.
With the code proposed also the "local" correlation fields will be accessible.
Comment From: pivotal-cla
@adispezo Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@adispezo Thank you for signing the Contributor License Agreement!
Comment From: mhalbritter
Hello,
thanks for the PR! I've added some comments.
Comment From: mhalbritter
Hey @adispezo , thanks for the changes! I'll get some feedback from the observability team on the local field change in Brave and then come back to you.
Comment From: mhalbritter
Looks good, thank you!
Note to the boot team: when merging, we need something like this for OpenTelemetry, too.
Comment From: marcingrzejszczak
There's no way to do it easily with OTel. What currently is being done is that all baggage gets extracted / injected (e.g.https://github.com/open-telemetry/opentelemetry-java/blob/main/api/all/src/main/java/io/opentelemetry/api/baggage/propagation/W3CBaggagePropagator.java#L50). We would need to wrap their baggage propagation mechanism into our one that would modify the current baggage not to contain local keys and then delegate to their code.
Comment From: mhalbritter
Hm :( In this case, we won't support local fields when using OpenTelemetry. We could issue a log WARN statement if local fields are configured and OTel is used.
Comment From: mhalbritter
I have some polished changes and tagged fields for Otel here: https://github.com/mhalbritter/spring-boot/tree/pr/37435
Comment From: mhalbritter
Before merging this, https://github.com/spring-projects/spring-boot/issues/38724 needs to be considered.
Comment From: mhalbritter
Merged, thank you. To accommodate the changes from https://github.com/spring-projects/spring-boot/issues/38724, i had to refactor a bit.
Comment From: o-shevchenko
Hi
Do we already support tags tag-fields in Spring Boot 3.3.0?
We've set tag-fields, but we still don't see tags sent to the OTEL collector.
Comment From: mhalbritter
Yes, this should work. If it doesn't, please open a new issue with a small reproducer. Thanks!
Comment From: o-shevchenko
Thanks @mhalbritter !
Should it be supported for all tracers or only Brave? I don't see it works with io.micrometer:micrometer-tracing-bridge-otel
Comment From: mhalbritter
Works with both tracers. See the Otel configuration here.