Spring Webflux Library Instrumentation#7899
Conversation
60bebec to
bbfa43b
Compare
…garding attribute retrieval
fix markdown link fix formatter change
bbfa43b to
d69fd50
Compare
|
@jamesmoessis it looks like there's a failure with
|
trask
left a comment
There was a problem hiding this comment.
I think it would be nice to have just a single spring-webflux library instrumentation module (check out the gRPC library instrumentation for *Telemetry class pattern with both client and server library instrumentation)
If you move the client library instrumentation (and the associated shared testing module) over into the new 5.3 module, I think you should still be able to depend on it from the 5.0 javaagent instrumentation.
"muzzle" on the 5.0 javaagent instrumentation will identify which parts of the 5.3 library module are used inside of the javaagent instrumentation and will only inject those parts.
and the "muzzle" build time check on the 5.0 javaagent instrumentation will keep us from accidentally depending on newer webclient apis
(and if we do want to depend on newer webclient apis in the library instrumentation, we can do a big copy-paste, but hopefully still keep the shared testing classes)
|
Thanks @trask, I'll have a go at putting it all in the 5.3 module. |
|
Moved some things around but still need to put it all in the one |
…(java agent still having issues) spotless
eb967d2 to
ddd788b
Compare
|
@trask seems Muzzle is having an issue with the new setup. I've pushed it as my latest commit too if you want to see the whole run.
Not too familiar with Muzzle, but I am guessing it doesn't ignore it since the server instrumenter is built (but not used) as part of |
|
the muzzle static analysis detects the call from I sent atlassian-forks#1 which extracts out a separate (internal) "client builder" that can be used by the javaagent without triggering the problem |
|
Awesome! Thankyou @trask that has done the trick! |
| route = bestPatternObj.toString(); | ||
| } | ||
| if (route.equals("/**")) { | ||
| return null; // 404 |
There was a problem hiding this comment.
with spring boot /** doesn't always mean 404 but rather the default route that serves static resources like images etc.
There was a problem hiding this comment.
Ah I see. I wasn't aware of that. Would you be happy if I removed the comment //404 and kept the same behaviour?
There was a problem hiding this comment.
That would be nice. Ideally we should have consistent handling for /** if we are ignoring it here we should also ignore it in other spring instrumentations.
There was a problem hiding this comment.
Ok, I removed the comment.
The MVC instrumentation is a bit more sophisticated than this when it comes to determining the if there's no handler mappable to the request. Looks like the Filter has access to the application context so it can retrieve the DispatcherHandler bean and therefore query the HandlerMapping to see if there's a handler for the given request (and if there isn't returns null for route). As a result it doesn't need to handle /** specifically.
From what I see, there's no easy equivalent way to get the HandlerMappings in Webflux, since it's not a given that the WebFilter can access the application context(?). It appears that the current method works fine and is less complex, so unsure if there should be any action here to align the two implementations.
Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
…ry/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
mateuszrzeszutek
left a comment
There was a problem hiding this comment.
Thanks @jamesmoessis !
Resolves #7436
spring-webflux-5.3which contains only server-side library instrumentationspring-webflux-5.0(webclient instrumentation) into a commonspring-webfluxfolder next to the 5.3 (server) instrumentation. Moved the README to the parent folder so the docs are cohesive between client/server instrumentation.WebFilterwhich instruments the server-sidereactor-3.1instrumentation to pass the context around. Registers the react hook when it creates theWebFilter