Skip to content

feat(tracing): capture protocol response IDs for model calls - #1237

Merged
yaozheng-fang merged 2 commits into
mainfrom
feat/protocol-response-id
Nov 27, 2026
Merged

yaozheng-fang merged 2 commits into
mainfrom
feat/protocol-response-id

Conversation

@wujiaming-ai

Copy link
Copy Markdown
Collaborator

Record the provider-returned response ID for the three wire formats VeADK consumes:

  • Responses API: top-level id, or response.id on created/in_progress/ terminal events
  • Chat Completions: id on the completion and on every stream chunk
  • Messages: top-level message id, or message.id on message_start (the raw value LiteLLM would otherwise replace with a synthesized chatcmpl- id)

The ID is published as a new veadk.response.id span attribute on the attempt span and the enclosing ADK model span, plus one new [llm-dispatch] log line per attempt. Existing gen_ai.response.id / X-Request-Id handling and all existing log lines are untouched.

Extraction treats blank or non-string IDs, missing fields and empty response/message objects as absent, and isolates extraction/span/log failures so telemetry cannot fail a model call. Logged IDs are sanitized to one bounded line; spans keep the raw value.

Coverage: 100% of changed executable lines and all new branches. Opt-in live E2E covers Ark and DeepSeek for all three formats in streaming and non-streaming modes.

Record the provider-returned response ID for the three wire formats VeADK
consumes:

- Responses API: top-level id, or response.id on created/in_progress/
  terminal events
- Chat Completions: id on the completion and on every stream chunk
- Messages: top-level message id, or message.id on message_start (the raw
  value LiteLLM would otherwise replace with a synthesized chatcmpl- id)

The ID is published as a new veadk.response.id span attribute on the attempt
span and the enclosing ADK model span, plus one new [llm-dispatch] log line
per attempt. Existing gen_ai.response.id / X-Request-Id handling and all
existing log lines are untouched.

Extraction treats blank or non-string IDs, missing fields and empty
response/message objects as absent, and isolates extraction/span/log
failures so telemetry cannot fail a model call. Logged IDs are sanitized to
one bounded line; spans keep the raw value.

Coverage: 100% of changed executable lines and all new branches. Opt-in live
E2E covers Ark and DeepSeek for all three formats in streaming and
non-streaming modes.
CodeQL py/incomplete-url-substring-sanitization flagged the mock network
guard: startswith("https://mock.local") accepts lookalike hosts such as
mock.local.evil.com. Compare the parsed scheme and host, and cover the
rejected shapes with a regression test.
@yaozheng-fang
yaozheng-fang merged commit 8d1afbc into main Nov 27, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants