pub struct ObservationBatch<'a, P>where
P: PublishModel,{ /* private fields */ }Expand description
A batch of pending observations for an event, waiting for the magnitude to be specified.
Implementations§
Source§impl<P> ObservationBatch<'_, P>where
P: PublishModel,
impl<P> ObservationBatch<'_, P>where
P: PublishModel,
Sourcepub fn observe_once(&self)
pub fn observe_once(&self)
Observes a batch of events that have no explicit magnitude.
By convention, this is represented as a magnitude of 1. We expose a separate method for this to make it clear that the magnitude has no inherent meaning.
Sourcepub fn observe(&self, magnitude: impl AsPrimitive<Magnitude>)
pub fn observe(&self, magnitude: impl AsPrimitive<Magnitude>)
Observes a batch of events with a specific magnitude.
Sourcepub fn observe_millis(&self, duration: Duration)
pub fn observe_millis(&self, duration: Duration)
Observes an event with the magnitude being the indicated duration in milliseconds.
Only the whole number part of the duration is used - fractional milliseconds are ignored. Values outside the i64 range are not guaranteed to be correctly represented.
Sourcepub fn observe_duration_millis<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn observe_duration_millis<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
Observes the duration of a function call, in milliseconds.
Trait Implementations§
Source§impl<'a, P> Debug for ObservationBatch<'a, P>where
P: PublishModel + Debug,
impl<'a, P> Debug for ObservationBatch<'a, P>where
P: PublishModel + Debug,
Source§impl<P> Observe for ObservationBatch<'_, P>where
P: PublishModel,
impl<P> Observe for ObservationBatch<'_, P>where
P: PublishModel,
Source§fn observe_once(&self)
fn observe_once(&self)
Observes an event that has no explicit magnitude. Read more
Source§fn observe(&self, magnitude: impl AsPrimitive<Magnitude>)
fn observe(&self, magnitude: impl AsPrimitive<Magnitude>)
Observes an event with a specific magnitude. Read more
Source§fn observe_millis(&self, duration: Duration)
fn observe_millis(&self, duration: Duration)
Observes an event with the magnitude being the indicated duration in milliseconds. Read more
Source§fn observe_duration_millis<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
fn observe_duration_millis<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
Observes the duration of a function call, in milliseconds. Read more
Auto Trait Implementations§
impl<'a, P> Freeze for ObservationBatch<'a, P>
impl<'a, P> RefUnwindSafe for ObservationBatch<'a, P>where
P: RefUnwindSafe,
impl<'a, P> !Send for ObservationBatch<'a, P>
impl<'a, P> !Sync for ObservationBatch<'a, P>
impl<'a, P> Unpin for ObservationBatch<'a, P>
impl<'a, P> UnwindSafe for ObservationBatch<'a, P>where
P: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more