diff --git a/distribution/src/bin/opensearch-cli b/distribution/src/bin/opensearch-cli old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-cli.bat b/distribution/src/bin/opensearch-cli.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-env b/distribution/src/bin/opensearch-env old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-env-from-file b/distribution/src/bin/opensearch-env-from-file old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-env.bat b/distribution/src/bin/opensearch-env.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-keystore.bat b/distribution/src/bin/opensearch-keystore.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-node.bat b/distribution/src/bin/opensearch-node.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-plugin.bat b/distribution/src/bin/opensearch-plugin.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-service-mgr.exe b/distribution/src/bin/opensearch-service-mgr.exe old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-service-x64.exe b/distribution/src/bin/opensearch-service-x64.exe old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-service.bat b/distribution/src/bin/opensearch-service.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-shard.bat b/distribution/src/bin/opensearch-shard.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch-upgrade.bat b/distribution/src/bin/opensearch-upgrade.bat old mode 100755 new mode 100644 diff --git a/distribution/src/bin/opensearch.bat b/distribution/src/bin/opensearch.bat old mode 100755 new mode 100644 diff --git a/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/InMemorySingletonSpanProvider.java b/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/InMemorySingletonSpanExporterProvider.java similarity index 87% rename from plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/InMemorySingletonSpanProvider.java rename to plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/InMemorySingletonSpanExporterProvider.java index f03586767b1f6..e642df07b5e8c 100644 --- a/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/InMemorySingletonSpanProvider.java +++ b/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/InMemorySingletonSpanExporterProvider.java @@ -12,7 +12,7 @@ import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider; import io.opentelemetry.sdk.trace.export.SpanExporter; -public class InMemorySingletonSpanProvider implements ConfigurableSpanExporterProvider { +public class InMemorySingletonSpanExporterProvider implements ConfigurableSpanExporterProvider { @Override public SpanExporter createExporter(ConfigProperties config) { diff --git a/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/IntegrationTestOTelTelemetryPlugin.java b/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/IntegrationTestOTelTelemetryPlugin.java index 23afede52ed89..039932769396c 100644 --- a/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/IntegrationTestOTelTelemetryPlugin.java +++ b/plugins/telemetry-otel/src/internalClusterTest/java/org/opensearch/telemetry/tracing/IntegrationTestOTelTelemetryPlugin.java @@ -8,6 +8,7 @@ package org.opensearch.telemetry.tracing; +import org.opensearch.common.settings.Settings; import org.opensearch.telemetry.OTelTelemetryPlugin; import org.opensearch.telemetry.Telemetry; @@ -21,9 +22,10 @@ public class IntegrationTestOTelTelemetryPlugin extends OTelTelemetryPlugin { /** * Creates IntegrationTestOTelTelemetryPlugin + * @param settings cluster settings */ - public IntegrationTestOTelTelemetryPlugin() { - super(); + public IntegrationTestOTelTelemetryPlugin(Settings settings) { + super(settings); } /** diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetryPlugin.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetryPlugin.java index 73f9035b9005d..f93800b558f70 100644 --- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetryPlugin.java +++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetryPlugin.java @@ -8,6 +8,7 @@ package org.opensearch.telemetry; +import org.opensearch.common.settings.Settings; import org.opensearch.plugins.Plugin; import org.opensearch.plugins.TelemetryPlugin; import org.opensearch.telemetry.metrics.MetricsTelemetry; @@ -24,10 +25,15 @@ public class OTelTelemetryPlugin extends Plugin implements TelemetryPlugin { static final String OTEL_TRACER_NAME = "otel"; + private final Settings settings; + /** * Creates Otel plugin + * @param settings cluster settings */ - public OTelTelemetryPlugin() {} + public OTelTelemetryPlugin(Settings settings) { + this.settings = settings; + } @Override public Optional getTelemetry() { @@ -40,7 +46,7 @@ public String getName() { } private Telemetry telemetry() { - return new OTelTelemetry(new OTelTracingTelemetry(OTelResourceProvider.get()), new MetricsTelemetry() { + return new OTelTelemetry(new OTelTracingTelemetry(OTelResourceProvider.get(settings)), new MetricsTelemetry() { }); } diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java index 2d070fc07656b..882f812b0fb81 100644 --- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java +++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java @@ -8,6 +8,8 @@ package org.opensearch.telemetry.tracing; +import org.opensearch.common.settings.Settings; + import java.util.Map; import io.opentelemetry.api.OpenTelemetry; @@ -23,9 +25,10 @@ private OTelResourceProvider() {} /** * Creates OpenTelemetry instance with AutoConfiguredOpenTelemetrySdk settings configuration + * @param settings cluster settings * @return OpenTelemetry instance */ - public static OpenTelemetry get() { + public static OpenTelemetry get(Settings settings) { OpenTelemetry openTelemetry = AutoConfiguredOpenTelemetrySdk.builder() .setResultAsGlobal(false) .addPropertiesSupplier(() -> Map.of("otel.logs.exporter", "none", "otel.metrics.exporter", "none")) diff --git a/plugins/telemetry-otel/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider b/plugins/telemetry-otel/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider index 9f778c99a1966..21af23ae462c1 100644 --- a/plugins/telemetry-otel/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider +++ b/plugins/telemetry-otel/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider @@ -6,4 +6,4 @@ # compatible open source license. # -org.opensearch.telemetry.tracing.InMemorySingletonSpanProvider +org.opensearch.telemetry.tracing.InMemorySingletonSpanExporterProvider diff --git a/plugins/telemetry-otel/src/test/java/org/opensearch/telemetry/OTelTelemetryPluginTests.java b/plugins/telemetry-otel/src/test/java/org/opensearch/telemetry/OTelTelemetryPluginTests.java index 6e57b3a4cdb51..f750d3d0c39c6 100644 --- a/plugins/telemetry-otel/src/test/java/org/opensearch/telemetry/OTelTelemetryPluginTests.java +++ b/plugins/telemetry-otel/src/test/java/org/opensearch/telemetry/OTelTelemetryPluginTests.java @@ -10,6 +10,7 @@ import org.opensearch.common.settings.ClusterSettings; import org.opensearch.common.settings.Setting; +import org.opensearch.common.settings.Settings; import org.opensearch.common.util.FeatureFlags; import org.opensearch.telemetry.tracing.OTelTracingTelemetry; import org.opensearch.telemetry.tracing.TracingTelemetry; @@ -32,9 +33,8 @@ public class OTelTelemetryPluginTests extends OpenSearchTestCase { @Before public void setup() { - // TRACER_EXPORTER_DELAY_SETTING should always be less than 10 seconds because - // io.opentelemetry.sdk.OpenTelemetrySdk.close waits only for 10 seconds for shutdown to complete. - oTelTracerModulePlugin = new OTelTelemetryPlugin(); + Settings settings = Settings.builder().build(); + oTelTracerModulePlugin = new OTelTelemetryPlugin(settings); telemetry = oTelTracerModulePlugin.getTelemetry(); tracingTelemetry = telemetry.get().getTracingTelemetry(); } diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java index 914b43bf8caae..6fe347d9ac463 100644 --- a/server/src/main/java/org/opensearch/node/Node.java +++ b/server/src/main/java/org/opensearch/node/Node.java @@ -723,18 +723,6 @@ protected Node( threadPool ); - TracerFactory tracerFactory; - if (FeatureFlags.isEnabled(TELEMETRY)) { - final TelemetrySettings telemetrySettings = new TelemetrySettings(settings, clusterService.getClusterSettings()); - List telemetryPlugins = pluginsService.filterPlugins(TelemetryPlugin.class); - TelemetryModule telemetryModule = new TelemetryModule(telemetryPlugins); - tracerFactory = new TracerFactory(telemetrySettings, telemetryModule.getTelemetry(), threadPool.getThreadContext()); - } else { - tracerFactory = new NoopTracerFactory(); - } - tracer = tracerFactory.getTracer(); - resourcesToClose.add(tracer::close); - final IndicesService indicesService = new IndicesService( settings, pluginsService, @@ -1048,6 +1036,18 @@ protected Node( searchModule.getIndexSearcherExecutor(threadPool) ); + TracerFactory tracerFactory; + if (FeatureFlags.isEnabled(TELEMETRY)) { + final TelemetrySettings telemetrySettings = new TelemetrySettings(settings, clusterService.getClusterSettings()); + List telemetryPlugins = pluginsService.filterPlugins(TelemetryPlugin.class); + TelemetryModule telemetryModule = new TelemetryModule(telemetryPlugins); + tracerFactory = new TracerFactory(telemetrySettings, telemetryModule.getTelemetry(), threadPool.getThreadContext()); + } else { + tracerFactory = new NoopTracerFactory(); + } + tracer = tracerFactory.getTracer(); + resourcesToClose.add(tracer::close); + final List> tasksExecutors = pluginsService.filterPlugins(PersistentTaskPlugin.class) .stream() .map(