Struct tracing_dipstick::DipstickLayer[][src]

pub struct DipstickLayer<S> { /* fields omitted */ }

The bridge from tracing to dipstick.

This takes information from tracing and propagates them into dipstick as metrics. It works as Layer.

Warning

Currently, tracing_subscriber doesn’t allow filtering on per-layer basis. That means if there’s another layer that filters (for example based on the level), it’ll impact this layer too. This would negatively impact the gathered metrics as this expects to get them all.

It has been observed to work together with the tracings log-always feature.

Future versions might bypass the Layer system and wrap a Subscriber directly.

Examples

use std::time::Duration;

use dipstick::{AtomicBucket, ScheduleFlush, Stream};
use log::LevelFilter;
use tracing::subscriber;
use tracing_dipstick::DipstickLayer;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::Registry;

env_logger::builder()
    .filter_level(LevelFilter::Info)
    .parse_default_env()
    .init();

let root = AtomicBucket::new();
root.stats(dipstick::stats_all);
root.drain(Stream::write_to_stdout());
let _flush = root.flush_every(Duration::from_secs(5));

let bridge = DipstickLayer::new(root);
let subscriber = Registry::default().with(bridge);

subscriber::set_global_default(subscriber).unwrap();

Implementations

impl<S> DipstickLayer<S> where
    S: Clone + InputScope + Prefixed + 'static, 
[src]

pub fn new(input_scope: S) -> Self[src]

Creates the bridge.

Expects the scope into which it will put metrics.

Trait Implementations

impl<S: Clone> Clone for DipstickLayer<S>[src]

impl<S: Copy> Copy for DipstickLayer<S>[src]

impl<S: Debug> Debug for DipstickLayer<S>[src]

impl<S: Default> Default for DipstickLayer<S>[src]

impl<S, I> Layer<I> for DipstickLayer<S> where
    S: Clone + InputScope + Prefixed + Send + Sync + 'static,
    I: Subscriber,
    I: LookupSpan<'l>, 
[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for DipstickLayer<S> where
    S: RefUnwindSafe

impl<S> Send for DipstickLayer<S> where
    S: Send

impl<S> Sync for DipstickLayer<S> where
    S: Sync

impl<S> Unpin for DipstickLayer<S> where
    S: Unpin

impl<S> UnwindSafe for DipstickLayer<S> where
    S: UnwindSafe

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> 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.