Struct metrics::Label [−][src]
pub struct Label(_, _);
Expand description
Metadata for a metric key in the for 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
impl Label
[src]
impl Label
[src]pub fn new<K, V>(key: K, value: V) -> Self where
K: Into<SharedString>,
V: Into<SharedString>,
[src]
pub fn new<K, V>(key: K, value: V) -> Self where
K: Into<SharedString>,
V: Into<SharedString>,
[src]Creates a Label
from a key and value.
pub const fn from_static_parts(key: &'static str, value: &'static str) -> Self
[src]
pub const fn from_static_parts(key: &'static str, value: &'static str) -> Self
[src]Creates a Label
from a static key and value.
pub fn into_parts(self) -> (SharedString, SharedString)
[src]
pub fn into_parts(self) -> (SharedString, SharedString)
[src]Consumes this Label
, returning the key and value.
Trait Implementations
impl<K, V> From<&'_ (K, V)> for Label where
K: Into<SharedString> + Clone,
V: Into<SharedString> + Clone,
[src]
impl<K, V> From<&'_ (K, V)> for Label where
K: Into<SharedString> + Clone,
V: Into<SharedString> + Clone,
[src]impl Ord for Label
[src]
impl Ord for Label
[src]impl PartialOrd<Label> for Label
[src]
impl PartialOrd<Label> for Label
[src]fn partial_cmp(&self, other: &Label) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Label) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Label
[src]
impl StructuralEq for Label
[src]
impl StructuralPartialEq for Label
[src]
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
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more