[−][src]Struct spirit_dipstick::Monitor
An inner node in a metrics tree.
This is just a thin wrapper around the AtomicBucket
, hiding some of its functionality. That
functionality is used for configuration of the backends and how metrics are collated and
filtered, which is handled by this library.
If you want to use the library to just get the configuration and manage it manually, use
AtomicBucket
directly. This is for the use with Pipeline
s. See the crate
example.
Cloning
Cloning is cheap and creates another „handle“ to the same bucket. Therefore, it can be
distributed through the application and another layer of Arc
is not needed.
Extraction of AtomicBucket
The bucket inside can be extracted by the Monitor::into_inner
method, to access
functionality hidden by this wrapper. Note that doing so and messing with the bucket might
interfere with configuration from this library (the wrapper is more of a road bump than a full
barrier).
Examples
use dipstick::{InputScope, Prefixed}; use spirit_dipstick::Monitor; let monitor = Monitor::new(); // Plug the monitor.installer() into a pipeline here on startup let sub_monitor = monitor.add_name("sub"); let timer = sub_monitor.timer("a-timer"); let timer_measurement = timer.start(); let counter = sub_monitor.counter("cnt"); counter.count(1); timer.stop(timer_measurement);
Methods
impl Monitor
[src]
pub fn new() -> Self
[src]
Creates a new root node.
This becomes an independent node. Some backends can be installed into it later on and metrics or other nodes can be created under it.
pub fn into_inner(self) -> AtomicBucket
[src]
Extracts the internal AtomicBucket
See the warning above about doing so ‒ the bucket is actually shared by all clones of the
same Monitor
and therefore you can interfere with the installed backends.
pub fn installer<F>(&self, stats: F) -> MonitorInstaller<F> where
F: Fn(InputKind, MetricName, ScoreType) -> Option<(InputKind, MetricName, MetricValue)> + Send + Sync + 'static,
[src]
F: Fn(InputKind, MetricName, ScoreType) -> Option<(InputKind, MetricName, MetricValue)> + Send + Sync + 'static,
Creates an installer for installing into this monitor.
This creates an installer which can be used inside a Pipeline
to attach backends to it.
The stats
is the same kind of filtering and selection function the dipstick
uses in
the AtomicBucket::stats
.
Trait Implementations
impl Clone for Monitor
[src]
fn clone(&self) -> Monitor
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Monitor
[src]
impl Debug for Monitor
[src]
impl Prefixed for Monitor
[src]
fn get_prefixes(&self) -> &NameParts
[src]
fn add_prefix<S: Into<String>>(&self, name: S) -> Self
[src]
fn add_name<S: Into<String>>(&self, name: S) -> Self
[src]
fn named<S: Into<String>>(&self, name: S) -> Self
[src]
default fn prefix_append<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
Append any name parts to the name's namespace.
default fn prefix_prepend<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
Prepend any name parts to the name's namespace.
impl Flush for Monitor
[src]
impl InputScope for Monitor
[src]
fn new_metric(&self, name: MetricName, kind: InputKind) -> InputMetric
[src]
default fn counter(&self, name: &str) -> Counter
[src]
Define a Counter.
default fn marker(&self, name: &str) -> Marker
[src]
Define a Marker.
default fn timer(&self, name: &str) -> Timer
[src]
Define a Timer.
default fn gauge(&self, name: &str) -> Gauge
[src]
Define a Gauge.
default fn level(&self, name: &str) -> Level
[src]
Define a Level.
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Prefixed for T where
T: WithAttributes,
[src]
T: WithAttributes,
fn get_prefixes(&self) -> &NameParts
[src]
Returns namespace of component.
fn add_prefix<S>(&self, name: S) -> T where
S: Into<String>,
[src]
S: Into<String>,
Use named() or add_name()
Append a name to the existing names. Return a clone of the component with the updated names.
fn add_name<S>(&self, name: S) -> T where
S: Into<String>,
[src]
S: Into<String>,
Append a name to the existing names. Return a clone of the component with the updated names.
fn named<S>(&self, name: S) -> T where
S: Into<String>,
[src]
S: Into<String>,
Replace any existing names with a single name.
Return a clone of the component with the new name.
If multiple names are required, add_name
may also be used.
default fn prefix_append<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
Append any name parts to the name's namespace.
default fn prefix_prepend<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
Prepend any name parts to the name's namespace.
impl<T> ScheduleFlush for T where
T: 'static + InputScope + Send + Sync + Clone,
[src]
T: 'static + InputScope + Send + Sync + Clone,
fn flush_every(&self, period: Duration) -> CancelHandle
[src]
Flush this scope at regular intervals.