Skip to content

Commit 369b020

Browse files
committed
remove getAppliedConfigSetting and its test
1 parent 9547596 commit 369b020

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

internal-api/src/main/java/datadog/trace/api/ConfigCollector.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,4 @@ public Map<ConfigOrigin, Map<String, ConfigSetting>> collect() {
6565
return Collections.emptyMap();
6666
}
6767
}
68-
69-
public static ConfigSetting getAppliedConfigSetting(
70-
String key, Map<ConfigOrigin, Map<String, ConfigSetting>> configMap) {
71-
ConfigSetting best = null;
72-
for (Map<String, ConfigSetting> originConfigMap : configMap.values()) {
73-
ConfigSetting setting = originConfigMap.get(key);
74-
if (setting != null) {
75-
if (best == null || setting.seqId > best.seqId) {
76-
best = setting;
77-
}
78-
}
79-
}
80-
return best;
81-
}
8268
}

internal-api/src/test/groovy/datadog/trace/api/ConfigCollectorTest.groovy

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -274,42 +274,6 @@ class ConfigCollectorTest extends DDSpecification {
274274
jvmSetting.seqId < remoteSetting.seqId
275275
}
276276

277-
def "getAppliedConfigSetting returns highest precedence setting"() {
278-
setup:
279-
ConfigCollector.get().collect() // clear previous state
280-
281-
when:
282-
// Add multiple settings for the same key with different seqIds
283-
ConfigCollector.get().put("test.key", "default-value", ConfigOrigin.DEFAULT, ConfigSetting.DEFAULT_SEQ_ID)
284-
ConfigCollector.get().put("test.key", "env-value", ConfigOrigin.ENV, 2)
285-
ConfigCollector.get().put("test.key", "jvm-value", ConfigOrigin.JVM_PROP, 5)
286-
ConfigCollector.get().put("test.key", "remote-value", ConfigOrigin.REMOTE, 3)
287-
288-
// Add another key with only one setting
289-
ConfigCollector.get().put("single.key", "only-value", ConfigOrigin.ENV, 1)
290-
291-
def collected = ConfigCollector.get().collect()
292-
293-
then:
294-
// Should return the setting with highest seqId (5)
295-
def appliedSetting = ConfigCollector.getAppliedConfigSetting("test.key", collected)
296-
appliedSetting != null
297-
appliedSetting.value == "jvm-value"
298-
appliedSetting.origin == ConfigOrigin.JVM_PROP
299-
appliedSetting.seqId == 5
300-
301-
// Should return the only setting for single.key
302-
def singleSetting = ConfigCollector.getAppliedConfigSetting("single.key", collected)
303-
singleSetting != null
304-
singleSetting.value == "only-value"
305-
singleSetting.origin == ConfigOrigin.ENV
306-
singleSetting.seqId == 1
307-
308-
// Should return null for non-existent key
309-
def nonExistentSetting = ConfigCollector.getAppliedConfigSetting("non.existent.key", collected)
310-
nonExistentSetting == null
311-
}
312-
313277
def "config id is null for non-StableConfigSource"() {
314278
setup:
315279
def key = "test.key"

0 commit comments

Comments
 (0)