pub struct MetricBuilder<'s> { /* private fields */ }Expand description
Builder for creating metrics with labels.
Implementations§
Source§impl<'r> MetricBuilder<'r>
impl<'r> MetricBuilder<'r>
Sourcepub fn new(registry: &'r dyn MetricsRegistry) -> Self
pub fn new(registry: &'r dyn MetricsRegistry) -> Self
Create a new builder for a metric backed by a MetricsRegistry.
Sourcepub fn add_label<K, V>(self, key: K, value: V) -> Self
pub fn add_label<K, V>(self, key: K, value: V) -> Self
Add a label to the metric. Labels might not be unique, and its up to consumers of this data to resolve such cases.
Sourcepub fn add_labels<I, L>(self, labels: I) -> Self
pub fn add_labels<I, L>(self, labels: I) -> Self
Adds multiple labels to the metric. Labels might not be unique, and its up to consumers of this data to resolve such cases.
Sourcepub fn counter(self, name: impl Into<Cow<'static, str>>) -> Counter
pub fn counter(self, name: impl Into<Cow<'static, str>>) -> Counter
Creates a new Counter with the given name, registering it with the backend.
Sourcepub fn histogram(self, name: impl Into<Cow<'static, str>>) -> Histogram
pub fn histogram(self, name: impl Into<Cow<'static, str>>) -> Histogram
Creates a new Histogram with the given name, registering it with the backend.
Auto Trait Implementations§
impl<'s> Freeze for MetricBuilder<'s>
impl<'s> !RefUnwindSafe for MetricBuilder<'s>
impl<'s> Send for MetricBuilder<'s>
impl<'s> Sync for MetricBuilder<'s>
impl<'s> Unpin for MetricBuilder<'s>
impl<'s> UnsafeUnpin for MetricBuilder<'s>
impl<'s> !UnwindSafe for MetricBuilder<'s>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more