pub struct GenAiResponseRecorder;Available on crate features
telemetry and genai-semconv only.Expand description
Records response-time attributes on the current span.
Call after receiving the model response to populate response model, finish reasons, and token usage.
§Example
use adk_telemetry::semconv::GenAiResponseRecorder;
use adk_telemetry::LlmUsage;
// After receiving model response:
GenAiResponseRecorder::record_response_model("gemini-2.5-flash-001");
GenAiResponseRecorder::record_finish_reasons(&["stop"]);
GenAiResponseRecorder::record_usage(&LlmUsage {
input_tokens: 100,
output_tokens: 50,
total_tokens: 150,
..Default::default()
});Implementations§
Source§impl GenAiResponseRecorder
impl GenAiResponseRecorder
Sourcepub fn record_response_model(model: &str)
pub fn record_response_model(model: &str)
Record the response model (may differ from request model).
Sourcepub fn record_finish_reasons(reasons: &[&str])
pub fn record_finish_reasons(reasons: &[&str])
Record finish reasons as a comma-separated string.
OTel semconv specifies this as a string array; tracing encodes as CSV.
Sourcepub fn record_usage(usage: &LlmUsage)
pub fn record_usage(usage: &LlmUsage)
Record token usage (delegates to existing record_llm_usage).
Auto Trait Implementations§
impl Freeze for GenAiResponseRecorder
impl RefUnwindSafe for GenAiResponseRecorder
impl Send for GenAiResponseRecorder
impl Sync for GenAiResponseRecorder
impl Unpin for GenAiResponseRecorder
impl UnsafeUnpin for GenAiResponseRecorder
impl UnwindSafe for GenAiResponseRecorder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more