pub struct RoutingStats { /* private fields */ }Expand description
In-memory routing statistics, shared between EngineApi and AgentRuntime.
Uses simple RwLock for thread-safe reads/writes.
Implementations§
Source§impl RoutingStats
impl RoutingStats
Sourcepub fn record_model_usage(&self, model_id: &str, cost_usd: f64)
pub fn record_model_usage(&self, model_id: &str, cost_usd: f64)
Record one model invocation.
Sourcepub fn record_fallback(&self, event: FallbackEvent)
pub fn record_fallback(&self, event: FallbackEvent)
Record a fallback event.
Sourcepub fn snapshot(&self) -> RoutingStatsSnapshot
pub fn snapshot(&self) -> RoutingStatsSnapshot
Get a snapshot of current stats.
Sourcepub fn fallback_history(&self, limit: usize) -> Vec<FallbackEvent>
pub fn fallback_history(&self, limit: usize) -> Vec<FallbackEvent>
Get recent fallback events, newest first.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RoutingStats
impl !RefUnwindSafe for RoutingStats
impl Send for RoutingStats
impl Sync for RoutingStats
impl Unpin for RoutingStats
impl UnsafeUnpin for RoutingStats
impl UnwindSafe for RoutingStats
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