pub struct ModelStats {
pub total_requests: usize,
pub total_errors: usize,
pub total_latency_ms: f64,
pub last_health_check: Option<HealthCheck>,
}Expand description
Statistics for a versioned model
Fields§
§total_requests: usizeTotal requests processed
total_errors: usizeTotal errors encountered
total_latency_ms: f64Sum of latencies (for computing average)
last_health_check: Option<HealthCheck>Last health check
Implementations§
Source§impl ModelStats
impl ModelStats
Sourcepub fn record_success(&mut self, latency_ms: f64)
pub fn record_success(&mut self, latency_ms: f64)
Record a successful request
Sourcepub fn record_error(&mut self, latency_ms: f64)
pub fn record_error(&mut self, latency_ms: f64)
Record an error
Sourcepub fn avg_latency_ms(&self) -> f64
pub fn avg_latency_ms(&self) -> f64
Get average latency
Sourcepub fn error_rate(&self) -> f64
pub fn error_rate(&self) -> f64
Get error rate
Sourcepub fn to_health_check(&self) -> HealthCheck
pub fn to_health_check(&self) -> HealthCheck
Generate health check from current stats
Trait Implementations§
Source§impl Clone for ModelStats
impl Clone for ModelStats
Source§fn clone(&self) -> ModelStats
fn clone(&self) -> ModelStats
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 moreSource§impl Debug for ModelStats
impl Debug for ModelStats
Source§impl Default for ModelStats
impl Default for ModelStats
Source§fn default() -> ModelStats
fn default() -> ModelStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModelStats
impl RefUnwindSafe for ModelStats
impl Send for ModelStats
impl Sync for ModelStats
impl Unpin for ModelStats
impl UnwindSafe for ModelStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more