pub struct SessionMetrics { /* private fields */ }Expand description
Accumulated metrics for an agent session, updated internally by the runtime.
All counters are monotonic across all turns. Clone is cheap — the struct
wraps Arcs so snapshots share the same underlying counters.
Implementations§
Source§impl SessionMetrics
impl SessionMetrics
Sourcepub fn total_input_tokens(&self) -> usize
pub fn total_input_tokens(&self) -> usize
Total input tokens consumed across all turns.
Sourcepub fn total_output_tokens(&self) -> usize
pub fn total_output_tokens(&self) -> usize
Total output tokens produced across all turns.
Sourcepub fn total_prompt_cache_hit_tokens(&self) -> usize
pub fn total_prompt_cache_hit_tokens(&self) -> usize
Total prompt tokens served from cache across all turns.
Sourcepub fn total_prompt_cache_miss_tokens(&self) -> usize
pub fn total_prompt_cache_miss_tokens(&self) -> usize
Total prompt tokens not served from cache across all turns.
Sourcepub fn total_tool_calls(&self) -> usize
pub fn total_tool_calls(&self) -> usize
Total number of tool calls executed.
Sourcepub fn total_tool_errors(&self) -> usize
pub fn total_tool_errors(&self) -> usize
Total number of tool calls that resulted in errors.
Sourcepub fn total_iterations(&self) -> usize
pub fn total_iterations(&self) -> usize
Total number of model ⇄ tool iterations across all turns.
Sourcepub fn compaction_count(&self) -> usize
pub fn compaction_count(&self) -> usize
Number of times compaction was triggered.
Sourcepub fn turn_count(&self) -> usize
pub fn turn_count(&self) -> usize
Number of turns completed.
Sourcepub fn retry_count(&self) -> usize
pub fn retry_count(&self) -> usize
Number of provider retries across all turns.
Trait Implementations§
Source§impl Clone for SessionMetrics
impl Clone for SessionMetrics
Source§fn clone(&self) -> SessionMetrics
fn clone(&self) -> SessionMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionMetrics
impl RefUnwindSafe for SessionMetrics
impl Send for SessionMetrics
impl Sync for SessionMetrics
impl Unpin for SessionMetrics
impl UnsafeUnpin for SessionMetrics
impl UnwindSafe for SessionMetrics
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