From c86a2af78c87bab225a30dab0b765930324d929b Mon Sep 17 00:00:00 2001 From: Sergei Malafeev Date: Fri, 29 May 2020 06:08:31 +0800 Subject: [PATCH] #425 allow only one propagator per concern (#451) --- .../opentelemetry/auto/tooling/PropagatorsInitializer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/PropagatorsInitializer.java b/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/PropagatorsInitializer.java index a04ebe304760..d37c7309b608 100644 --- a/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/PropagatorsInitializer.java +++ b/agent-tooling/src/main/java/io/opentelemetry/auto/tooling/PropagatorsInitializer.java @@ -44,11 +44,18 @@ public static void initializePropagators(List propagators) { DefaultContextPropagators.Builder propagatorsBuilder = DefaultContextPropagators.builder(); + boolean addedPropagator = false; for (String propagatorId : propagators) { HttpTextFormat textPropagator = TEXTMAP_PROPAGATORS.get(propagatorId.trim().toLowerCase()); if (textPropagator != null) { + if (addedPropagator) { + log.warn( + "Only one propagator per concern can be added, " + textPropagator + " is ignored"); + continue; + } propagatorsBuilder.addHttpTextFormat(textPropagator); log.info("Added " + textPropagator + " propagator"); + addedPropagator = true; } else { log.warn("No matching propagator for " + propagatorId); }