pub struct MetricsCollector { /* private fields */ }Expand description
High-performance metrics collection system
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
Sourcepub fn with_sample_rate(sample_rate: f64) -> Self
pub fn with_sample_rate(sample_rate: f64) -> Self
Create collector with custom sample rate
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable metrics collection
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if metrics collection is enabled
Sourcepub fn increment_counter(&mut self, name: &str, value: u64)
pub fn increment_counter(&mut self, name: &str, value: u64)
Increment a counter metric
Sourcepub fn record_histogram(&mut self, name: &str, value: f64)
pub fn record_histogram(&mut self, name: &str, value: f64)
Record histogram observation
Sourcepub fn record_timer(&mut self, name: &str, duration: Duration)
pub fn record_timer(&mut self, name: &str, duration: Duration)
Record timer measurement
Sourcepub fn record_rate_event(&mut self, name: &str)
pub fn record_rate_event(&mut self, name: &str)
Record rate event
Sourcepub fn get_metric(&self, name: &str) -> Option<&Metric>
pub fn get_metric(&self, name: &str) -> Option<&Metric>
Get current value of a metric
Sourcepub fn get_all_metrics(&self) -> &HashMap<String, Metric>
pub fn get_all_metrics(&self) -> &HashMap<String, Metric>
Get all metrics
Sourcepub fn get_summary(&self) -> MetricsSummary
pub fn get_summary(&self) -> MetricsSummary
Get metrics summary
Sourcepub fn clear_metrics(&mut self)
pub fn clear_metrics(&mut self)
Clear all metrics
Sourcepub fn cleanup_old_metrics(&mut self, max_age: Duration)
pub fn cleanup_old_metrics(&mut self, max_age: Duration)
Clean up old metrics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MetricsCollector
impl RefUnwindSafe for MetricsCollector
impl Send for MetricsCollector
impl Sync for MetricsCollector
impl Unpin for MetricsCollector
impl UnwindSafe for MetricsCollector
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> 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