Skip to content

Conversation

@jaydeluca
Copy link
Member

Spring Web 7 introduced a breaking change where HttpHeaders no longer extends Map and removed the keySet() method. This caused NoSuchMethodError in WebfluxTextMapGetter#keys() when extracting baggage headers, but existing tests didn't catch it because they never sent baggage headers that would trigger the keys() code path.

I am still trying to get the javaagent instrumentation working with latestDeps, but this at least fixes this one piece of the puzzle.

Related to #14906

@jaydeluca jaydeluca requested a review from a team as a code owner December 1, 2025 18:58
@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Dec 1, 2025
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any idea how we could get coverage of keys() via the common http server tests, so it would cover all of the instrumentations?

@trask trask added this to the v2.23.0 milestone Dec 2, 2025
@laurit
Copy link
Contributor

laurit commented Dec 3, 2025

any idea how we could get coverage of keys() via the common http server tests, so it would cover all of the instrumentations?

We could introduce a custom verifying propagator that calls the keys() method. We could wire it up in https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/8481d9a550652c97d2a16864064730dc5a487612/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/LibraryTestRunner.java#L105-107 and in https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/testing/agent-exporter/src/main/java/io/opentelemetry/javaagent/testing/exporter/AgentTestingCustomizer.java I think it doesn't need to be done in this PR.

Comment on lines 100 to 101
// The keys() method internally calls HttpHeaders.keySet()
// This will throw NoSuchMethodError with Spring Web 7 if not properly handled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somewhat contradictory, NoSuchMethodError is avoided by not calling HttpHeaders.keySet() for spring web 7


@Test
void testKeysWithBaggageHeader() {
// Test that baggage headers are properly returned by keys()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't have added that many tests since most of the functionality is already tested elsewhere. Guess having more tests can't hurt.

@Test
void testKeysWithMultipleBaggageHeaders() {
// Test that multiple baggage headers are properly returned by keys()
// The W3C Baggage propagator needs to iterate through all headers to find baggage entries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W3C Baggage propagator doesn't really use the keys() method

@trask trask merged commit 5a392fd into open-telemetry:main Dec 3, 2025
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test native This label can be applied to PRs to trigger them to run native tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants