pub struct HandlerMetricsRegistry { /* private fields */ }Expand description
Global handler metrics registry. Thread-safe, lock-free per-route metrics collection.
Implementations§
Source§impl HandlerMetricsRegistry
impl HandlerMetricsRegistry
pub fn new() -> Self
pub fn request_start(&self, key: &str)
pub fn request_end(&self, key: &str, duration_ns: u64, is_error: bool)
Sourcepub fn percentile_ns(
buckets: &[AtomicU64; 41],
_total_hint: u64,
pct: f64,
) -> u64
pub fn percentile_ns( buckets: &[AtomicU64; 41], _total_hint: u64, pct: f64, ) -> u64
Compute percentile latency (e.g. 0.95 for P95) from histogram buckets.
Sourcepub fn to_prometheus(&self) -> String
pub fn to_prometheus(&self) -> String
Export all route metrics in Prometheus text format.
Sourcepub fn route_count(&self) -> usize
pub fn route_count(&self) -> usize
Get the number of tracked routes.
Sourcepub fn sync_to_observer(&self, collector: &MetricsCollector)
pub fn sync_to_observer(&self, collector: &MetricsCollector)
Sync all route metrics into an observer MetricsCollector. Called periodically by the observer bridge task.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HandlerMetricsRegistry
impl !RefUnwindSafe for HandlerMetricsRegistry
impl Send for HandlerMetricsRegistry
impl Sync for HandlerMetricsRegistry
impl Unpin for HandlerMetricsRegistry
impl UnsafeUnpin for HandlerMetricsRegistry
impl UnwindSafe for HandlerMetricsRegistry
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