diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java index 0ff3e0960415..9b185d45dcd8 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java @@ -5,6 +5,8 @@ package io.opentelemetry.javaagent.tooling; +import static java.util.Collections.singletonMap; + import io.opentelemetry.javaagent.bootstrap.OpenTelemetrySdkAccess; import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; @@ -26,6 +28,9 @@ public static AutoConfiguredOpenTelemetrySdk installOpenTelemetrySdk( AutoConfiguredOpenTelemetrySdk.builder() .setResultAsGlobal(true) .setServiceClassLoader(extensionClassLoader) + // disable the logs exporter by default for the time being + // FIXME remove this in the 2.x branch + .addPropertiesSupplier(() -> singletonMap("otel.logs.exporter", "none")) .build(); OpenTelemetrySdk sdk = autoConfiguredSdk.getOpenTelemetrySdk(); diff --git a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy index 4a16e5940cdd..abd588a679b2 100755 --- a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy +++ b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy @@ -27,11 +27,20 @@ class OpenTelemetryInstallerTest extends Specification { def "should initialize GlobalOpenTelemetry"() { when: - def otelInstaller = OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.classLoader) + def autoConfiguredSdk = OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.classLoader) then: - otelInstaller != null - GlobalOpenTelemetry.getTracerProvider() != OpenTelemetry.noop().getTracerProvider() + autoConfiguredSdk != null + GlobalOpenTelemetry.get() != OpenTelemetry.noop() + } + + def "should disable the logs exporter by default"() { + when: + def autoConfiguredSdk = OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.classLoader) + + then: + autoConfiguredSdk != null + autoConfiguredSdk.config.getString("otel.logs.exporter") == "none" } }