Skip to content

Commit

Permalink
Fix Jetty 12.x QueuedThreadPool metrics (#4181)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaukov authored Jun 9, 2024
1 parent d8599e9 commit 9e0bedb
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,10 @@ protected void doStart() throws Exception {
metricRegistry.register(name(prefix, NAME_UTILIZATION), new RatioGauge() {
@Override
protected Ratio getRatio() {
return Ratio.of(getThreads() - getIdleThreads(), getThreads());
}
});
metricRegistry.register(name(prefix, NAME_UTILIZATION_MAX), new RatioGauge() {
@Override
protected Ratio getRatio() {
return Ratio.of(getThreads() - getIdleThreads(), getMaxThreads());
return Ratio.of(getUtilizedThreads(), getThreads() - getLeasedThreads());
}
});
metricRegistry.registerGauge(name(prefix, NAME_UTILIZATION_MAX), this::getUtilizationRate);
metricRegistry.registerGauge(name(prefix, NAME_SIZE), this::getThreads);
// This assumes the QueuedThreadPool is using a BlockingArrayQueue or
// ArrayBlockingQueue for its queue, and is therefore a constant-time operation.
Expand Down

0 comments on commit 9e0bedb

Please sign in to comment.