diff --git a/docs/changelog/112687.yaml b/docs/changelog/112687.yaml new file mode 100644 index 0000000000000..dd079e1b700c4 --- /dev/null +++ b/docs/changelog/112687.yaml @@ -0,0 +1,5 @@ +pr: 112687 +summary: Add `TaskManager` to `pluginServices` +area: Infra/Metrics +type: enhancement +issues: [] diff --git a/server/src/main/java/org/elasticsearch/node/NodeConstruction.java b/server/src/main/java/org/elasticsearch/node/NodeConstruction.java index eb9ef08b329ab..ea53882a22a01 100644 --- a/server/src/main/java/org/elasticsearch/node/NodeConstruction.java +++ b/server/src/main/java/org/elasticsearch/node/NodeConstruction.java @@ -855,7 +855,8 @@ private void construct( featureService, systemIndices, dataStreamGlobalRetentionSettings, - documentParsingProvider + documentParsingProvider, + taskManager ); Collection pluginComponents = pluginsService.flatMap(plugin -> { diff --git a/server/src/main/java/org/elasticsearch/node/PluginServiceInstances.java b/server/src/main/java/org/elasticsearch/node/PluginServiceInstances.java index 7c8775502fd64..74ae5936c9602 100644 --- a/server/src/main/java/org/elasticsearch/node/PluginServiceInstances.java +++ b/server/src/main/java/org/elasticsearch/node/PluginServiceInstances.java @@ -24,6 +24,7 @@ import org.elasticsearch.plugins.internal.DocumentParsingProvider; import org.elasticsearch.repositories.RepositoriesService; import org.elasticsearch.script.ScriptService; +import org.elasticsearch.tasks.TaskManager; import org.elasticsearch.telemetry.TelemetryProvider; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.watcher.ResourceWatcherService; @@ -48,5 +49,6 @@ public record PluginServiceInstances( FeatureService featureService, SystemIndices systemIndices, DataStreamGlobalRetentionSettings dataStreamGlobalRetentionSettings, - DocumentParsingProvider documentParsingProvider + DocumentParsingProvider documentParsingProvider, + TaskManager taskManager ) implements Plugin.PluginServices {} diff --git a/server/src/main/java/org/elasticsearch/plugins/Plugin.java b/server/src/main/java/org/elasticsearch/plugins/Plugin.java index a8bfda54b0646..4441ecadc3e8e 100644 --- a/server/src/main/java/org/elasticsearch/plugins/Plugin.java +++ b/server/src/main/java/org/elasticsearch/plugins/Plugin.java @@ -31,6 +31,7 @@ import org.elasticsearch.plugins.internal.DocumentParsingProvider; import org.elasticsearch.repositories.RepositoriesService; import org.elasticsearch.script.ScriptService; +import org.elasticsearch.tasks.TaskManager; import org.elasticsearch.telemetry.TelemetryProvider; import org.elasticsearch.threadpool.ExecutorBuilder; import org.elasticsearch.threadpool.ThreadPool; @@ -165,6 +166,12 @@ public interface PluginServices { * A provider of utilities to observe and report parsing of documents */ DocumentParsingProvider documentParsingProvider(); + + /** + * The task manager for the node. This should only be used by plugins + * to track task removal by registering a RemovedTaskListener. + */ + TaskManager taskManager(); } /**