Skip to content

Commit d6e44ed

Browse files
committed
Add 99th percentile
1 parent 516a4a9 commit d6e44ed

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

server/src/main/java/org/elasticsearch/common/util/concurrent/TaskExecutionTimeTrackingEsThreadPoolExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
public final class TaskExecutionTimeTrackingEsThreadPoolExecutor extends EsThreadPoolExecutor {
3737

38-
private static final int[] LATENCY_PERCENTILES_TO_REPORT = { 50, 90 };
38+
private static final int[] LATENCY_PERCENTILES_TO_REPORT = { 50, 90, 99 };
3939
public static final String THREAD_POOL_METRIC_NAME_QUEUE_TIME = ".threads.queue.latency.histogram";
4040

4141
private final Function<Runnable, WrappedRunnable> runnableWrapper;

server/src/test/java/org/elasticsearch/common/util/concurrent/TaskExecutionTimeTrackingEsThreadPoolExecutorTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,9 @@ public void testQueueLatencyMetrics() {
206206
ThreadPool.THREAD_POOL_METRIC_PREFIX + threadPoolName
207207
+ TaskExecutionTimeTrackingEsThreadPoolExecutor.THREAD_POOL_METRIC_NAME_QUEUE_TIME
208208
);
209-
assertThat(measurements, hasSize(2));
209+
assertThat(measurements, hasSize(3));
210210
// we have to use greater than or equal to because the actual delay might be higher than what we imposed
211+
assertThat(getPercentile(measurements, "99"), greaterThanOrEqualTo(expectedHistogram.getPercentile(0.99f)));
211212
assertThat(getPercentile(measurements, "90"), greaterThanOrEqualTo(expectedHistogram.getPercentile(0.9f)));
212213
assertThat(getPercentile(measurements, "50"), greaterThanOrEqualTo(expectedHistogram.getPercentile(0.5f)));
213214
} finally {

0 commit comments

Comments
 (0)