MetricsBuilder

Struct MetricsBuilder 

Source
pub struct MetricsBuilder { /* private fields */ }
Expand description

Builder for constructing metrics.

This builder is simplistic, but supports constructing metrics with default tags, and in an API-driven way to help ensure consistent tagging across the board.

Implementations§

Source§

impl MetricsBuilder

Source

pub fn add_default_tag<T>(self, tag: T) -> Self
where T: MetricTag,

Adds an additional default tag to use when constructing metrics.

These tags will be included along with any existing default tags configured in the builder.

Tags can be provided in numerous forms:

  • individual tags ("tag_name" or "tag_name:tag_value", either as &'static str or String)
  • key/value tuples (("tag_name", "tag_value"), with the name as &'static str and the value as either &'static str or String)
Source

pub fn register_trace_counter(&self, metric_name: &'static str) -> Counter

Registers a counter at trace verbosity.

The counter will include the configured default tags for this builder.

Source

pub fn register_trace_counter_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Counter
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a counter at trace verbosity with additional tags.

The counter will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_trace_gauge(&self, metric_name: &'static str) -> Gauge

Registers a gauge at trace verbosity.

The gauge will include the configured default tags for this builder.

Source

pub fn register_trace_gauge_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Gauge
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a gauge at trace verbosity with additional tags.

The gauge will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_trace_histogram(&self, metric_name: &'static str) -> Histogram

Registers a histogram at trace verbosity.

The histogram will include the configured default tags for this builder.

Source

pub fn register_trace_histogram_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Histogram
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a histogram at trace verbosity with additional tags.

The histogram will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_debug_counter(&self, metric_name: &'static str) -> Counter

Registers a counter at debug verbosity.

The counter will include the configured default tags for this builder.

Source

pub fn register_debug_counter_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Counter
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a counter at debug verbosity with additional tags.

The counter will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_debug_gauge(&self, metric_name: &'static str) -> Gauge

Registers a gauge at debug verbosity.

The gauge will include the configured default tags for this builder.

Source

pub fn register_debug_gauge_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Gauge
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a gauge at debug verbosity with additional tags.

The gauge will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_debug_histogram(&self, metric_name: &'static str) -> Histogram

Registers a histogram at debug verbosity.

The histogram will include the configured default tags for this builder.

Source

pub fn register_debug_histogram_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Histogram
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a histogram at debug verbosity with additional tags.

The histogram will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_counter(&self, metric_name: &'static str) -> Counter

Registers a counter at info verbosity.

The counter will include the configured default tags for this builder.

Source

pub fn register_counter_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Counter
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a counter at info verbosity with additional tags.

The counter will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_gauge(&self, metric_name: &'static str) -> Gauge

Registers a gauge at info verbosity.

The gauge will include the configured default tags for this builder.

Source

pub fn register_gauge_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Gauge
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a gauge at info verbosity with additional tags.

The gauge will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Source

pub fn register_histogram(&self, metric_name: &'static str) -> Histogram

Registers a histogram at info verbosity.

The histogram will include the configured default tags for this builder.

Source

pub fn register_histogram_with_tags<I, T>( &self, metric_name: &'static str, additional_tags: I, ) -> Histogram
where I: IntoIterator<Item = T>, T: MetricTag,

Registers a histogram at info verbosity with additional tags.

The histogram will include the configured default tags for this builder, in addition to the additional tags provided.

See add_default_tag for information on the supported tag formats.

Trait Implementations§

Source§

impl Clone for MetricsBuilder

Source§

fn clone(&self) -> MetricsBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MetricsBuilder

Source§

fn default() -> MetricsBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.