pub enum Unit {
None,
Seconds,
Milliseconds,
Microseconds,
Nanoseconds,
Bytes,
Kilobytes,
Megabytes,
Gigabytes,
Percent,
Ratio,
Custom(&'static str),
}Expand description
Unit of measurement for a metric value.
Exporters use the unit for two things:
- Emit OpenMetrics
# UNITlines and Prometheus name suffixes (_seconds,_bytes,_total, …). - Normalise values where appropriate (e.g., Timer values exported in seconds rather than nanoseconds).
Unit::Custom carries a free-form static string for units not enumerated
here.
Variants§
None
No unit / dimensionless quantity.
Seconds
SI seconds.
Milliseconds
SI milliseconds.
Microseconds
SI microseconds.
Nanoseconds
SI nanoseconds.
Bytes
Bytes (binary, 1024-scale used by the MemoryGauge helpers).
Kilobytes
Kilobytes (1024 bytes).
Megabytes
Megabytes (1024² bytes).
Gigabytes
Gigabytes (1024³ bytes).
Percent
Percentage 0..=100.
Ratio
Ratio 0.0..=1.0.
Custom(&'static str)
Free-form unit name (e.g., "requests", "connections").
Implementations§
Trait Implementations§
impl Copy for Unit
impl Eq for Unit
impl StructuralPartialEq for Unit
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unit
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