Description
Thanks to @marcingrzejszczak and #32480, a standard OpenTelemetry "baggage content" is automatically propagated by default (with just micrometer-tracing-bridge-otel
added). However, to have it accessible via (logging) MDC, it is required to add some extra configuration (only spanId
and traceId
are propagated to MDC automatically):
management:
tracing:
baggage:
correlation:
fields:
- baggage
remote-fields:
- baggage
It might be confusing, as one might expect to have the correlation and remote-fields available for non-default fields (while "baggage" seems to be - proposed - standard - https://www.w3.org/TR/baggage/#header-name).
If the "baggage" is enabled in tracing and if anything is provided inside why not put it also into MDC (to be clear - just to be accessible with custom custom logging pattern from MDC)?
Things to consider:
- performance - could it be a problem? It is already passed by internally, only injecting it into MDC is to be added
- ability to disable "baggage" field propagation - by adding some other fields or by setting the empty value/list in those 2 places in configuration?
- backward compatibility - maybe there could be just a switch to turn the bahavior on (disabled by default for now), and eventually it would be enabled by default in some 3.x or maybe 4.0?