Skip to content

Commit 9c676ca

Browse files
committed
add description and owner of the declarative config bridge
1 parent 699c545 commit 9c676ca

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

declarative-config-bridge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ First, there is a configuration method that reads the properties and is unaware
1313
configuration:
1414

1515
```java
16-
public class InferredSpansConfig {
16+
class InferredSpansConfig {
1717
static SpanProcessor create(ConfigProperties properties) {
1818
// read properties here
1919
boolean backupDiagnosticFiles =
@@ -69,7 +69,7 @@ public class InferredSpansComponentProvider implements ComponentProvider<SpanPro
6969

7070
@Override
7171
public SpanProcessor create(DeclarativeConfigProperties config) {
72-
return InferredSpansAutoConfig.create(
72+
return InferredSpansConfig.create(
7373
new DeclarativeConfigPropertiesBridgeBuilder()
7474
// crop the prefix, because the properties are under the "inferred_spans" processor
7575
.addMapping("otel.inferred.spans.", "")

inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/InferredSpansComponentProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public String getName() {
2222

2323
@Override
2424
public SpanProcessor create(DeclarativeConfigProperties config) {
25-
return InferredSpansAutoConfig.create(
25+
return InferredSpansConfig.create(
2626
new DeclarativeConfigPropertiesBridgeBuilder()
2727
// crop the prefix, because the properties are under the "inferred_spans" processor
2828
.addMapping("otel.inferred.spans.", "")

inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/InferredSpansConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
import java.util.stream.Collectors;
1818
import javax.annotation.Nullable;
1919

20-
public class InferredSpansConfig {
20+
class InferredSpansConfig {
21+
22+
private InferredSpansConfig() {}
23+
2124
static final String ENABLED_OPTION = "otel.inferred.spans.enabled";
2225
static final String LOGGING_OPTION = "otel.inferred.spans.logging.enabled";
2326
static final String DIAGNOSTIC_FILES_OPTION = "otel.inferred.spans.backup.diagnostic.files";

inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/InferredSpansAutoConfigTest.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ public void checkAllOptions(@TempDir Path tmpDir) {
5656
String libDir = tmpDir.resolve("foo").resolve("bar").toString();
5757
try (AutoConfigTestProperties props =
5858
new AutoConfigTestProperties()
59-
.put(InferredSpansAutoConfig.ENABLED_OPTION, "true")
60-
.put(InferredSpansAutoConfig.LOGGING_OPTION, "false")
61-
.put(InferredSpansAutoConfig.DIAGNOSTIC_FILES_OPTION, "true")
62-
.put(InferredSpansAutoConfig.SAFEMODE_OPTION, "16")
63-
.put(InferredSpansAutoConfig.POSTPROCESSING_OPTION, "false")
64-
.put(InferredSpansAutoConfig.SAMPLING_INTERVAL_OPTION, "7ms")
65-
.put(InferredSpansAutoConfig.MIN_DURATION_OPTION, "2ms")
66-
.put(InferredSpansAutoConfig.INCLUDED_CLASSES_OPTION, "foo*23,bar.baz")
67-
.put(InferredSpansAutoConfig.EXCLUDED_CLASSES_OPTION, "blub,test*.test2")
68-
.put(InferredSpansAutoConfig.INTERVAL_OPTION, "2s")
69-
.put(InferredSpansAutoConfig.DURATION_OPTION, "3s")
70-
.put(InferredSpansAutoConfig.LIB_DIRECTORY_OPTION, libDir)
59+
.put(InferredSpansConfig.ENABLED_OPTION, "true")
60+
.put(InferredSpansConfig.LOGGING_OPTION, "false")
61+
.put(InferredSpansConfig.DIAGNOSTIC_FILES_OPTION, "true")
62+
.put(InferredSpansConfig.SAFEMODE_OPTION, "16")
63+
.put(InferredSpansConfig.POSTPROCESSING_OPTION, "false")
64+
.put(InferredSpansConfig.SAMPLING_INTERVAL_OPTION, "7ms")
65+
.put(InferredSpansConfig.MIN_DURATION_OPTION, "2ms")
66+
.put(InferredSpansConfig.INCLUDED_CLASSES_OPTION, "foo*23,bar.baz")
67+
.put(InferredSpansConfig.EXCLUDED_CLASSES_OPTION, "blub,test*.test2")
68+
.put(InferredSpansConfig.INTERVAL_OPTION, "2s")
69+
.put(InferredSpansConfig.DURATION_OPTION, "3s")
70+
.put(InferredSpansConfig.LIB_DIRECTORY_OPTION, libDir)
7171
.put(
72-
InferredSpansAutoConfig.PARENT_OVERRIDE_HANDLER_OPTION,
72+
InferredSpansConfig.PARENT_OVERRIDE_HANDLER_OPTION,
7373
NoOpParentOverrideHandler.class.getName())) {
7474

7575
OpenTelemetry otel = GlobalOpenTelemetry.get();
@@ -112,10 +112,10 @@ public void checkDisabledbyDefault() {
112112
public void checkProfilerWorking() {
113113
try (AutoConfigTestProperties props =
114114
new AutoConfigTestProperties()
115-
.put(InferredSpansAutoConfig.ENABLED_OPTION, "true")
116-
.put(InferredSpansAutoConfig.DURATION_OPTION, "500ms")
117-
.put(InferredSpansAutoConfig.INTERVAL_OPTION, "500ms")
118-
.put(InferredSpansAutoConfig.SAMPLING_INTERVAL_OPTION, "5ms")) {
115+
.put(InferredSpansConfig.ENABLED_OPTION, "true")
116+
.put(InferredSpansConfig.DURATION_OPTION, "500ms")
117+
.put(InferredSpansConfig.INTERVAL_OPTION, "500ms")
118+
.put(InferredSpansConfig.SAMPLING_INTERVAL_OPTION, "5ms")) {
119119
OpenTelemetry otel = GlobalOpenTelemetry.get();
120120
List<SpanProcessor> processors = OtelReflectionUtils.getSpanProcessors(otel);
121121
assertThat(processors).filteredOn(proc -> proc instanceof InferredSpansProcessor).hasSize(1);

0 commit comments

Comments
 (0)