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]
impl Label
[src]pub fn new<K, V>(key: K, value: V) -> Self where
K: Into<SharedString>,
V: Into<SharedString>,
[src]
K: Into<SharedString>,
V: Into<SharedString>,
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<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 PartialOrd<Label> for Label
[src]
impl PartialOrd<Label> for Label
[src]impl StructuralEq for Label
[src]
impl StructuralEq for Label
[src]impl StructuralPartialEq for Label
[src]
impl StructuralPartialEq for Label
[src]Auto Trait Implementations
impl RefUnwindSafe for Label
impl RefUnwindSafe for Label
impl UnwindSafe for Label
impl UnwindSafe for Label