[][src]Struct spirit_dipstick::Monitor

pub struct 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 Pipelines. 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]

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]

impl Observe for Monitor[src]

type Inner = <AtomicBucket as Observe>::Inner

The inner type for the [ObserveWhen]. Read more

impl Prefixed for Monitor[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoResult<T> for T[src]

impl<T> Observe for T where
    T: WithAttributes + InputScope
[src]

type Inner = T

The inner type for the [ObserveWhen]. Read more

impl<T> Prefixed for T where
    T: WithAttributes, 
[src]

fn get_prefixes(&self) -> &NameParts[src]

Returns namespace of component.

fn add_prefix<S>(&self, name: S) -> T where
    S: Into<String>, 
[src]

👎 Deprecated since 0.7.2:

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]

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]

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.

impl<T> ScheduleFlush for T where
    T: 'static + InputScope + Clone + Send + Sync
[src]

fn flush_every(&self, period: Duration) -> CancelHandle[src]

Flush this scope at regular intervals.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.