pub struct Label(_, _);
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
sourceimpl Label
impl Label
sourcepub fn new<K, V>(key: K, value: V) -> Self where
K: Into<SharedString>,
V: Into<SharedString>,
pub fn new<K, V>(key: K, value: V) -> Self where
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
sourceimpl<K, V> From<&(K, V)> for Label where
K: Into<SharedString> + Clone,
V: Into<SharedString> + Clone,
impl<K, V> From<&(K, V)> for Label where
K: Into<SharedString> + Clone,
V: Into<SharedString> + Clone,
sourceimpl Ord for Label
impl Ord for Label
sourceimpl PartialOrd<Label> for Label
impl PartialOrd<Label> for Label
sourcefn partial_cmp(&self, other: &Label) -> Option<Ordering>
fn partial_cmp(&self, other: &Label) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Label
impl StructuralEq for Label
impl StructuralPartialEq for Label
Auto Trait Implementations
impl RefUnwindSafe for Label
impl Send for Label
impl Sync for Label
impl Unpin for Label
impl UnwindSafe for Label
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more