Skip to content

Commit

Permalink
Disable the logging exporter by default (#8647)
Browse files Browse the repository at this point in the history
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
  • Loading branch information
Mateusz Rzeszutek and opentelemetrybot authored Jun 5, 2023
1 parent 5a0bddd commit a2fd908
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
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"
}

}

0 comments on commit a2fd908

Please sign in to comment.