-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix spring-webflux header parsing for 7+ #15502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
trask
left a comment
There was a problem hiding this 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?
.../src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/internal/HeaderUtil.java
Outdated
Show resolved
Hide resolved
.../src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/internal/HeaderUtil.java
Outdated
Show resolved
Hide resolved
We could introduce a custom verifying propagator that calls the |
| // The keys() method internally calls HttpHeaders.keySet() | ||
| // This will throw NoSuchMethodError with Spring Web 7 if not properly handled |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
Spring Web 7 introduced a breaking change where
HttpHeadersno longer extendsMapand removed thekeySet()method. This causedNoSuchMethodErrorinWebfluxTextMapGetter#keys()when extracting baggage headers, but existing tests didn't catch it because they never sent baggage headers that would trigger thekeys()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