Skip to content

Commit aac0226

Browse files
authored
make matches key under Selectors optional (#8898)
1 parent 631e296 commit aac0226

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/stableconfig/Selector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public Selector(Object yaml) {
2121
Map map = (Map) yaml;
2222
origin = (String) map.get("origin");
2323
key = (String) map.get("key");
24-
matches = Collections.unmodifiableList((List<String>) map.get("matches"));
24+
List<String> rawMatches = (List<String>) map.get("matches");
25+
matches =
26+
rawMatches != null ? Collections.unmodifiableList(rawMatches) : Collections.emptyList();
2527
operator = (String) map.get("operator");
2628
}
2729

internal-api/src/test/groovy/datadog/trace/bootstrap/config/provider/StableConfigParserTest.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ apm_configuration_rules:
4242
matches: ["mysvc"]
4343
configuration:
4444
KEY_FOUR: "ignored"
45+
- selectors:
46+
- origin: process_arguments
47+
key: "-Darg1"
48+
operator: exists
49+
configuration:
50+
KEY_FIVE: "ignored"
4551
"""
4652
Files.write(filePath, yaml.getBytes())
4753
StableConfigSource.StableConfig cfg = StableConfigParser.parse(filePath.toString())

0 commit comments

Comments
 (0)