|
19 | 19 |
|
20 | 20 | class ThreadDetailsConfigurationCustomizerProviderTest { |
21 | 21 |
|
| 22 | + static final String PROCESSOR = "AddThreadDetailsSpanProcessor"; |
| 23 | + |
22 | 24 | @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() { |
24 | 35 | 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)))); |
36 | 43 |
|
37 | 44 | try (OpenTelemetrySdk sdk = DeclarativeConfiguration.create(model)) { |
38 | | - assertThat(sdk.toString()).containsOnlyOnce("AddThreadDetailsSpanProcessor"); |
| 45 | + assertThat(sdk.toString()).containsOnlyOnce(PROCESSOR); |
39 | 46 | } |
40 | 47 | } |
| 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 | + } |
41 | 56 | } |
0 commit comments