pub struct InMemoryMetrics { /* private fields */ }Expand description
In-memory metrics collector.
Collects latency samples, counter increments, and gauge values.
Thread-safe via internal Mutex.
Implementations§
Source§impl InMemoryMetrics
impl InMemoryMetrics
pub fn new() -> Self
Sourcepub fn snapshot(&self) -> MetricsSnapshot
pub fn snapshot(&self) -> MetricsSnapshot
Take a snapshot of all collected metrics.
Trait Implementations§
Source§impl Default for InMemoryMetrics
impl Default for InMemoryMetrics
Source§impl Metrics for InMemoryMetrics
impl Metrics for InMemoryMetrics
Source§fn record_latency(&self, operation: &str, duration_ms: f64)
fn record_latency(&self, operation: &str, duration_ms: f64)
Record a latency measurement for an operation.
Source§fn increment_counter(&self, name: &str, delta: u64)
fn increment_counter(&self, name: &str, delta: u64)
Increment a named counter.
Source§fn record_gauge(&self, name: &str, value: f64)
fn record_gauge(&self, name: &str, value: f64)
Record a gauge (point-in-time) value.
Auto Trait Implementations§
impl !Freeze for InMemoryMetrics
impl RefUnwindSafe for InMemoryMetrics
impl Send for InMemoryMetrics
impl Sync for InMemoryMetrics
impl Unpin for InMemoryMetrics
impl UnsafeUnpin for InMemoryMetrics
impl UnwindSafe for InMemoryMetrics
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