pub enum Metric {
Counter(Counter),
Gauge(Gauge),
Histogram(Histogram),
Latency(LatencyTracker),
}Expand description
Unified metric type that can hold any metric variant
Variants§
Counter(Counter)
Counter metric variant for monotonically increasing values
Gauge(Gauge)
Gauge metric variant for values that can increase or decrease
Histogram(Histogram)
Histogram metric variant for recording value distributions
Latency(LatencyTracker)
Latency metric variant for timing measurements
Implementations§
Source§impl Metric
impl Metric
Sourcepub const fn metric_type(&self) -> MetricType
pub const fn metric_type(&self) -> MetricType
Get the metric type
Sourcepub const fn name(&self) -> &MetricName
pub const fn name(&self) -> &MetricName
Get the metric name
Sourcepub const fn timestamp_ns(&self) -> u64
pub const fn timestamp_ns(&self) -> u64
Get the timestamp in nanoseconds
Sourcepub const fn value_as_f64(&self) -> f64
pub const fn value_as_f64(&self) -> f64
Get the metric value as f64 (for aggregation)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metric
impl<'de> Deserialize<'de> for Metric
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.