Skip to content

Commit

Permalink
Fixed permissions on executables and added cluster settings back to t…
Browse files Browse the repository at this point in the history
…elemetry plugin

Signed-off-by: Shephali Mittal <[email protected]>
  • Loading branch information
Shephali Mittal committed Aug 22, 2023
1 parent 4df8085 commit ec1a16f
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 22 deletions.
Empty file modified distribution/src/bin/opensearch-cli
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-cli.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-env
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-env-from-file
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-env.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-keystore.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-node.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-plugin.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-service-mgr.exe
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-service-x64.exe
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-service.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-shard.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch-upgrade.bat
100755 → 100644
Empty file.
Empty file modified distribution/src/bin/opensearch.bat
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -21,9 +22,10 @@
public class IntegrationTestOTelTelemetryPlugin extends OTelTelemetryPlugin {
/**
* Creates IntegrationTestOTelTelemetryPlugin
* @param settings cluster settings
*/
public IntegrationTestOTelTelemetryPlugin() {
super();
public IntegrationTestOTelTelemetryPlugin(Settings settings) {
super(settings);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Telemetry> getTelemetry() {
Expand All @@ -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() {
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

package org.opensearch.telemetry.tracing;

import org.opensearch.common.settings.Settings;

import java.util.Map;

import io.opentelemetry.api.OpenTelemetry;
Expand All @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# compatible open source license.
#

org.opensearch.telemetry.tracing.InMemorySingletonSpanProvider
org.opensearch.telemetry.tracing.InMemorySingletonSpanExporterProvider
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
24 changes: 12 additions & 12 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -723,18 +723,6 @@ protected Node(
threadPool
);

TracerFactory tracerFactory;
if (FeatureFlags.isEnabled(TELEMETRY)) {
final TelemetrySettings telemetrySettings = new TelemetrySettings(settings, clusterService.getClusterSettings());
List<TelemetryPlugin> 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,
Expand Down Expand Up @@ -1048,6 +1036,18 @@ protected Node(
searchModule.getIndexSearcherExecutor(threadPool)
);

TracerFactory tracerFactory;
if (FeatureFlags.isEnabled(TELEMETRY)) {
final TelemetrySettings telemetrySettings = new TelemetrySettings(settings, clusterService.getClusterSettings());
List<TelemetryPlugin> 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<PersistentTasksExecutor<?>> tasksExecutors = pluginsService.filterPlugins(PersistentTaskPlugin.class)
.stream()
.map(
Expand Down

0 comments on commit ec1a16f

Please sign in to comment.