pub struct MetricsCore { /* private fields */ }Expand description
Main metrics interface - the core of everything
Implementations§
Source§impl MetricsCore
impl MetricsCore
Sourcepub fn counter(&self, name: &str) -> Arc<Counter>
pub fn counter(&self, name: &str) -> Arc<Counter>
Get or create a counter by name. Requires the count feature.
name is accepted as &str — string literals ("counter") and
owned/borrowed runtime names both work. The first lookup for a given
name allocates a String key inside the registry; subsequent lookups
of the same name reuse the cached Arc and perform no allocations.
Sourcepub fn gauge(&self, name: &str) -> Arc<Gauge>
pub fn gauge(&self, name: &str) -> Arc<Gauge>
Get or create a gauge by name. Requires the gauge feature.
name is accepted as &str — see Self::counter for allocation
semantics.
Sourcepub fn timer(&self, name: &str) -> Arc<Timer>
pub fn timer(&self, name: &str) -> Arc<Timer>
Get or create a timer by name. Requires the timer feature.
name is accepted as &str — see Self::counter for allocation
semantics.
Sourcepub fn time<T>(&self, name: &str, f: impl FnOnce() -> T) -> T
pub fn time<T>(&self, name: &str, f: impl FnOnce() -> T) -> T
Time a synchronous closure and record the elapsed duration.
Requires the timer feature.
Sourcepub fn system(&self) -> &SystemHealth
pub fn system(&self) -> &SystemHealth
Get system health interface
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MetricsCore
impl RefUnwindSafe for MetricsCore
impl Send for MetricsCore
impl Sync for MetricsCore
impl Unpin for MetricsCore
impl UnsafeUnpin for MetricsCore
impl UnwindSafe for MetricsCore
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