Skip to content
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 JettyMetrics #12090

Closed
snicoll opened this issue Feb 16, 2018 · 14 comments
Closed

Auto-configure JettyMetrics #12090

snicoll opened this issue Feb 16, 2018 · 14 comments
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@snicoll
Copy link
Member

snicoll commented Feb 16, 2018

We have metrics support for Tomcat and micrometer has support for Jetty so we should configure that as well for consistency.

@snicoll snicoll added type: enhancement A general enhancement for: team-attention An issue we'd like other members of the team to review priority: normal labels Feb 16, 2018
@wilkinsona
Copy link
Member

wilkinsona commented Feb 16, 2018

I looked at this briefly when I was adding support for Tomcat's metrics. It's not completely straightforward as it relies on Jetty being configured with a StatisticsHandler which it isn't by default. I wondered if the Jetty metrics auto-configuration should customise Jetty with a StatisticsHandler but didn't manage to convince myself it was the right thing to do.

@wilkinsona
Copy link
Member

Given the potential complications with StatisticsHandler, we decided that this can wait until 2.1.

@wilkinsona wilkinsona removed the for: team-attention An issue we'd like other members of the team to review label Feb 16, 2018
@wilkinsona wilkinsona added this to the 2.1.0 milestone Feb 16, 2018
@evenh
Copy link

evenh commented Feb 18, 2018

In my mind this sounds pretty useful. If I were to have a look at this, where would I start (never contributed to the boot codebase before)?

Regarding adding a StatisticsHandler customization to Jetty, one option would be to add a property for explicitly disabling it?

@snicoll
Copy link
Member Author

snicoll commented Feb 19, 2018

@evenh we've decided to postpone this to 2.1 (it's not a matter of a lack of time working on it). Thanks anyway. You can look at the contributing page to get started. We're also on Gitter if you want to chat.

evenh added a commit to evenh/spring-boot that referenced this issue Feb 20, 2018
This is performed by the new JettyMetricsAutoConfiguration, that is
based on the existing TomCatMetricsAutoConfiguration.

Fixes spring-projectsgh-12090
evenh added a commit to evenh/spring-boot that referenced this issue Feb 20, 2018
This is performed by the new JettyMetricsAutoConfiguration, that is
based on the existing TomcatMetricsAutoConfiguration.

Fixes spring-projectsgh-12090
evenh added a commit to evenh/spring-boot that referenced this issue Feb 20, 2018
This is performed by the new JettyMetricsAutoConfiguration, that is
based on the existing TomcatMetricsAutoConfiguration.

Fixes spring-projectsgh-12090
evenh added a commit to evenh/spring-boot that referenced this issue Feb 20, 2018
This is performed by the new JettyMetricsAutoConfiguration, that is
based on the existing TomcatMetricsAutoConfiguration.

Fixes spring-projectsgh-12090
evenh added a commit to evenh/spring-boot that referenced this issue Feb 23, 2018
This is performed by the new JettyMetricsAutoConfiguration, that is
based on the existing TomcatMetricsAutoConfiguration.

Fixes spring-projectsgh-12090
evenh added a commit to evenh/spring-boot that referenced this issue Feb 23, 2018
This is performed by the new JettyMetricsAutoConfiguration, that is
based on the existing TomcatMetricsAutoConfiguration.

Fixes spring-projectsgh-12090
@wilkinsona
Copy link
Member

wilkinsona commented May 17, 2020

Thanks, @davidkarlsen. Unfortunately, TimedHandler makes things more complicated rather than less. We now use Jetty's StatisticsHandler when graceful shutdown is enabled and we would not want to use both StatisticsHandler and TimedHandler when Micrometer's on the classpath as well.

@jkschneider @shakuzen What was the motivation for creating TimedHandler rather than using Jetty's StatisticsHandler?

@jkschneider
Copy link
Contributor

jkschneider commented May 18, 2020

@wilkinsona Spring's http.server.requests > TimedHandler > StatisticsHandler. Because you have good framework-level instrumentation of API endpoints, adding TimedHandler or StatisticsHandler would not be useful.

TimedHandler is like StatisticsHandler, but much higher resolution. Rather than relying on StatisticsHandler's pre-aggregation of request throughput, etc. which are lossy it uses Micrometer timers.

TimedHandler was designed for projects that are using the Jetty API more directly, like Javalin to get a request-level metrics experience similar to Spring Boot's WebMvc and WebFlux metrics.

For Spring Boot, I think just stick with what you've already got for http.server.requests and maybe autoconfigure the JettyServerThreadPoolMetrics, JettyConnectionMetrics, and JettySslHandshakeMetrics binders? As LongTaskTimer continues to evolve into a more general purpose measure of saturation, the pool and connection metrics will just keep getting more and more useful.

@nyilmaz
Copy link

nyilmaz commented Feb 9, 2021

@wilkinsona JettyServerThreadPoolMetrics is now supported by JettyMetricsAutoConfiguration. Would *Metrics classes which @jkschneider mentioned, be considered for further auto configuration?

@wilkinsona
Copy link
Member

@nyilmaz Yes, we can consider them. I think, although can't remember for certain, that's why I left this issue open when #14591 was implemented.

@nyilmaz
Copy link

nyilmaz commented Feb 9, 2021

oh nice, any plans or target release candidates for this issue?

@wilkinsona
Copy link
Member

The issue's assigned to the general backlog milestone which means we don't have any concrete plans for it at the moment.

@wilkinsona
Copy link
Member

We now bind connection and SSL handshake metrics in addition to the existing thread pool metrics binding so I think we're done here thanks to @bono007.

@wilkinsona wilkinsona removed this from the General Backlog milestone Jul 13, 2021
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Jul 13, 2021
@nyilmaz
Copy link

nyilmaz commented Oct 21, 2021

@wilkinsona @snicoll is there any chance to include TimedHandler to the autoconfiguration process?

@wilkinsona
Copy link
Member

As per Jon's comment above, that's not something we're considering at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants