Skip to content

feat(request-trace): add x_request_id and model to every request_end row - #18103

Draft
ryanolson wants to merge 1 commit into
ai-dynamo:mainfrom
ryanolson:rolson/trace-request-end-x-request-id
Draft

ryanolson wants to merge 1 commit into
ai-dynamo:mainfrom
ryanolson:rolson/trace-request-end-x-request-id

Conversation

@ryanolson

@ryanolson ryanolson commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Overview

The frontend mints its own request_id (#17032), and that is the key trace consumers should use to tie a request's rows together inside Dynamo. Two things were still missing on request_end for a plain request (one with no agent context):

  • model. A consumer that keeps separate state per model, such as one that follows KV block reuse per model, needs it to route the row to the right state without first looking up the request.
  • x_request_id. It is not a key inside Dynamo. It is the client's own id, from the x-request-id header, for joining a trace row to records kept outside Dynamo, such as a load generator's results or the client's logs.

Both were written only when the request had agent context. With this change every request_end row carries model, and x_request_id when the client sent the header.

Key Changes

About 25 lines of core logic, plus a test and a docs paragraph.

  • lib/llm/src/request_trace/agent_context.rs: one helper, x_request_id_from_context, reads x-request-id from the distributed tracing context, else from the request context. The agent path and the plain path both use it, so they cannot disagree.
  • lib/llm/src/request_trace/integration.rs and lib/llm/src/request_trace/record.rs: the request-end state keeps model and x_request_id, and emit_request_end writes them on the plain path.
  • docs/fern/pages/reference/observability/request-traces.mdx: says that every row carries model, and x_request_id when the header is sent.

Validation

Case Before After
Plain request with an x-request-id header request_end has no x_request_id, no model both present
Request with agent context both present unchanged
Request with no x-request-id header field absent field absent

Test added: plain_request_end_carries_x_request_id_and_model in request_trace/integration.rs. It fails without the change.

cargo test --locked -p dynamo-llm --lib passes: 4,001 passed, 0 failed.

No new environment variables. The fields appear when request tracing is on (DYN_REQUEST_TRACE).

Issues and Ongoing Work

Pull Request Checklist
  • I used Dynamo's /pr-checklist skill.

A request_end row carried the client's x-request-id and the model only
when the request had agent context. The frontend now assigns its own
request_id, so a plain request had no key a client could join on.

Read x-request-id once, through one helper, for the agent path and the
plain path, and record the model on both.

Signed-off-by: Ryan Olson <rolson@nvidia.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added feat external-contribution Pull request is from an external contributor labels Nov 4, 2026
@dynamo-ops

Copy link
Copy Markdown
Contributor

/ok to test 967a494

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 4, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

✅ Dynamo PR CI passed — run 41897439797 (attempt 1) on 967a494dc0

Gate checks: ✅ backend-status-check · ✅ deploy-status-check · ✅ dynamo-status-check

Posted automatically by Devin for run 41897439797. Updated on every full-CI run of this PR.

This branch was previously deployed

1 inactive deployment
external_collaborator — 967a494d Deployed Nov 4, 2026 by ryanolson via ok-to-test #45669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation external-contribution Pull request is from an external contributor feat size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants