Skip to content

[codex] fix(gemini): record tool use prompt token telemetry#1799

Merged
gold-silver-copper merged 1 commit into
0xPlaygrounds:mainfrom
gold-silver-copper:codex/tool-use-prompt-token-telemetry
May 22, 2026
Merged

[codex] fix(gemini): record tool use prompt token telemetry#1799
gold-silver-copper merged 1 commit into
0xPlaygrounds:mainfrom
gold-silver-copper:codex/tool-use-prompt-token-telemetry

Conversation

@gold-silver-copper
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1790.

  • Records normalized Usage.tool_use_prompt_tokens as gen_ai.usage.tool_use_prompt_tokens in the shared telemetry span recorder.
  • Declares the field on Gemini completion/streaming spans so the shared recorder can emit it for Gemini usage metadata.
  • Records the aggregated tool-use prompt token count on agent prompt and streaming spans.
  • Adds a focused telemetry unit test that verifies the shared recorder emits the new span field.

Why

#1790 exposed Gemini toolUsePromptTokenCount through normalized usage, but telemetry spans still only recorded input, output, cache, and reasoning token counts. That meant span-based analytics consumers could miss the newly normalized token count.

Validation

  • cargo fmt --check
  • cargo test -p rig-core telemetry::tests::record_token_usage_records_tool_use_prompt_tokens
  • cargo test -p rig-core gemini
  • cargo clippy -p rig-core --all-targets --all-features
  • cargo test -p rig-core
  • git diff --check

@gold-silver-copper gold-silver-copper marked this pull request as ready for review May 22, 2026 01:11
@gold-silver-copper gold-silver-copper added this pull request to the merge queue May 22, 2026
Merged via the queue into 0xPlaygrounds:main with commit cb04ba4 May 22, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request May 21, 2026
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.

1 participant