From c5ff8506238ac8bbbdedeeaaf9688fa69db9ccb2 Mon Sep 17 00:00:00 2001 From: Kate Anderson Date: Tue, 5 Mar 2024 15:08:55 -0800 Subject: [PATCH] Remove redundant loop flag --- .../com/newrelic/agent/tracing/W3CTraceParentParser.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/newrelic-agent/src/main/java/com/newrelic/agent/tracing/W3CTraceParentParser.java b/newrelic-agent/src/main/java/com/newrelic/agent/tracing/W3CTraceParentParser.java index 9c7c4e0e08..9d47cd0da4 100644 --- a/newrelic-agent/src/main/java/com/newrelic/agent/tracing/W3CTraceParentParser.java +++ b/newrelic-agent/src/main/java/com/newrelic/agent/tracing/W3CTraceParentParser.java @@ -24,17 +24,12 @@ static W3CTraceParent parseHeaders(List traceParentHeaders) { ServiceFactory.getStatsService().getMetricAggregator().incrementCounter(MetricNames.SUPPORTABILITY_TRACE_CONTEXT_INVALID_PARENT_HEADER_COUNT); Agent.LOG.log(Level.WARNING, "Multiple traceparent headers found on inbound request."); // Multiple values ok if all are equal - boolean allHeadersEqual = true; String first = traceParentHeaders.get(0); for (String header : traceParentHeaders) { if (!header.equals(first)) { - allHeadersEqual = false; - break; + return null; } } - if (!allHeadersEqual) { - return null; - } } String traceParentHeader = traceParentHeaders.get(0); return parseHeader(traceParentHeader);