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
impl MetricsBuilder
Sourcepub fn add_default_tag<T>(self, tag: T) -> Selfwhere
T: MetricTag,
pub fn add_default_tag<T>(self, tag: T) -> Selfwhere
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
orString
) - key/value tuples (
("tag_name", "tag_value")
, with the name as&'static str
and the value as either&'static str
orString
)
Sourcepub fn register_trace_counter(&self, metric_name: &'static str) -> Counter
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.
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.
Sourcepub fn register_trace_gauge(&self, metric_name: &'static str) -> Gauge
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.
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.
Sourcepub fn register_trace_histogram(&self, metric_name: &'static str) -> Histogram
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.
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.
Sourcepub fn register_debug_counter(&self, metric_name: &'static str) -> Counter
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.
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.
Sourcepub fn register_debug_gauge(&self, metric_name: &'static str) -> Gauge
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.
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.
Sourcepub fn register_debug_histogram(&self, metric_name: &'static str) -> Histogram
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.
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.
Sourcepub fn register_counter(&self, metric_name: &'static str) -> Counter
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.
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.
Sourcepub fn register_gauge(&self, metric_name: &'static str) -> Gauge
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.
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.
Sourcepub fn register_histogram(&self, metric_name: &'static str) -> Histogram
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.
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
impl Clone for MetricsBuilder
Source§fn clone(&self) -> MetricsBuilder
fn clone(&self) -> MetricsBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more