Struct metrics_util::layers::RouterBuilder [−][src]
pub struct RouterBuilder { /* fields omitted */ }
Expand description
Routes metrics to specific target recorders.
Routes are defined as a prefix to check against the metric name, and a mask for the metric type. For example, a route with the pattern of “foo” would match “foo”, “or “foo.submetric”, but not “something.foo”. Likewise, a metric mask of “all” would apply this route to counters, gauges, and histograms, while any specific mask would only apply to the given metric kind.
A default route (recorder) is always present and used in the case that no specific route exists.
Implementations
Creates a RouterBuilder
from a Recorder
.
The given recorder is used as the default route when no other specific route exists.
pub fn add_route<P, R>(
&mut self,
mask: MetricKindMask,
pattern: P,
recorder: R
) -> &mut RouterBuilder where
P: AsRef<str>,
R: Recorder + 'static,
pub fn add_route<P, R>(
&mut self,
mask: MetricKindMask,
pattern: P,
recorder: R
) -> &mut RouterBuilder where
P: AsRef<str>,
R: Recorder + 'static,
Adds a route.
mask
defines which metric kinds will match the given route, and pattern
is a prefix
string used to match against metric names.
If a matching route already exists, it will be overwritten.
Auto Trait Implementations
impl !RefUnwindSafe for RouterBuilder
impl !Send for RouterBuilder
impl !Sync for RouterBuilder
impl Unpin for RouterBuilder
impl !UnwindSafe for RouterBuilder