File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
server/src/main/java/org/elasticsearch Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -712,9 +712,10 @@ private void construct(
712712 ClusterService clusterService = createClusterService (settingsModule , threadPool , taskManager );
713713 clusterService .addStateApplier (scriptService );
714714
715- var executor = (TaskExecutionTimeTrackingPerIndexEsThreadPoolExecutor ) threadPool .executor (ThreadPool .Names .SEARCH );
716- clusterService .addListener (new SearchIndexTimeTrackingCleanupService (executor ));
717-
715+ var executor = threadPool .executor (ThreadPool .Names .SEARCH );
716+ if (executor instanceof TaskExecutionTimeTrackingPerIndexEsThreadPoolExecutor perIndexExecutor ) {
717+ clusterService .addListener (new SearchIndexTimeTrackingCleanupService (perIndexExecutor ));
718+ }
718719 modules .bindToInstance (DocumentParsingProvider .class , documentParsingProvider );
719720
720721 FailureStoreMetrics failureStoreMetrics = new FailureStoreMetrics (telemetryProvider .getMeterRegistry ());
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ static void addCollectorsAndSearch(SearchContext searchContext) throws QueryPhas
226226 queryResult .terminatedEarly (queryPhaseResult .terminatedAfter ());
227227 }
228228 ExecutorService executor = searchContext .indexShard ().getThreadPool ().executor (ThreadPool .Names .SEARCH );
229- assert executor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor // TODO MP check this
229+ assert executor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor
230230 || (executor instanceof EsThreadPoolExecutor == false /* in case thread pool is mocked out in tests */ )
231231 : "SEARCH threadpool should have an executor that exposes EWMA metrics, but is of type " + executor .getClass ();
232232 if (executor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor rExecutor ) {
You can’t perform that action at this time.
0 commit comments