pub struct HooksBuilder { /* private fields */ }Expand description
A builder-like type to create a new Hooks instance.
Implementations§
Source§impl HooksBuilder
impl HooksBuilder
Sourcepub const DEFAULT_BACKGROUND_INTERVAL: Duration
pub const DEFAULT_BACKGROUND_INTERVAL: Duration
Default interval at which background hooks are refreshed.
Sourcepub fn with_hook(self, hook: impl Hook) -> Self
pub fn with_hook(self, hook: impl Hook) -> Self
Registers a Hook that runs while metrics are collected.
Only suitable for cheap collection; anything that can take longer than a scrape timeout
belongs in with_background_hook.
Sourcepub fn install_hook<F, H>(self, f: F) -> Self
pub fn install_hook<F, H>(self, f: F) -> Self
Registers a Hook by calling the provided closure.
Sourcepub fn with_background_hook(self, hook: impl Hook) -> Self
pub fn with_background_hook(self, hook: impl Hook) -> Self
Registers a Hook whose collection is refreshed out of band: metrics collection kicks it
off, at most once per background_interval and never
while a previous refresh is still running, but never waits for it.
Collection that walks a backing store (e.g. every static file jar) scales with the dataset and can take seconds, which would stall a scrape for its entire duration. Such hooks only set gauges, and the interval already means most scrapes render values collected by an earlier one, so serving the previous values while the refresh runs costs at most one scrape worth of freshness.
Background hooks are collected sequentially in registration order. A hook that panics is logged and does not prevent the hooks registered after it from being collected.
Sourcepub const fn with_background_interval(self, interval: Duration) -> Self
pub const fn with_background_interval(self, interval: Duration) -> Self
Sets the minimum interval between the starts of two background collections.
Trait Implementations§
Source§impl Debug for HooksBuilder
impl Debug for HooksBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for HooksBuilder
impl !UnwindSafe for HooksBuilder
impl Freeze for HooksBuilder
impl Send for HooksBuilder
impl Sync for HooksBuilder
impl Unpin for HooksBuilder
impl UnsafeUnpin for HooksBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes