Skip to content

Commit f84d534

Browse files
committed
pr review
1 parent 385ea43 commit f84d534

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,21 @@ public static AutoConfiguredOpenTelemetrySdk installOpenTelemetrySdk(
3939
setForceFlush(sdk);
4040

4141
if (configProvider != null) {
42+
// We create a new instance of AutoConfiguredOpenTelemetrySdk, which has a ConfigProperties
43+
// instance that can be used to read properties from the configuration file.
44+
// This allows most instrumentations to be unaware of which configuration style is used.
4245
return SdkAutoconfigureAccess.create(
4346
sdk,
47+
// the Resource from the original instance is also the default Resource,
48+
// so this is functionally equivalent
4449
Resource.getDefault(),
4550
ConfigPropertiesFactory.builder()
4651
.addTranslation(
4752
"otel.instrumentation.common.default-enabled", "common.default.enabled")
4853
.addTranslation("otel.javaagent", "agent")
4954
// these properties are used to initialize the SDK before the configuration file
50-
// is loaded
51-
// for consistency, we pass them to the bridge, so that they can be read later
52-
// with the same
53-
// value from the {@link DeclarativeConfigPropertiesBridge}
55+
// is loaded for consistency, we pass them to the bridge, so that they can be read
56+
// later with the same value from the {@link DeclarativeConfigPropertiesBridge}
5457
.addFixedValue(
5558
"otel.javaagent.debug", earlyConfig.getBoolean("otel.javaagent.debug", false))
5659
.addFixedValue(

javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public Map<String, String> getMap(String name, Map<String, String> defaultValue)
115115
@Override
116116
public DeclarativeConfigProperties getDeclarativeConfig(String node) {
117117
if (configProvider == null) {
118-
// declarative config is not supported at all
118+
// declarative config is not used
119119
return null;
120120
}
121121

javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
import io.opentelemetry.api.OpenTelemetry;
1212
import io.opentelemetry.javaagent.tooling.config.EarlyInitAgentConfig;
1313
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
14+
import org.junit.jupiter.api.AfterEach;
1415
import org.junit.jupiter.api.BeforeEach;
1516
import org.junit.jupiter.api.Test;
1617

1718
class OpenTelemetryInstallerTest {
1819

1920
@BeforeEach
21+
@AfterEach
2022
void setUp() {
2123
GlobalOpenTelemetry.resetForTest();
2224
}

javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.IOException;
1919
import java.nio.file.Files;
2020
import java.nio.file.Path;
21+
import org.junit.jupiter.api.AfterEach;
2122
import org.junit.jupiter.api.BeforeEach;
2223
import org.junit.jupiter.api.Test;
2324
import org.junit.jupiter.api.io.TempDir;
@@ -28,6 +29,7 @@
2829
class ConfigurationPropertiesSupplierTest {
2930

3031
@BeforeEach
32+
@AfterEach
3133
void setUp() {
3234
GlobalOpenTelemetry.resetForTest();
3335
ConfigurationFile.resetForTest();

javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/OtlpProtocolPropertiesSupplierTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
import io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller;
1212
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
1313
import io.opentelemetry.sdk.autoconfigure.internal.AutoConfigureUtil;
14+
import org.junit.jupiter.api.AfterEach;
1415
import org.junit.jupiter.api.BeforeEach;
1516
import org.junit.jupiter.api.Test;
1617
import org.junitpioneer.jupiter.SetSystemProperty;
1718

1819
class OtlpProtocolPropertiesSupplierTest {
1920

2021
@BeforeEach
22+
@AfterEach
2123
void setUp() {
2224
GlobalOpenTelemetry.resetForTest();
2325
}

0 commit comments

Comments
 (0)