pub fn with_usage_tracking(
stream: LlmResponseStream,
span: Span,
) -> LlmResponseStreamExpand description
Wrap an LlmResponseStream so that the last UsageMetadata seen is recorded
on the provided tracing span when the stream yields it.
The span is entered briefly for each item that carries usage metadata,
ensuring adk_telemetry::record_llm_usage writes to the correct span
regardless of which span is current when the stream is polled.
For non-streaming (single-response) calls the usage is recorded immediately.
For streaming calls the usage typically arrives on the final chunk, so every
chunk with usage_metadata overwrites the span fields (last write wins).