fix: inherit request IDs in child spans + preserve span in InflightGuard [DIS-1643] - #7928
Closed
nnshah1 wants to merge 1 commit into
Closed
fix: inherit request IDs in child spans + preserve span in InflightGuard [DIS-1643]#7928nnshah1 wants to merge 1 commit into
nnshah1 wants to merge 1 commit into
Conversation
…n InflightGuard Two fixes for request ID propagation: 1. DistributedTraceIdLayer now inherits x_request_id and request_id from parent spans when the child doesn't set them. This ensures inject_trace_headers_into_map includes x-request-id in transport headers even when called from child spans. 2. InflightGuard captures the current span at creation and enters it in Drop. This preserves span context (trace_id, x_request_id, etc.) on the "request completed" log even when the guard outlives the span (e.g. streaming responses where the guard drops after client disconnect). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Moving these fixes into the test PR #7817 to keep everything together. |
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.
Summary
Two fixes for request ID propagation:
DistributedTraceIdLayer: Inherit
x_request_idandrequest_idfrom parent span context when the child span doesn't set them. Without this,inject_trace_headers_into_map(called from child spans likecompletions_single) couldn't includex-request-idin transport headers, so workers never received it.InflightGuard: Capture
Span::current()at creation andenter()it inDrop. For streaming responses, thehttp-requestspan closes when response headers are sent, butInflightGuarddrops later when the stream ends. Without the stored span, the "request completed" log lost all span context (trace_id, x_request_id, model, etc.).Test plan
cargo clippy --workspace -- -D warningscleancargo test --workspacepasses (pre-existing preprocessor flake only)x_request_idnow appears in worker JSONL logs🤖 Generated with Claude Code