Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the logging exporter by default #8647

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

}