Honour request header tags mapped onto headers - #12695
Open
ValentinZakharov wants to merge 1 commit into
Open
ValentinZakharov wants to merge 1 commit into
ValentinZakharov wants to merge 1 commit into
Conversation
4 of 5 tasks
There was a problem hiding this comment.
This comment has been minimized.
This comment has been minimized.
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
sarahchen6
approved these changes
Sep 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Makes a
DD_TRACE_REQUEST_HEADER_TAGSmapping on a header that the tracer also consumes for another purpose actually produce its tag.Every context interpreter recognises certain headers -
User-Agent, theForwarded/X-Forwarded-*family, and the client-IP headers (X-Real-IP,True-Client-IP,CF-Connecting-IP, the configurableDD_TRACE_CLIENT_IP_HEADER, …) - captures them via thehandled*helpers, and then returns fromaccept()immediately. That early return means the header never reacheshandleTags(), so a header tag mapped onto it is silently dropped.This is the same class of bug that #12662 fixed for
X-Amzn-Trace-Id, generalised to the remaining consumed headers. Instead of removing each early return one by one, this PR applies the header→tag / header→baggage mappings once up front inaccept(), so no later early return can bypass them. The semantic capture of each header (IP, user-agent, forwarding, trace context) is unchanged.The fix is applied to every interpreter that carries this pattern:
DatadogHttpCodec,XRayHttpCodec,W3CHttpCodec,HaystackHttpCodec,B3HttpCodec(both multi and single) andNoneCodec. Each interpreter keeps its existing tag/baggage semantics; the mappings simply run before the switch rather than after it.Motivation
APMS-20654
Additional Notes
Because the mappings now run before the switch, a mapping onto a header that was previously consumed and returned early - including the trace-context headers themselves - is now honoured, consistent with every other header.
X-Amzn-Trace-Idis covered as a side effect, so this supersedes #12662 if merged first.ConsumedHeaderTagMappingTestexercises every consumed header across all seven interpreters and asserts that the mapped tag is produced, the semantic capture is preserved, and the trace context is still extracted. All new tests were confirmed to fail without the codec changes.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]