pub struct DurationGuard { /* private fields */ }Expand description
On Drop, records the elapsed time since construction into the named
histogram with the supplied labels. Recording on drop guarantees a sample
even if the surrounding future is cancelled or panics.
Implementations§
Source§impl DurationGuard
impl DurationGuard
pub fn new(name: impl Into<KeyName>, labels: Vec<Label>) -> Self
Sourcepub fn disarm(&mut self)
pub fn disarm(&mut self)
Disarm the guard so dropping it records nothing. Used when the timed span turns out not to represent real work — e.g. the terminal empty poll at the end of a source page stream, which would otherwise record a spurious ~0 sample into the page-duration histogram.
Sourcepub fn with_connector(
name: impl Into<KeyName>,
pipeline: SharedString,
row: SharedString,
connector: SharedString,
) -> Self
pub fn with_connector( name: impl Into<KeyName>, pipeline: SharedString, row: SharedString, connector: SharedString, ) -> Self
Build the canonical (name, pipeline, row, connector) label trio.
Trait Implementations§
Source§impl Drop for DurationGuard
impl Drop for DurationGuard
Auto Trait Implementations§
impl Freeze for DurationGuard
impl RefUnwindSafe for DurationGuard
impl Send for DurationGuard
impl Sync for DurationGuard
impl Unpin for DurationGuard
impl UnsafeUnpin for DurationGuard
impl UnwindSafe for DurationGuard
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