-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Incorrect mapping in telemetry usage attributes. The gen_ai.usage.output_tokens was
incorrectly mapped to llm_response.usage_metadata.total_token_count instead of
llm_response.usage_metadata.candidates_token_count, leading to wrong output token counts in
Langfuse integration.
To Reproduce
Steps to reproduce the behavior:
- Install ADK with Langfuse integration
- Run ADK agents with any LLM model
- Open Langfuse dashboard
- Check usage details - observe incorrect output token counts
Expected behavior
gen_ai.usage.output_tokens should correctly map to candidates_token_count for accurate
output token tracking in Langfuse.
Screenshots

shows incorrect output token counts in Langfuse usage details due to wrong
attribute mapping.
Desktop (please complete the following information):
- OS: Linux Ubuntu 22.04
- Python version: 3.12.3
- ADK version: 1.7.0
Model Information:
Affects all models integrated with Langfuse
Additional context
Can be fixed by changing the mapping from llm_response.usage_metadata.total_token_count to
llm_response.usage_metadata.candidates_token_count for the gen_ai.usage.output_tokens
attribute in telemetry.py