pub struct Metric {
pub name: String,
pub metric_type: MetricType,
pub value: MetricValue,
pub unit: String,
pub description: String,
pub last_updated: Instant,
pub update_count: u64,
}Expand description
Individual metric with metadata
Fields§
§name: StringMetric name identifier
metric_type: MetricTypeType of metric
value: MetricValueCurrent value
unit: StringUnit of measurement
description: StringDescription of what this metric measures
last_updated: InstantWhen this metric was last updated
update_count: u64Number of times this metric was updated
Implementations§
Source§impl Metric
impl Metric
Sourcepub fn new_counter(name: &str, description: &str) -> Self
pub fn new_counter(name: &str, description: &str) -> Self
Create new counter metric
Sourcepub fn new_histogram(name: &str, description: &str) -> Self
pub fn new_histogram(name: &str, description: &str) -> Self
Create new histogram metric
Sourcepub fn value_string(&self) -> String
pub fn value_string(&self) -> String
Get current metric value as string
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Metric
impl RefUnwindSafe for Metric
impl Send for Metric
impl Sync for Metric
impl Unpin for Metric
impl UnwindSafe for Metric
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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