Skip to content

Commit 7bb98aa

Browse files
committed
set enabled in test
1 parent 90c437f commit 7bb98aa

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/thread/internal/ThreadDetailsConfigurationCustomizerProviderTest.java

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,38 @@
1919

2020
class ThreadDetailsConfigurationCustomizerProviderTest {
2121

22+
static final String PROCESSOR = "AddThreadDetailsSpanProcessor";
23+
2224
@Test
23-
void addSpanProcessor() {
25+
void disabledByDefault() {
26+
OpenTelemetryConfigurationModel model = modelWithTracer();
27+
28+
try (OpenTelemetrySdk sdk = DeclarativeConfiguration.create(model)) {
29+
assertThat(sdk.toString()).doesNotContain(PROCESSOR);
30+
}
31+
}
32+
33+
@Test
34+
void enabled() {
2435
OpenTelemetryConfigurationModel model =
25-
new DeclarativeConfigurationBuilder()
26-
.customizeModel(
27-
new OpenTelemetryConfigurationModel()
28-
.withFileFormat("1.0-rc.1")
29-
.withTracerProvider(new TracerProviderModel())
30-
.withInstrumentationDevelopment(
31-
new InstrumentationModel()
32-
.withJava(
33-
new ExperimentalLanguageSpecificInstrumentationModel()
34-
.withAdditionalProperty(
35-
"thread_details", singletonMap("enabled", true)))));
36+
modelWithTracer()
37+
.withInstrumentationDevelopment(
38+
new InstrumentationModel()
39+
.withJava(
40+
new ExperimentalLanguageSpecificInstrumentationModel()
41+
.withAdditionalProperty(
42+
"thread_details", singletonMap("enabled", true))));
3643

3744
try (OpenTelemetrySdk sdk = DeclarativeConfiguration.create(model)) {
38-
assertThat(sdk.toString()).containsOnlyOnce("AddThreadDetailsSpanProcessor");
45+
assertThat(sdk.toString()).containsOnlyOnce(PROCESSOR);
3946
}
4047
}
48+
49+
private static OpenTelemetryConfigurationModel modelWithTracer() {
50+
return new DeclarativeConfigurationBuilder()
51+
.customizeModel(
52+
new OpenTelemetryConfigurationModel()
53+
.withFileFormat("1.0-rc.1")
54+
.withTracerProvider(new TracerProviderModel()));
55+
}
4156
}

0 commit comments

Comments
 (0)