Expand description
Stream wrapper that records token usage on the active tracing span.
Wraps any LlmResponseStream and intercepts responses carrying UsageMetadata,
recording standardized gen_ai.usage.* fields via adk_telemetry::record_llm_usage.
This is applied once per provider in generate_content, so every model gets
consistent telemetry without duplicating recording logic.
Functionsยง
- with_
usage_ tracking - Wrap an
LlmResponseStreamso that the lastUsageMetadataseen is recorded on the provided tracing span when the stream yields it.