pub struct Label(/* private fields */);
Expand description
Metadata for a metric key in the form of a key/value pair.
Metrics are always defined by a name, but can optionally be assigned “labels”, which are key/value pairs that provide metadata about the key. Labels are typically used for differentiating the context of when an where a metric are emitted.
For example, in a web service, you might wish to label metrics with the user ID responsible for the request currently being processed, or the request path being processed. Another example may be that if you were running a piece o code that was turned on or off by a feature toggle, you may wish to include a label in metrics to indicate whether or not they were using the feature toggle.
Implementations§
source§impl Label
impl Label
sourcepub fn new<K, V>(key: K, value: V) -> Selfwhere
K: Into<SharedString>,
V: Into<SharedString>,
pub fn new<K, V>(key: K, value: V) -> Selfwhere K: Into<SharedString>, V: Into<SharedString>,
Creates a Label
from a key and value.
sourcepub const fn from_static_parts(key: &'static str, value: &'static str) -> Self
pub const fn from_static_parts(key: &'static str, value: &'static str) -> Self
Creates a Label
from a static key and value.
sourcepub fn into_parts(self) -> (SharedString, SharedString)
pub fn into_parts(self) -> (SharedString, SharedString)
Consumes this Label
, returning the key and value.
Trait Implementations§
source§impl<K, V> From<&(K, V)> for Labelwhere
K: Into<SharedString> + Clone,
V: Into<SharedString> + Clone,
impl<K, V> From<&(K, V)> for Labelwhere K: Into<SharedString> + Clone, V: Into<SharedString> + Clone,
source§impl Ord for Label
impl Ord for Label
source§impl PartialEq for Label
impl PartialEq for Label
source§impl PartialOrd for Label
impl PartialOrd for Label
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more