Skip to content

ServerRequestObservationContext(s) miss Propagator.Getter method implementation #35965

@bioplasticlining

Description

@bioplasticlining

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.

  1. Propagation: Support extraction of multiple values for a single key micrometer-metrics/tracing#1032
  2. Promote getAll to TextMapGetter stable API open-telemetry/opentelemetry-java#7267

The proposed solution:

In these two files:

  1. https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/server/observation/ServerRequestObservationContext.java#L38
  2. 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.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions