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:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user