-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Auto-configure Jersey2 server instrumentation #12482
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
Auto-configure Jersey2 server instrumentation #12482
Conversation
@@ -76,7 +77,8 @@ | |||
RabbitMetricsAutoConfiguration.class, CacheMetricsAutoConfiguration.class, | |||
DataSourcePoolMetricsAutoConfiguration.class, | |||
RestTemplateMetricsAutoConfiguration.class, | |||
WebFluxMetricsAutoConfiguration.class, WebMvcMetricsAutoConfiguration.class); | |||
WebFluxMetricsAutoConfiguration.class, WebMvcMetricsAutoConfiguration.class, | |||
JerseyServerMetricsAutoConfiguration.class); |
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.
This is just for completeness sake in case somebody is going to use the MetricsRun
tooling in other tests. It's not used in the Jersey auto-configuration tests.
Did a quick test by copying this configuration into a jersey application with prometheus: Some uri-tags are now indeed templated. But raw uris are additionally recorded, probably because both MVC- and Jersey-RequestFilters apply to a http request. As quick workaround the jersey-meters were renamed and MVC-meters were suppressed by a MeterFilter. |
Yap. WebMVC instrumentation kicks in. One could disable |
We might rework this depending on how the implementation of #13064 goes. |
There is also another implementation for the same feature in #12905 that we should review as part of merging this. |
After some time has passed, what's your stance on this PR? #13064 hasn't seen any progress as of yet. We are slowly moving to Spring Boot 2 services and I remembered this being still open. It's not hard to come up with a custom/proprietary setup for the time being, but it would be cool to not have to care about Jersey instrumentation in the future. (Even if it might get reworked with #13064.) |
@mweirauch We're still hoping to get to this one if we can. |
7875732
to
c9558d4
Compare
Just in case, I went ahead and updated the PR against master/2.1.x. Contains parts of #12905 and credited @michael-simons where appropriate. (Hope this is ok dear "Namensvetter" ;)) |
c9558d4
to
1cdcf6c
Compare
1cdcf6c
to
49afeda
Compare
I think we should merge this one rather than #12905, with a single squashed commit amended to list @michael-simons as a co-author. |
See spring-projectsgh-12482 Co-authored-by: Michael J. Simons <michael@simons.ac>
There are some differences in Micrometer's Jersey tag support and what it and Boot offer for Web MVC. I've opened micrometer-metrics/micrometer#900 to try and align things. I don't think it needs to block merging this. |
See spring-projectsgh-12482 Co-authored-by: Michael J. Simons <michael@simons.ac>
In the absence of #13064, I think what's proposed here plus a little polishing is sufficient. In the polishing, I've added a filter that applies |
* gh-12482: Polish "Auto-configure Micrometer's Jersey 2 server instrumentation" Auto-configure Micrometer's Jersey 2 server instrumentation
@mweirauch, thank you for making your first contribution to Spring Boot. @michael-simons, thanks for your contribution here too. You are a co-author of dd126fa. The proposed changes are now in master. I polished things a little in 72e2313. Other than some repackaging, the main changes were to a meter filter and to reuse the |
Thanks @wilkinsona for taking care of this! |
This PR auto-configures the Micrometer Jersey2 server instrumentation. It's adopted from the
micrometer-spring-legacy
auto-configuration.Relates to gh-12447 and micrometer-metrics/micrometer#486