pub struct GenAiResponseRecorder;Available on crate feature
telemetry 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)
Available on crate feature genai-semconv only.
pub fn record_response_model(model: &str)
genai-semconv only.Record the response model (may differ from request model).
Sourcepub fn record_finish_reasons(reasons: &[&str])
Available on crate feature genai-semconv only.
pub fn record_finish_reasons(reasons: &[&str])
genai-semconv only.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)
Available on crate feature genai-semconv only.
pub fn record_usage(usage: &LlmUsage)
genai-semconv only.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