Skip to content

Commit

Permalink
Fix Jetty 12.x QueuedThreadPool metrics (#4225)
Browse files Browse the repository at this point in the history
Refs #4181
(cherry picked from commit 9e0bedb)

Co-authored-by: Dmitry Kaukov <dkaukov@opentable.com>
  • Loading branch information
joschi and dkaukov committed Jun 9, 2024
1 parent 0c2e3b6 commit 06c0f0e
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,10 @@ protected void doStart() throws Exception {
metricRegistry.register(prefix.resolve(NAME_UTILIZATION), new RatioGauge() {
@Override
protected Ratio getRatio() {
return Ratio.of(getThreads() - getIdleThreads(), getThreads());
}
});
metricRegistry.register(prefix.resolve(NAME_UTILIZATION_MAX), new RatioGauge() {
@Override
protected Ratio getRatio() {
return Ratio.of(getThreads() - getIdleThreads(), getMaxThreads());
return Ratio.of(getUtilizedThreads(), getThreads() - getLeasedThreads());
}
});
metricRegistry.registerGauge(prefix.resolve(NAME_UTILIZATION_MAX), this::getUtilizationRate);
metricRegistry.registerGauge(prefix.resolve(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 06c0f0e

Please sign in to comment.