Skip to content

Commit e874a7a

Browse files
rename average to max for queue latency
1 parent 02b7126 commit e874a7a

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

server/src/internalClusterTest/java/org/elasticsearch/index/shard/IndexShardIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public void testNodeWriteLoadsArePresent() {
347347
assertNotNull(writeThreadPoolStats);
348348
assertThat(writeThreadPoolStats.totalThreadPoolThreads(), greaterThanOrEqualTo(0));
349349
assertThat(writeThreadPoolStats.averageThreadPoolUtilization(), greaterThanOrEqualTo(0.0f));
350-
assertThat(writeThreadPoolStats.averageThreadPoolQueueLatencyMillis(), greaterThanOrEqualTo(0L));
350+
assertThat(writeThreadPoolStats.maxThreadPoolQueueLatencyMillis(), greaterThanOrEqualTo(0L));
351351
}
352352
} finally {
353353
updateClusterSettings(

server/src/main/java/org/elasticsearch/cluster/NodeUsageStatsForThreadPools.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ public String toString() {
7070
*
7171
* @param totalThreadPoolThreads Total number of threads in the thread pool.
7272
* @param averageThreadPoolUtilization Percent of thread pool threads that are in use, averaged over some period of time.
73-
* @param averageThreadPoolQueueLatencyMillis How much time tasks spend in the thread pool queue. Zero if there is nothing being queued
74-
* in the write thread pool.
73+
* @param maxThreadPoolQueueLatencyMillis The max time any task has spent in the thread pool queue. Zero if no task is queued.
7574
*/
7675
public record ThreadPoolUsageStats(
7776
int totalThreadPoolThreads,
7877
float averageThreadPoolUtilization,
79-
long averageThreadPoolQueueLatencyMillis
78+
long maxThreadPoolQueueLatencyMillis
8079
) implements Writeable {
8180

8281
public ThreadPoolUsageStats(StreamInput in) throws IOException {
@@ -87,12 +86,12 @@ public ThreadPoolUsageStats(StreamInput in) throws IOException {
8786
public void writeTo(StreamOutput out) throws IOException {
8887
out.writeVInt(this.totalThreadPoolThreads);
8988
out.writeFloat(this.averageThreadPoolUtilization);
90-
out.writeVLong(this.averageThreadPoolQueueLatencyMillis);
89+
out.writeVLong(this.maxThreadPoolQueueLatencyMillis);
9190
}
9291

9392
@Override
9493
public int hashCode() {
95-
return Objects.hash(totalThreadPoolThreads, averageThreadPoolUtilization, averageThreadPoolQueueLatencyMillis);
94+
return Objects.hash(totalThreadPoolThreads, averageThreadPoolUtilization, maxThreadPoolQueueLatencyMillis);
9695
}
9796

9897
@Override
@@ -101,8 +100,8 @@ public String toString() {
101100
+ totalThreadPoolThreads
102101
+ ", averageThreadPoolUtilization="
103102
+ averageThreadPoolUtilization
104-
+ ", averageThreadPoolQueueLatencyMillis="
105-
+ averageThreadPoolQueueLatencyMillis
103+
+ ", maxThreadPoolQueueLatencyMillis="
104+
+ maxThreadPoolQueueLatencyMillis
106105
+ "]";
107106
}
108107

@@ -113,7 +112,7 @@ public boolean equals(Object o) {
113112
ThreadPoolUsageStats other = (ThreadPoolUsageStats) o;
114113
return totalThreadPoolThreads == other.totalThreadPoolThreads
115114
&& averageThreadPoolUtilization == other.averageThreadPoolUtilization
116-
&& averageThreadPoolQueueLatencyMillis == other.averageThreadPoolQueueLatencyMillis;
115+
&& maxThreadPoolQueueLatencyMillis == other.maxThreadPoolQueueLatencyMillis;
117116
}
118117

119118
} // ThreadPoolUsageStats

server/src/test/java/org/elasticsearch/cluster/ClusterInfoTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static Map<String, NodeUsageStatsForThreadPools> randomNodeUsageStatsFor
7272
NodeUsageStatsForThreadPools.ThreadPoolUsageStats writeThreadPoolUsageStats =
7373
new NodeUsageStatsForThreadPools.ThreadPoolUsageStats(/* totalThreadPoolThreads= */ randomIntBetween(1, 16),
7474
/* averageThreadPoolUtilization= */ randomFloat(),
75-
/* averageThreadPoolQueueLatencyMillis= */ randomLongBetween(0, 50000)
75+
/* maxThreadPoolQueueLatencyMillis= */ randomLongBetween(0, 50000)
7676
);
7777
Map<String, NodeUsageStatsForThreadPools.ThreadPoolUsageStats> usageStatsForThreadPools = new HashMap<>();
7878
usageStatsForThreadPools.put(ThreadPool.Names.WRITE, writeThreadPoolUsageStats);

0 commit comments

Comments
 (0)