[−][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);
Implementations
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]
impl Debug for Monitor
[src]
impl Default for Monitor
[src]
impl Flush for Monitor
[src]
impl InputScope for Monitor
[src]
fn new_metric(&self, name: MetricName, kind: InputKind) -> InputMetric
[src]
fn counter(&self, name: &str) -> Counter
[src]
fn marker(&self, name: &str) -> Marker
[src]
fn timer(&self, name: &str) -> Timer
[src]
fn gauge(&self, name: &str) -> Gauge
[src]
fn level(&self, name: &str) -> Level
[src]
impl Observe for Monitor
[src]
type Inner = <AtomicBucket as Observe>::Inner
The inner type for the ObserveWhen
. Read more
fn observe<F>(
&self,
metric: impl Deref<Target = InputMetric>,
operation: F
) -> ObserveWhen<'_, Self::Inner, F> where
F: Fn(Instant) -> MetricValue + Send + Sync + 'static,
[src]
&self,
metric: impl Deref<Target = InputMetric>,
operation: F
) -> ObserveWhen<'_, Self::Inner, F> where
F: Fn(Instant) -> MetricValue + Send + Sync + 'static,
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]
fn prefix_append<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
fn prefix_prepend<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
Auto Trait Implementations
impl RefUnwindSafe for Monitor
impl Send for Monitor
impl Sync for Monitor
impl Unpin for Monitor
impl UnwindSafe for Monitor
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoResult<T> for T
[src]
impl<T> Observe for T where
T: WithAttributes + InputScope,
[src]
T: WithAttributes + InputScope,
type Inner = T
The inner type for the ObserveWhen
. Read more
fn observe<F>(
&self,
metric: impl Deref<Target = InputMetric>,
operation: F
) -> ObserveWhen<'_, T, F> where
F: Fn(Instant) -> isize + Send + Sync + 'static,
[src]
&self,
metric: impl Deref<Target = InputMetric>,
operation: F
) -> ObserveWhen<'_, T, F> where
F: Fn(Instant) -> isize + Send + Sync + 'static,
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.
fn prefix_append<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
fn prefix_prepend<S>(&self, name: S) -> MetricName where
S: Into<MetricName>,
[src]
S: Into<MetricName>,
impl<T> ScheduleFlush for T where
T: 'static + InputScope + Clone + Send + Sync,
[src]
T: 'static + InputScope + Clone + Send + Sync,
fn flush_every(&self, period: Duration) -> CancelHandle
[src]
Flush this scope at regular intervals.
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,