Skip to content

Commit f20ead5

Browse files
committed
pr feedback
1 parent 7b1cf1a commit f20ead5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ default List<String> getList(String name) {
126126
DeclarativeConfigProperties getDeclarativeConfig(String node);
127127

128128
/**
129-
* Returns the {@link ConfigProvider} if declarative configuration is available,
129+
* Returns the {@link ConfigProvider} if declarative configuration is used.
130130
*
131131
* @return the {@link ConfigProvider} or {@code null} if no provider is available
132132
*/

javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/internal/DeclarativeConfigPropertiesBridge.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.HashMap;
1515
import java.util.List;
1616
import java.util.Map;
17+
import java.util.Objects;
1718
import java.util.function.BiFunction;
1819
import javax.annotation.Nullable;
1920

@@ -53,17 +54,17 @@ final class DeclarativeConfigPropertiesBridge implements ConfigProperties {
5354

5455
private static final String OTEL_INSTRUMENTATION_PREFIX = "otel.instrumentation.";
5556

56-
@Nullable private final DeclarativeConfigProperties baseNode;
57+
private final DeclarativeConfigProperties baseNode;
5758

5859
// lookup order matters - we choose the first match
5960
private final Map<String, String> mappings;
6061
private final Map<String, Object> overrideValues;
6162

6263
DeclarativeConfigPropertiesBridge(
63-
@Nullable DeclarativeConfigProperties baseNode,
64+
DeclarativeConfigProperties baseNode,
6465
Map<String, String> mappings,
6566
Map<String, Object> overrideValues) {
66-
this.baseNode = baseNode;
67+
this.baseNode = Objects.requireNonNull(baseNode);
6768
this.mappings = mappings;
6869
this.overrideValues = overrideValues;
6970
}
@@ -154,10 +155,6 @@ private <T> T getPropertyValue(
154155
return override;
155156
}
156157

157-
if (baseNode == null) {
158-
return null;
159-
}
160-
161158
String[] segments = getSegments(translateProperty(property));
162159
if (segments.length == 0) {
163160
return null;

0 commit comments

Comments
 (0)