fix 2284 issue: ScopeDecorator use CorrelationScopeDecorator.Builder from Spring Context instead of using new operator (#2285)

Co-authored-by: Artem Krikheli <a.m.krikheli@tinkoff.ru>
This commit is contained in:
Artyom Krikheli
2023-05-09 16:33:43 +03:00
committed by GitHub
parent fc5f26a11f
commit a5eaa0ad6f

View File

@@ -198,13 +198,14 @@ class BraveBaggageConfiguration {
@ConditionalOnProperty(value = "spring.sleuth.baggage.correlation-enabled", matchIfMissing = true)
ScopeDecorator correlationScopeDecorator(@Qualifier(WHITELISTED_MDC_KEYS) List<String> whiteListedMDCKeys,
SleuthBaggageProperties sleuthBaggageProperties,
CorrelationScopeDecorator.Builder correlationScopeDecoratorBuilder,
@Nullable List<CorrelationScopeCustomizer> correlationScopeCustomizers) {
Set<String> correlationFields = redirectOldPropertyToNew(WHITELISTED_MDC_KEYS, whiteListedMDCKeys,
"spring.sleuth.baggage.correlation-fields", sleuthBaggageProperties.getCorrelationFields());
// Add fields from properties
CorrelationScopeDecorator.Builder builder = MDCScopeDecorator.newBuilder();
CorrelationScopeDecorator.Builder builder = correlationScopeDecoratorBuilder;
for (String field : correlationFields) {
builder.add(SingleCorrelationField.newBuilder(BaggageField.create(field)).build());
}