From 987abdb8b99d1413b4868ce560a547a470431160 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 8 Feb 2021 14:59:53 -0800 Subject: [PATCH] Fix disabling micrometer --- .../agent/internal/BeforeAgentInstaller.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/BeforeAgentInstaller.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/BeforeAgentInstaller.java index 452b1d490aa..4eaae6d353e 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/BeforeAgentInstaller.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/BeforeAgentInstaller.java @@ -65,6 +65,7 @@ import com.microsoft.applicationinsights.web.internal.correlation.CdsProfileFetcher; import io.opentelemetry.instrumentation.api.aiconnectionstring.AiConnectionString; import io.opentelemetry.instrumentation.api.config.Config; +import io.opentelemetry.instrumentation.api.config.ConfigBuilder; import org.apache.http.HttpHost; import org.checkerframework.checker.nullness.qual.Nullable; import org.slf4j.Logger; @@ -125,6 +126,7 @@ private static void start(Instrumentation instrumentation) throws Exception { // TODO need some kind of test for these configuration properties if (!isInstrumentationEnabled(config, "micrometer")) { properties.put("otel.instrumentation.micrometer.enabled", "false"); + properties.put("otel.instrumentation.actuator-metrics.enabled", "false"); } if (!isInstrumentationEnabled(config, "jdbc")) { properties.put("otel.instrumentation.jdbc.enabled", "false"); @@ -149,7 +151,7 @@ private static void start(Instrumentation instrumentation) throws Exception { // AI exporter is configured manually properties.put("otel.trace.exporter", "none"); properties.put("otel.metrics.exporter", "none"); - Config.internalInitializeConfig(Config.create(properties)); + Config.internalInitializeConfig(new ConfigBuilder().readProperties(properties).build()); if (Config.get().getListProperty("otel.additional.bootstrap.package.prefixes").isEmpty()) { throw new IllegalStateException("underlying config not initialized in time"); }