Struct tracing_dipstick::DipstickLayer [−][src]
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 tracing
s 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]
S: Clone + InputScope + Prefixed + 'static,
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]
fn clone(&self) -> DipstickLayer<S>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn default() -> 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]
S: Clone + InputScope + Prefixed + Send + Sync + 'static,
I: Subscriber,
I: LookupSpan<'l>,
fn new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, I>)
[src]
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, I>)
[src]
pub fn register_callsite(
&self,
metadata: &'static Metadata<'static>
) -> Interest
[src]
&self,
metadata: &'static Metadata<'static>
) -> Interest
pub fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
[src]
pub fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
[src]
pub fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
[src]
pub fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
[src]
pub fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
[src]
pub fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
[src]
pub fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
[src]
pub fn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
[src]
L: Layer<S>,
pub fn with_subscriber(self, inner: S) -> Layered<Self, S, S>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for DipstickLayer<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for DipstickLayer<S> where
S: Send,
S: Send,
impl<S> Sync for DipstickLayer<S> where
S: Sync,
S: Sync,
impl<S> Unpin for DipstickLayer<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for DipstickLayer<S> where
S: UnwindSafe,
S: UnwindSafe,
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,