Skip to content

Do not remove client span if incoming request has "uber-trace-id" header #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) {
} catch (Exception ignore) {
log.error("TraceRequestHttpHeadersFilter error", ignore);
}
headersWithInput.addAll(input);
for (Map.Entry<String, List<String>> entry : input.entrySet()) {
headersWithInput.addIfAbsent(entry.getKey(), entry.getValue().get(0));
Copy link
Preview

Copilot AI Mar 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the first value of each header is preserved here, which may drop additional header values that might be required for some cases. Consider a solution that combines all values if preserving the full header list is necessary.

Suggested change
headersWithInput.addIfAbsent(entry.getKey(), entry.getValue().get(0));
headersWithInput.addAll(entry.getKey(), entry.getValue());

Copilot uses AI. Check for mistakes.

}
addHeadersWithInput(builder, headersWithInput);
return headersWithInput;
}
Expand All @@ -86,7 +88,7 @@ private void addHeadersWithInput(ServerHttpRequest.Builder builder,
.entrySet()) {
String key = entry.getKey();
List<String> value = entry.getValue();
headersWithInput.put(key, value);
headersWithInput.putIfAbsent(key, value);
}
}

Expand Down