-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add Jetty's ThreadPool metrics #593
Add Jetty's ThreadPool metrics #593
Conversation
.tags(tags) | ||
.description("The number of max threads") | ||
.register(registry); | ||
Gauge.builder("jetty.threads.live", threadPool, InstrumentedQueuedThreadPool::getThreads) |
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.
How does this compare to the Tomcat equivalent? Wondering if active
is a better name and how it differs from busy? Or is it merely idle + busy
?
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 decided the name live
with reference to JvmThreadMetrics.
https://github.com/micrometer-metrics/micrometer/blob/v1.0.3/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/JvmThreadMetrics.java#L57
For the meaning of the metric please refer to the Jetty's source.
https://github.com/eclipse/jetty.project/blob/jetty-9.4.8.v20171121/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java#L428-L455
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.
Unified with Tomcat's metrics name.
(from live
to current
)
https://github.com/micrometer-metrics/micrometer/blob/v1.0.3/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/tomcat/TomcatMetrics.java#L89
Hello. |
Just a thought: Is the |
Good point.
|
Updated |
Just tested against Spring Boot 1.5 with
LGTM. Perhaps some auto-configuration for |
@mweirauch Thank you for the confirmation. |
Would you merge this PR? |
Just one thing, could you add I am not too familiar with the Anything else @checketts @jkschneider ? Rebase against |
Merged in 21a375a |
I fear the Haven't found any other solution except actually defining the factory ourselfs. Dunno if the setup has changed with Spring Boot 2 and it becomes easier. In case one really needs to roll his own factory and still wants threadpool instrumentation, one needs to exclude the |
@mweirauch Thank you for the opinion. |
The factory is being asked to create a server before our configuration has a chance to kick in. Relates to #593.
The factory is being asked to create a server before our configuration has a chance to kick in. Relates to #593.
I'm looking at incorporating this change into Spring Boot 2.0. What's the benefit of |
So, perhaps we could actually ask for the Would it be allowed to register a new bean within Edit: Think we could just directly bind to the |
Not really, no. A |
How does this look like? @Configuration
@ConditionalOnClass({ Server.class, Loader.class, WebAppContext.class })
public class JettyMetricsAutoConfiguration {
@Bean
public WebServerFactoryCustomizer<JettyServletWebServerFactory> jettyFactoryCustomizer(
MeterRegistry registry) {
return (factory) -> factory.setThreadPool(
new InstrumentedQueuedThreadPool(registry, Collections.emptyList()));
}
} |
That's better in terms of the conditions, but it's still setting the factory's thread pool and using |
I've opened #911 to describe and further discuss what I think needs to be done. |
I want to monitor whether Jetty's ThreadPool setting is sufficient so I'd like to add several metrics.
Usage
Example In Spring Boot 2.0.x