Struct metrics_util::layers::RouterBuilder
source · [−]pub struct RouterBuilder { /* private fields */ }
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
sourceimpl RouterBuilder
impl RouterBuilder
sourcepub fn from_recorder<R>(recorder: R) -> Self where
R: Recorder + 'static,
pub fn from_recorder<R>(recorder: R) -> Self where
R: Recorder + 'static,
Creates a RouterBuilder
from a Recorder
.
The given recorder is used as the default route when no other specific route exists.
sourcepub 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
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more