diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java index 97b2d277b0034..36aba0959550b 100644 --- a/server/src/main/java/org/opensearch/node/Node.java +++ b/server/src/main/java/org/opensearch/node/Node.java @@ -207,7 +207,6 @@ import org.opensearch.plugins.SearchPlugin; import org.opensearch.plugins.SecureSettingsFactory; import org.opensearch.plugins.SystemIndexPlugin; -import org.opensearch.plugins.TelemetryPlugin; import org.opensearch.ratelimitting.admissioncontrol.AdmissionControlService; import org.opensearch.ratelimitting.admissioncontrol.transport.AdmissionControlTransportInterceptor; import org.opensearch.repositories.RepositoriesModule; @@ -237,15 +236,9 @@ import org.opensearch.tasks.TaskResourceTrackingService; import org.opensearch.tasks.TaskResultsService; import org.opensearch.tasks.consumer.TopNSearchTasksLogger; -import org.opensearch.telemetry.TelemetryModule; -import org.opensearch.telemetry.TelemetrySettings; import org.opensearch.telemetry.metrics.MetricsRegistry; -import org.opensearch.telemetry.metrics.MetricsRegistryFactory; -import org.opensearch.telemetry.metrics.NoopMetricsRegistryFactory; import org.opensearch.telemetry.service.TelemetryService; -import org.opensearch.telemetry.tracing.NoopTracerFactory; import org.opensearch.telemetry.tracing.Tracer; -import org.opensearch.telemetry.tracing.TracerFactory; import org.opensearch.threadpool.ExecutorBuilder; import org.opensearch.threadpool.RunnableTaskExecutionListener; import org.opensearch.threadpool.ThreadPool; @@ -612,7 +605,12 @@ protected Node( ); } - TelemetryService telemetryService = new TelemetryService(settings, clusterService.getClusterSettings(), pluginsService, threadPool); + TelemetryService telemetryService = new TelemetryService( + settings, + clusterService.getClusterSettings(), + pluginsService, + threadPool + ); pluginsService.setTelemetryService(telemetryService); resourcesToClose.add(telemetryService); diff --git a/server/src/main/java/org/opensearch/plugins/Plugin.java b/server/src/main/java/org/opensearch/plugins/Plugin.java index e0421df013921..c359599d2b36b 100644 --- a/server/src/main/java/org/opensearch/plugins/Plugin.java +++ b/server/src/main/java/org/opensearch/plugins/Plugin.java @@ -284,5 +284,5 @@ public Optional getSecureSettingFactory(Settings settings * Called to set the {@link TelemetryService} and plugins can use it for generating the instrumentations. * @param telemetryService telemetry service */ - public void setTelemetryService(TelemetryService telemetryService){} + public void setTelemetryService(TelemetryService telemetryService) {} } diff --git a/server/src/main/java/org/opensearch/telemetry/service/TelemetryService.java b/server/src/main/java/org/opensearch/telemetry/service/TelemetryService.java index 7f5dda6004085..60dc5ab24487f 100644 --- a/server/src/main/java/org/opensearch/telemetry/service/TelemetryService.java +++ b/server/src/main/java/org/opensearch/telemetry/service/TelemetryService.java @@ -8,8 +8,6 @@ package org.opensearch.telemetry.service; -import java.io.IOException; -import java.util.List; import org.opensearch.common.annotation.ExperimentalApi; import org.opensearch.common.lifecycle.AbstractLifecycleComponent; import org.opensearch.common.settings.ClusterSettings; @@ -27,6 +25,9 @@ import org.opensearch.telemetry.tracing.TracerFactory; import org.opensearch.threadpool.ThreadPool; +import java.io.IOException; +import java.util.List; + import static org.opensearch.common.util.FeatureFlags.TELEMETRY; /** @@ -72,7 +73,7 @@ private void init(Settings settings, ClusterSettings clusterSettings, PluginsSer * will be returned. * @return tracer. */ - public Tracer getTracer(){ + public Tracer getTracer() { return tracerFactory.getTracer(); } @@ -80,17 +81,15 @@ public Tracer getTracer(){ * Returns the {@link MetricsRegistry} object. If metrics registry or telemetry plugin is not configured then returns {@link MetricsRegistry} * @return */ - public MetricsRegistry getMetricsRegistry(){ + public MetricsRegistry getMetricsRegistry() { return metricsRegistryFactory.getMetricsRegistry(); } @Override - protected void doStart() { - } + protected void doStart() {} @Override - protected void doStop() { - } + protected void doStop() {} @Override protected void doClose() throws IOException {