[−][src]Struct tracing_timing::TimingSubscriber
Timing-gathering tracing subscriber.
This type is constructed using a Builder
.
See the crate-level docs for details.
Methods
impl<S, E> TimingSubscriber<S, E> where
S: SpanGroup,
E: EventGroup,
S::Id: Clone + Hash + Eq,
E::Id: Clone + Hash + Eq,
[src]
S: SpanGroup,
E: EventGroup,
S::Id: Clone + Hash + Eq,
E::Id: Clone + Hash + Eq,
pub fn force_synchronize(&self)
[src]
Force all current timing information to be refreshed immediately.
Note that this will interrupt all concurrent metrics gathering until it returns.
pub fn with_histograms<F, R>(&self, f: F) -> R where
F: FnOnce(&mut HashMap<S::Id, IndexMap<E::Id, SyncHistogram<u64>, Hasher>>) -> R,
[src]
F: FnOnce(&mut HashMap<S::Id, IndexMap<E::Id, SyncHistogram<u64>, Hasher>>) -> R,
Access the timing histograms.
Be aware that the contained histograms are not automatically updated to reflect recently
gathered samples. For each histogram you wish to read from, you must call refresh
or
refresh_timeout
to gather up-to-date samples.
For information about what you can do with the histograms, see the hdrhistogram
documentation.
impl<S, E> TimingSubscriber<S, E> where
S: SpanGroup,
E: EventGroup,
S::Id: Clone + Hash + Eq,
E::Id: Clone + Hash + Eq,
[src]
S: SpanGroup,
E: EventGroup,
S::Id: Clone + Hash + Eq,
E::Id: Clone + Hash + Eq,
pub fn downcaster(&self) -> Downcaster<S, E>
[src]
Returns an identifier that can later be used to get access to this TimingSubscriber
after it has been turned into a tracing::Dispatch
.
use tracing::*; use tracing_timing::{Builder, Histogram, TimingSubscriber}; let subscriber = Builder::default().build(|| Histogram::new_with_max(1_000_000, 2).unwrap()); let downcaster = subscriber.downcaster(); let dispatch = Dispatch::new(subscriber); // ... // code that hands off clones of the dispatch // maybe to other threads // ... downcaster.downcast(&dispatch).unwrap().with_histograms(|hs| { for (span_group, hs) in hs { for (event_group, h) in hs { // make sure we see the latest samples: h.refresh(); // print the median: println!("{} -> {}: {}ns", span_group, event_group, h.value_at_quantile(0.5)) } } });
Trait Implementations
impl<S, E> Subscriber for TimingSubscriber<S, E> where
S: SpanGroup + 'static,
E: EventGroup + 'static,
S::Id: Clone + Hash + Eq + 'static,
E::Id: Clone + Hash + Eq + 'static,
[src]
S: SpanGroup + 'static,
E: EventGroup + 'static,
S::Id: Clone + Hash + Eq + 'static,
E::Id: Clone + Hash + Eq + 'static,
fn enabled(&self, _: &Metadata) -> bool
[src]
fn new_span(&self, span: &Attributes) -> Id
[src]
fn record(&self, _: &Id, _: &Record)
[src]
fn record_follows_from(&self, span: &Id, follows: &Id)
[src]
fn event(&self, event: &Event)
[src]
fn enter(&self, span: &Id)
[src]
fn exit(&self, span: &Id)
[src]
fn clone_span(&self, span: &Id) -> Id
[src]
fn drop_span(&self, span: Id)
[src]
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
[src]
Registers a new callsite with this subscriber, returning whether or not the subscriber is interested in being notified about the callsite. Read more
unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>
[src]
If self
is the same type as the provided TypeId
, returns an untyped *const
pointer to that type. Otherwise, returns None
. Read more
Auto Trait Implementations
impl<S, E> Send for TimingSubscriber<S, E> where
E: Send,
S: Send,
<E as EventGroup>::Id: Send,
<S as SpanGroup>::Id: Send,
E: Send,
S: Send,
<E as EventGroup>::Id: Send,
<S as SpanGroup>::Id: Send,
impl<S, E> Unpin for TimingSubscriber<S, E> where
E: Unpin,
S: Unpin,
<E as EventGroup>::Id: Unpin,
<S as SpanGroup>::Id: Unpin,
E: Unpin,
S: Unpin,
<E as EventGroup>::Id: Unpin,
<S as SpanGroup>::Id: Unpin,
impl<S, E> Sync for TimingSubscriber<S, E> where
E: Sync,
S: Sync,
<E as EventGroup>::Id: Send + Sync,
<S as SpanGroup>::Id: Send + Sync,
E: Sync,
S: Sync,
<E as EventGroup>::Id: Send + Sync,
<S as SpanGroup>::Id: Send + Sync,
impl<S, E> UnwindSafe for TimingSubscriber<S, E> where
E: UnwindSafe,
S: UnwindSafe,
E: UnwindSafe,
S: UnwindSafe,
impl<S, E> RefUnwindSafe for TimingSubscriber<S, E> where
E: RefUnwindSafe,
S: RefUnwindSafe,
E: RefUnwindSafe,
S: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,