Skip to content

Commit

Permalink
Correct multiple traceparent header logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jtduffy committed Nov 22, 2024
1 parent 3b7d7d4 commit ef213ce
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 ef213ce

Please sign in to comment.