Skip to content

Commit ff02d91

Browse files
committed
Small config story cleanup
1 parent ff1b24d commit ff02d91

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import static java.util.concurrent.TimeUnit.SECONDS;
77

88
import com.microsoft.applicationinsights.agent.internal.configuration.Configuration;
9-
import com.microsoft.applicationinsights.agent.internal.legacyheaders.DelegatingPropagatorProvider;
109
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
1110
import java.util.HashMap;
1211
import java.util.List;
@@ -104,28 +103,6 @@ public Map<String, String> apply(ConfigProperties otelConfig) {
104103
properties.put("applicationinsights.internal.methods.include", sb.toString());
105104
}
106105

107-
properties.put("otel.propagators", DelegatingPropagatorProvider.NAME);
108-
109-
properties.put("otel.traces.sampler", DelegatingSamplerProvider.NAME);
110-
111-
String tracesExporter = otelConfig.getString("otel.traces.exporter");
112-
if (tracesExporter == null) {
113-
// this overrides the default "otlp" so the exporter can be configured later
114-
properties.put("otel.traces.exporter", "none");
115-
}
116-
117-
String metricsExporter = otelConfig.getString("otel.metrics.exporter");
118-
if (metricsExporter == null) {
119-
// this overrides the default "otlp" so the exporter can be configured later
120-
properties.put("otel.metrics.exporter", "none");
121-
}
122-
123-
String logsExporter = otelConfig.getString("otel.logs.exporter");
124-
if (logsExporter == null) {
125-
// this overrides the default "otlp" so the exporter can be configured later
126-
properties.put("otel.logs.exporter", "none");
127-
}
128-
129106
if (configuration.role.name != null) {
130107
// in case using another exporter
131108
properties.put("otel.service.name", configuration.role.name);

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/SecondEntryPoint.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import com.microsoft.applicationinsights.agent.internal.exporter.AgentSpanExporter;
4141
import com.microsoft.applicationinsights.agent.internal.httpclient.LazyHttpClient;
4242
import com.microsoft.applicationinsights.agent.internal.legacyheaders.AiLegacyHeaderSpanProcessor;
43+
import com.microsoft.applicationinsights.agent.internal.legacyheaders.DelegatingPropagatorProvider;
4344
import com.microsoft.applicationinsights.agent.internal.processors.ExporterWithLogProcessor;
4445
import com.microsoft.applicationinsights.agent.internal.processors.ExporterWithSpanProcessor;
4546
import com.microsoft.applicationinsights.agent.internal.processors.LogExporterWithAttributeProcessor;
@@ -245,6 +246,8 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
245246
.addPropertiesSupplier(
246247
() -> {
247248
Map<String, String> props = new HashMap<>();
249+
props.put("otel.propagators", DelegatingPropagatorProvider.NAME);
250+
props.put("otel.traces.sampler", DelegatingSamplerProvider.NAME);
248251
props.put("otel.traces.exporter", AzureMonitorExporterProviderKeys.EXPORTER_NAME);
249252
props.put("otel.metrics.exporter", AzureMonitorExporterProviderKeys.EXPORTER_NAME);
250253
props.put("otel.logs.exporter", AzureMonitorExporterProviderKeys.EXPORTER_NAME);

0 commit comments

Comments
 (0)