Skip to content

Commit 1a8bf7d

Browse files
tommy-bobrian-brazil
authored andcommitted
Produce metric for max thread pool size (#319)
1 parent 6b10e1f commit 1a8bf7d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

simpleclient_jetty_jdk8/src/main/java/io/prometheus/client/jetty/QueuedThreadPoolStatisticsCollector.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public List<MetricFamilySamples> collect() {
3636
QueuedThreadPool::getThreads),
3737
buildGauge("jetty_queued_thread_pool_threads_idle", "Number of idle threads",
3838
QueuedThreadPool::getIdleThreads),
39+
buildGauge("jetty_queued_thread_pool_threads_max", "Max size of thread pool",
40+
QueuedThreadPool::getMaxThreads),
3941
buildGauge("jetty_queued_thread_pool_jobs", "Number of total jobs",
4042
QueuedThreadPool::getQueueSize));
4143
}

simpleclient_jetty_jdk8/src/test/java/io/prometheus/client/jetty/QueuedThreadPoolStatisticsCollectorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public void metricsGathered() throws Exception {
5050
assertTrue(
5151
CollectorRegistry.defaultRegistry.getSampleValue("jetty_queued_thread_pool_threads_idle",
5252
LABEL_NAMES, labelValues) > 0);
53+
assertTrue(
54+
CollectorRegistry.defaultRegistry.getSampleValue("jetty_queued_thread_pool_threads_max",
55+
LABEL_NAMES, labelValues) == 200);
5356
assertNotNull(CollectorRegistry.defaultRegistry.getSampleValue("jetty_queued_thread_pool_jobs",
5457
LABEL_NAMES, labelValues));
5558
}

0 commit comments

Comments
 (0)