pub struct MetricsCollector { /* private fields */ }Expand description
Prometheus-compatible metrics collector
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
Sourcepub fn record_request(&self, tool: &str, latency: Duration, success: bool)
pub fn record_request(&self, tool: &str, latency: Duration, success: bool)
Record a request with latency and success status
Sourcepub fn get_request_count(&self, tool: &str) -> u64
pub fn get_request_count(&self, tool: &str) -> u64
Get total request count for a tool
Sourcepub fn get_error_count(&self, tool: &str) -> u64
pub fn get_error_count(&self, tool: &str) -> u64
Get total error count for a tool
Sourcepub fn get_avg_latency_micros(&self, tool: &str) -> Option<f64>
pub fn get_avg_latency_micros(&self, tool: &str) -> Option<f64>
Get average latency for a tool in microseconds
Sourcepub fn get_error_rate(&self, tool: &str) -> f64
pub fn get_error_rate(&self, tool: &str) -> f64
Get error rate (0.0 to 1.0) for a tool
Sourcepub fn uptime_seconds(&self) -> u64
pub fn uptime_seconds(&self) -> u64
Get uptime in seconds
Sourcepub fn export_prometheus(&self) -> String
pub fn export_prometheus(&self) -> String
Export metrics in Prometheus text format
Sourcepub fn export_json(&self) -> Value
pub fn export_json(&self) -> Value
Get metrics summary as JSON
Trait Implementations§
Source§impl Clone for MetricsCollector
impl Clone for MetricsCollector
Source§fn clone(&self) -> MetricsCollector
fn clone(&self) -> MetricsCollector
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 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