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); }