-
Notifications
You must be signed in to change notification settings - Fork 770
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
Spring Webflux Library Instrumentation #7899
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
|
...entelemetry/instrumentation/spring/webflux/v5_3/server/SpringWebfluxNetAttributesGetter.java
Outdated
Show resolved
Hide resolved
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 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! |
instrumentation/spring/spring-webflux/spring-webflux-5.3/library/README.md
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetry.java
Outdated
Show resolved
Hide resolved
route = bestPatternObj.toString(); | ||
} | ||
if (route.equals("/**")) { | ||
return null; // 404 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 HandlerMapping
s 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.
...a/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerNetAttributesGetter.java
Outdated
Show resolved
Hide resolved
...java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java
Outdated
Show resolved
Hide resolved
...a/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerNetAttributesGetter.java
Show resolved
Hide resolved
...a/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerNetAttributesGetter.java
Outdated
Show resolved
Hide resolved
...n/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/TelemetryProducingWebFilter.java
Outdated
Show resolved
Hide resolved
...java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java
Show resolved
Hide resolved
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>
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.
Thanks @jamesmoessis !
Resolves #7436
spring-webflux-5.3
which contains only server-side library instrumentationspring-webflux-5.0
(webclient instrumentation) into a commonspring-webflux
folder next to the 5.3 (server) instrumentation. Moved the README to the parent folder so the docs are cohesive between client/server instrumentation.WebFilter
which instruments the server-sidereactor-3.1
instrumentation to pass the context around. Registers the react hook when it creates theWebFilter