-
Notifications
You must be signed in to change notification settings - Fork 858
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove -alpha artifacts from runtime classpath of stable components (#…
- Loading branch information
Showing
46 changed files
with
1,210 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...nsions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/IncubatingUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.autoconfigure; | ||
|
||
import io.opentelemetry.api.incubator.events.GlobalEventLoggerProvider; | ||
import io.opentelemetry.sdk.logs.SdkLoggerProvider; | ||
import io.opentelemetry.sdk.logs.internal.SdkEventLoggerProvider; | ||
|
||
/** | ||
* Utilities for interacting with {@code io.opentelemetry:opentelemetry-api-incubator}, which is not | ||
* guaranteed to be present on the classpath. For all methods, callers MUST first separately | ||
* reflectively confirm that the incubator is available on the classpath. | ||
*/ | ||
final class IncubatingUtil { | ||
|
||
private IncubatingUtil() {} | ||
|
||
static void setGlobalEventLoggerProvider(SdkLoggerProvider sdkLoggerProvider) { | ||
GlobalEventLoggerProvider.set(SdkEventLoggerProvider.create(sdkLoggerProvider)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...g/java/io/opentelemetry/sdk/autoconfigure/AutoconfigureGlobalEventLoggerProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.autoconfigure; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import io.opentelemetry.api.GlobalOpenTelemetry; | ||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.incubator.events.GlobalEventLoggerProvider; | ||
import io.opentelemetry.sdk.OpenTelemetrySdk; | ||
import io.opentelemetry.sdk.logs.internal.SdkEventLoggerProvider; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class AutoconfigureGlobalEventLoggerProviderTest { | ||
|
||
private AutoConfiguredOpenTelemetrySdkBuilder builder; | ||
|
||
@BeforeEach | ||
void resetGlobal() { | ||
GlobalOpenTelemetry.resetForTest(); | ||
GlobalEventLoggerProvider.resetForTest(); | ||
builder = | ||
AutoConfiguredOpenTelemetrySdk.builder() | ||
.addPropertiesSupplier(disableExportPropertySupplier()); | ||
} | ||
|
||
@Test | ||
void builder_setResultAsGlobalFalse() { | ||
GlobalOpenTelemetry.set(OpenTelemetry.noop()); | ||
|
||
OpenTelemetrySdk openTelemetry = builder.build().getOpenTelemetrySdk(); | ||
|
||
assertThat(GlobalOpenTelemetry.get()).extracting("delegate").isNotSameAs(openTelemetry); | ||
assertThat(GlobalEventLoggerProvider.get()).isNotSameAs(openTelemetry.getSdkLoggerProvider()); | ||
} | ||
|
||
@Test | ||
void builder_setResultAsGlobalTrue() { | ||
OpenTelemetrySdk openTelemetry = builder.setResultAsGlobal().build().getOpenTelemetrySdk(); | ||
|
||
assertThat(GlobalOpenTelemetry.get()).extracting("delegate").isSameAs(openTelemetry); | ||
assertThat(GlobalEventLoggerProvider.get()) | ||
.isInstanceOf(SdkEventLoggerProvider.class) | ||
.extracting("delegateLoggerProvider") | ||
.isSameAs(openTelemetry.getSdkLoggerProvider()); | ||
} | ||
|
||
private static Supplier<Map<String, String>> disableExportPropertySupplier() { | ||
Map<String, String> props = new HashMap<>(); | ||
props.put("otel.metrics.exporter", "none"); | ||
props.put("otel.traces.exporter", "none"); | ||
props.put("otel.logs.exporter", "none"); | ||
return () -> props; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.