Skip to content

Commit

Permalink
Only check non-negative stats for active, current and queue
Browse files Browse the repository at this point in the history
In SimpleThreadPoolIT, stats are gathered for each threadpool being
checked, then measurements are collected. Some stats may go up or down
depending on other background tasks outside the test. This commit
adjusts the check for those stats to only check collecting non-negative
values.

closes elastic#108320
  • Loading branch information
rjernst committed Dec 2, 2024
1 parent 285a71b commit af8e743
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ tests:
- class: org.elasticsearch.xpack.shutdown.NodeShutdownIT
method: testAllocationPreventedForRemoval
issue: https://github.com/elastic/elasticsearch/issues/116363
- class: org.elasticsearch.threadpool.SimpleThreadPoolIT
method: testThreadPoolMetrics
issue: https://github.com/elastic/elasticsearch/issues/108320
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
method: testILMDownsampleRollingRestart
issue: https://github.com/elastic/elasticsearch/issues/114233
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public void testThreadPoolMetrics() throws Exception {
tps[0].forEach(stats -> {
Map<String, Long> threadPoolStats = List.of(
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_COMPLETED, stats.completed()),
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_ACTIVE, (long) stats.active()),
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_CURRENT, (long) stats.threads()),
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_ACTIVE, 0L),
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_CURRENT, 0L),
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_LARGEST, (long) stats.largest()),
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_QUEUE, (long) stats.queue())
Map.entry(ThreadPool.THREAD_POOL_METRIC_NAME_QUEUE, 0L)
).stream().collect(toUnmodifiableSortedMap(e -> stats.name() + e.getKey(), Entry::getValue));

Function<String, List<Long>> measurementExtractor = name -> {
Expand Down

0 comments on commit af8e743

Please sign in to comment.