pub struct MetricBuilder { /* private fields */ }
Expand description
Common builder for various metrics.
Implementations§
Source§impl MetricBuilder
impl MetricBuilder
Sourcepub fn with_registry(registry: Registry) -> Self
pub fn with_registry(registry: Registry) -> Self
Makes a builder with the given registry.
Sourcepub fn without_registry() -> Self
pub fn without_registry() -> Self
Makes a builder without any registries.
Sourcepub fn namespace(&mut self, namespace: &str) -> &mut Self
pub fn namespace(&mut self, namespace: &str) -> &mut Self
Sets the namespace part of the metric name.
Sourcepub fn subsystem(&mut self, subsystem: &str) -> &mut Self
pub fn subsystem(&mut self, subsystem: &str) -> &mut Self
Sets the subsystem part of the metric name of this.
Sourcepub fn label(&mut self, name: &str, value: &str) -> &mut Self
pub fn label(&mut self, name: &str, value: &str) -> &mut Self
Adds a label.
Note that name
will be validated when creating the metrics.
Sourcepub fn registry(&mut self, registry: Registry) -> &mut Self
pub fn registry(&mut self, registry: Registry) -> &mut Self
Adds a registry to which the resulting metrics will be registered.
Sourcepub fn set_registry(&mut self, registry: Registry) -> &mut Self
pub fn set_registry(&mut self, registry: Registry) -> &mut Self
Clears the current registries, then sets registry
as the new one.
Sourcepub fn counter(&self, name: &str) -> CounterBuilder
pub fn counter(&self, name: &str) -> CounterBuilder
Makes a CounterBuilder
that inherited the setting of this builder.
Sourcepub fn gauge(&self, name: &str) -> GaugeBuilder
pub fn gauge(&self, name: &str) -> GaugeBuilder
Makes a GaugeBuilder
that inherited the setting of this builder.
Sourcepub fn histogram(&self, name: &str) -> HistogramBuilder
pub fn histogram(&self, name: &str) -> HistogramBuilder
Makes a HistogramBuilder
that inherited the setting of this builder.
Sourcepub fn summary(&self, name: &str, window: Duration) -> SummaryBuilder
pub fn summary(&self, name: &str, window: Duration) -> SummaryBuilder
Makes a SummaryBuilder
that inherited the setting of this builder.
Trait Implementations§
Source§impl Clone for MetricBuilder
impl Clone for MetricBuilder
Source§fn clone(&self) -> MetricBuilder
fn clone(&self) -> MetricBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MetricBuilder
impl Debug for MetricBuilder
Auto Trait Implementations§
impl Freeze for MetricBuilder
impl RefUnwindSafe for MetricBuilder
impl Send for MetricBuilder
impl Sync for MetricBuilder
impl Unpin for MetricBuilder
impl UnwindSafe for MetricBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)