Struct metrics::Label[][src]

pub struct Label(_, _);

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]

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]

Creates a Label from a static key and value.

pub fn key(&self) -> &str[src]

Key of this label.

pub fn value(&self) -> &str[src]

Value of this label.

pub fn into_parts(self) -> (SharedString, SharedString)[src]

Consumes this Label, returning the key and value.

Trait Implementations

impl Clone for Label[src]

impl Debug for Label[src]

impl Eq for Label[src]

impl<K, V> From<&'_ (K, V)> for Label where
    K: Into<SharedString> + Clone,
    V: Into<SharedString> + Clone
[src]

impl Hash for Label[src]

impl Ord for Label[src]

impl PartialEq<Label> for Label[src]

impl PartialOrd<Label> for Label[src]

impl StructuralEq for Label[src]

impl StructuralPartialEq for Label[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.