[−][src]Struct metrics::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]
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 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]
K: Into<SharedString> + Clone,
V: Into<SharedString> + Clone,
impl Hash for Label
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Label> for Label
[src]
impl StructuralEq for Label
[src]
impl StructuralPartialEq for Label
[src]
Auto Trait Implementations
impl RefUnwindSafe for Label
[src]
impl Send for Label
[src]
impl Sync for Label
[src]
impl Unpin for Label
[src]
impl UnwindSafe for Label
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,