Skip to content

Commit b411ea9

Browse files
committed
remove dependency on collectConfig for reReportToCollector and reReportFinalResult
1 parent bfcfd7e commit b411ea9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public String getStringNotEmpty(String key, String defaultValue, String... alias
140140
}
141141

142142
// Re-report the chosen value with the highest seqId
143-
if (resolver != null) {
144-
resolver.reReportToCollector(key, collectConfig, seqId + 1);
143+
if (resolver != null && collectConfig) {
144+
resolver.reReportToCollector(key, seqId + 1);
145145
}
146146

147147
return resolver != null ? resolver.value : defaultValue;
@@ -278,8 +278,8 @@ private <T> T get(String key, T defaultValue, Class<T> type, String... aliases)
278278
}
279279

280280
// Re-report the chosen value and origin to ensure its seqId is higher than any error configs
281-
if (resolver != null) {
282-
resolver.reReportToCollector(key, collectConfig, seqId + 1);
281+
if (resolver != null && collectConfig) {
282+
resolver.reReportToCollector(key, seqId + 1);
283283
}
284284

285285
return resolver != null ? resolver.value : defaultValue;
@@ -345,7 +345,7 @@ public Map<String, String> getMergedMap(String key, String... aliases) {
345345

346346
if (collectConfig) {
347347
reportDefault(key, Collections.emptyMap());
348-
mergeResolver.reReportFinalResult(key, collectConfig, seqId);
348+
mergeResolver.reReportFinalResult(key, seqId);
349349
}
350350

351351
return mergeResolver.getMergedValue();
@@ -376,7 +376,7 @@ public Map<String, String> getMergedTagsMap(String key, String... aliases) {
376376

377377
if (collectConfig) {
378378
reportDefault(key, Collections.emptyMap());
379-
mergeResolver.reReportFinalResult(key, collectConfig, seqId);
379+
mergeResolver.reReportFinalResult(key, seqId);
380380
}
381381

382382
return mergeResolver.getMergedValue();
@@ -407,7 +407,7 @@ public Map<String, String> getOrderedMap(String key) {
407407

408408
if (collectConfig) {
409409
reportDefault(key, Collections.emptyMap());
410-
mergeResolver.reReportFinalResult(key, collectConfig, seqId);
410+
mergeResolver.reReportFinalResult(key, seqId);
411411
}
412412

413413
return mergeResolver.getMergedValue();
@@ -440,7 +440,7 @@ public Map<String, String> getMergedMapWithOptionalMappings(
440440

441441
if (collectConfig) {
442442
reportDefault(key, Collections.emptyMap());
443-
mergeResolver.reReportFinalResult(key, collectConfig, seqId);
443+
mergeResolver.reReportFinalResult(key, seqId);
444444
}
445445
}
446446

@@ -652,8 +652,8 @@ static <T> ConfigValueResolver<T> of(T value, ConfigOrigin origin, int seqId, St
652652
}
653653

654654
/** Re-reports this resolved value to ConfigCollector with the specified seqId */
655-
void reReportToCollector(String key, boolean collectConfig, int finalSeqId) {
656-
if (collectConfig && value != null && origin != null) {
655+
void reReportToCollector(String key, int finalSeqId) {
656+
if (value != null && origin != null) {
657657
ConfigCollector.get().put(key, value, origin, finalSeqId, configId);
658658
}
659659
}
@@ -686,8 +686,8 @@ void addContribution(Map<String, String> contribution, ConfigOrigin sourceOrigin
686686
* Re-reports the final merged result to ConfigCollector if it has actual contributions. Does
687687
* NOT re-report when no contributions were made since defaults are reported separately.
688688
*/
689-
void reReportFinalResult(String key, boolean collectConfig, int finalSeqId) {
690-
if (collectConfig && currentOrigin != ConfigOrigin.DEFAULT && !mergedValue.isEmpty()) {
689+
void reReportFinalResult(String key, int finalSeqId) {
690+
if (currentOrigin != ConfigOrigin.DEFAULT && !mergedValue.isEmpty()) {
691691
ConfigCollector.get().put(key, mergedValue, ConfigOrigin.CALCULATED, finalSeqId);
692692
}
693693
}

0 commit comments

Comments
 (0)