Struct dipstick::core::Chain
[−]
[src]
pub struct Chain<M> { /* fields omitted */ }
A pair of functions composing a twin "chain of command". This is the building block for the metrics backend.
Methods
impl<M> Chain<M>
[src]
fn define_metric(&self, kind: Kind, name: &str, sampling: Rate) -> M
[src]
Define a new metric.
fn open_scope(&self, buffered: bool) -> ControlScopeFn<M>
[src]
Open a new metric scope. Scope metrics allow an application to emit per-operation statistics, For example, producing a per-request performance log.
Although the scope metrics can be predefined like in ['AppMetrics'], the application needs to create a scope that will be passed back when reporting scoped metric values.
use dipstick::*; let scope_metrics = to_log(); let request_counter = scope_metrics.counter("scope_counter"); { let ref mut request_scope = scope_metrics.open_scope(true); request_counter.count(request_scope, 42); }
fn buffered_scope(&self) -> ControlScopeFn<M>
[src]
Open a buffered scope.
fn unbuffered_scope(&self) -> ControlScopeFn<M>
[src]
Open an unbuffered scope.
impl<M: Send + Sync + Clone + 'static> Chain<M>
[src]
fn new<MF, WF>(make_metric: MF, make_scope: WF) -> Self where
MF: Fn(Kind, &str, Rate) -> M + Send + Sync + 'static,
WF: Fn(bool) -> ControlScopeFn<M> + Send + Sync + 'static,
[src]
MF: Fn(Kind, &str, Rate) -> M + Send + Sync + 'static,
WF: Fn(bool) -> ControlScopeFn<M> + Send + Sync + 'static,
Create a new metric chain with the provided metric definition and scope creation functions.
fn marker<AS: AsRef<str>>(&self, name: AS) -> ScopeMarker<M>
[src]
Get an event counter of the provided name.
fn counter<AS: AsRef<str>>(&self, name: AS) -> ScopeCounter<M>
[src]
Get a counter of the provided name.
fn timer<AS: AsRef<str>>(&self, name: AS) -> ScopeTimer<M>
[src]
Get a timer of the provided name.
fn gauge<AS: AsRef<str>>(&self, name: AS) -> ScopeGauge<M>
[src]
Get a gauge of the provided name.
fn mod_metric<MF>(&self, mod_fn: MF) -> Chain<M> where
MF: Fn(DefineMetricFn<M>) -> DefineMetricFn<M>,
[src]
MF: Fn(DefineMetricFn<M>) -> DefineMetricFn<M>,
Intercept metric definition without changing the metric type.
fn mod_both<MF, N>(&self, mod_fn: MF) -> Chain<N> where
MF: Fn(DefineMetricFn<M>, OpenScopeFn<M>) -> (DefineMetricFn<N>, OpenScopeFn<N>),
N: Clone + Send + Sync,
[src]
MF: Fn(DefineMetricFn<M>, OpenScopeFn<M>) -> (DefineMetricFn<N>, OpenScopeFn<N>),
N: Clone + Send + Sync,
Intercept both metric definition and scope creation, possibly changing the metric type.
fn mod_scope<MF>(&self, mod_fn: MF) -> Self where
MF: Fn(OpenScopeFn<M>) -> OpenScopeFn<M>,
[src]
MF: Fn(OpenScopeFn<M>) -> OpenScopeFn<M>,
Intercept scope creation.
Trait Implementations
impl<M> Debug for Chain<M>
[src]
impl<M: Clone> Clone for Chain<M>
[src]
fn clone(&self) -> Chain<M>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<M: Send + Sync + 'static + Clone> WithSamplingRate for Chain<M>
[src]
fn with_sampling_rate(&self, sampling_rate: Rate) -> Self
[src]
Perform random sampling of values according to the specified rate.
impl<M: Send + Sync + Clone + 'static> WithNamespace for Chain<M>
[src]
fn with_name<IN: Into<Namespace>>(&self, names: IN) -> Self
[src]
Join namespace and prepend in newly defined metrics.
fn with_prefix<AS: AsRef<str>>(&self, prefix: AS) -> Self
[src]
Insert prefix in newly defined metrics.
fn with_namespace(&self, names: &[&str]) -> Self
[src]
Join namespace and prepend in newly defined metrics.
impl<M: Send + Sync + Clone + 'static> WithCache for Chain<M>
[src]
fn with_cache(&self, cache_size: usize) -> Self
[src]
Cache metrics to prevent them from being re-defined on every use.
impl<M1, M2> From<(Chain<M1>, Chain<M2>)> for Chain<(M1, M2)> where
M1: 'static + Clone + Send + Sync,
M2: 'static + Clone + Send + Sync,
[src]
M1: 'static + Clone + Send + Sync,
M2: 'static + Clone + Send + Sync,
Two chains of different types can be combined in a tuple. The chains will act as one, each receiving calls in the order the appear in the tuple. For more than two types, make tuples of tuples, "Yo Dawg" style.
impl<'a, M> From<&'a [Chain<M>]> for Chain<Vec<M>> where
M: 'static + Clone + Send + Sync,
[src]
M: 'static + Clone + Send + Sync,
Multiple chains of the same type can be combined in a slice. The chains will act as one, each receiving calls in the order the appear in the slice.
impl<M: Send + Sync + Clone + 'static> WithAsyncQueue for Chain<M>
[src]
fn with_async_queue(&self, queue_size: usize) -> Self
[src]
Enqueue collected metrics for dispatch on background thread.