Skip to content

Commit

Permalink
Merge pull request #2154 from newrelic/trace-parent-logging
Browse files Browse the repository at this point in the history
Correct multiple traceparent header logging
  • Loading branch information
jtduffy authored Nov 22, 2024
2 parents 661ba38 + ef213ce commit 4431da3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ static W3CTraceParent parseHeaders(List<String> traceParentHeaders) {
return null;
}
if (traceParentHeaders.size() > 1) {
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
String first = traceParentHeaders.get(0);
for (String header : traceParentHeaders) {
if (!header.equals(first)) {
return null;
ServiceFactory.getStatsService().getMetricAggregator().incrementCounter(MetricNames.SUPPORTABILITY_TRACE_CONTEXT_INVALID_PARENT_HEADER_COUNT);
Agent.LOG.log(Level.WARNING, "Multiple, different, traceparent headers found on inbound request.");
return null;
}
}
}
Expand Down

0 comments on commit 4431da3

Please sign in to comment.