Skip to content

Commit bb05622

Browse files
committed
Dummy thread pool usage stats for virtual thread pool
1 parent fd329b1 commit bb05622

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/node/usage/TransportNodeUsageStatsForThreadPoolsAction.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,18 @@ protected NodeUsageStatsForThreadPoolsAction.NodeResponse nodeOperation(
9696
) {
9797
DiscoveryNode localNode = clusterService.localNode();
9898
var writeExecutor = threadPool.executor(ThreadPool.Names.WRITE);
99-
assert writeExecutor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor;
100-
var trackingForWriteExecutor = (TaskExecutionTimeTrackingEsThreadPoolExecutor) writeExecutor;
101-
102-
ThreadPoolUsageStats threadPoolUsageStats = new ThreadPoolUsageStats(
103-
trackingForWriteExecutor.getMaximumPoolSize(),
104-
(float) trackingForWriteExecutor.pollUtilization(
105-
TaskExecutionTimeTrackingEsThreadPoolExecutor.UtilizationTrackingPurpose.ALLOCATION
106-
),
107-
trackingForWriteExecutor.getMaxQueueLatencyMillisSinceLastPollAndReset()
108-
);
99+
final ThreadPoolUsageStats threadPoolUsageStats;
100+
if (writeExecutor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor trackingForWriteExecutor) {
101+
threadPoolUsageStats = new ThreadPoolUsageStats(
102+
trackingForWriteExecutor.getMaximumPoolSize(),
103+
(float) trackingForWriteExecutor.pollUtilization(
104+
TaskExecutionTimeTrackingEsThreadPoolExecutor.UtilizationTrackingPurpose.ALLOCATION
105+
),
106+
trackingForWriteExecutor.getMaxQueueLatencyMillisSinceLastPollAndReset()
107+
);
108+
} else {
109+
threadPoolUsageStats = new ThreadPoolUsageStats(999, 0.5f, 999);
110+
}
109111

110112
Map<String, ThreadPoolUsageStats> perThreadPool = new HashMap<>();
111113
perThreadPool.put(ThreadPool.Names.WRITE, threadPoolUsageStats);

0 commit comments

Comments
 (0)