-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
The technical problem:
In Micrometer Tracing 1.6.0 https://github.com/micrometer-metrics/tracing/releases/tag/v1.6.0 there was an update to the propagator bridge and observation implementations to support returning multiple extracted values. This follows an update to the OpenTelemetry propagator to also support this.
The last missing step is for ServerRequestObservationContext to supply the full implementation of the Propagator.Getter interface that overrides the defaulted getAll method.
This change allows propagator implementations to refer to all headers in the request object, not just the first.
Ideally this change would’ve been made with 7.0.0, but I would like to ensure this change is made early in the 7.0 versioning process.
The use case:
This change is required to properly support the baggage specification, where multiple headers are permitted. Please refer to discussions in these GitHub issues.
- Propagation: Support extraction of multiple values for a single key micrometer-metrics/tracing#1032
- Promote getAll to TextMapGetter stable API open-telemetry/opentelemetry-java#7267
The proposed solution:
In these two files:
- https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/server/observation/ServerRequestObservationContext.java#L38
- https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/server/reactive/observation/ServerRequestObservationContext.java#L66
Implement an anonymous class of the Propagator.Getter interface, whose getAll method could be Collections.list(carrier.getHeaders(key)) and similarly using getOrEmpty in reactive.