Struct prometheus_utils::InstrumentedFuture [−][src]
pub struct InstrumentedFuture<F: Future> { /* fields omitted */ }
Expand description
An instrumented Future
.
InstrumentedFuture
provides a transparent observability layer for futures. An instrumented
future is not created directly. Rather, an instrumented future is created from an existing
future using IntoInstrumentedFuture::into_instrumented_future
.
Most importantly, the increment_until_resolved
method allows callers to
increment a GuardedGauge
, and then decrement the gauge once the future has
resolved.
Implementations
Queue guard_fn
to execute when the future is polled, retaining the returned value until
the future completes.
Increment a Prometheus counter immediately.
pub fn with_count_labeled<C, L>(self, counter: &'static C, labels: L) -> Self where
C: Deref<Target = IntCounterWithLabels<L>> + Sync,
L: Labels + Sync + Send + 'static,
pub fn with_count_labeled<C, L>(self, counter: &'static C, labels: L) -> Self where
C: Deref<Target = IntCounterWithLabels<L>> + Sync,
L: Labels + Sync + Send + 'static,
Increment a labeled Prometheus counter when the future is polled.
pub fn with_count_gauge<G, T, P>(self, gauge: &'static G) -> Self where
G: Deref<Target = T> + Sync,
T: GuardedGauge<P> + 'static,
P: Atomic + 'static,
pub fn with_count_gauge<G, T, P>(self, gauge: &'static G) -> Self where
G: Deref<Target = T> + Sync,
T: GuardedGauge<P> + 'static,
P: Atomic + 'static,
Increment a Prometheus gauge until this future has resolved.
When called, this method will immediately increment the given gauge using the
GuardedGauge::gaurded_inc
trait method. This gauge will then be
decremented once this future’s Future::poll
implementation returns a
Poll::Ready
value.
See the GenericGaugeGuard
documentation for more information about RAII
guards for Prometheus metrics.
Trait Implementations
An instrumented future returns the same type as its inner future.
impl<'pin, F: Future> Unpin for InstrumentedFuture<F> where
__InstrumentedFuture<'pin, F>: Unpin,
Auto Trait Implementations
impl<F> !RefUnwindSafe for InstrumentedFuture<F>
impl<F> Send for InstrumentedFuture<F> where
F: Send,
impl<F> !Sync for InstrumentedFuture<F>
impl<F> !UnwindSafe for InstrumentedFuture<F>
Blanket Implementations
Mutably borrows from an owned value. Read more
into_future
)The output that the future will produce on completion.
type Future = F
type Future = F
into_future
)Which kind of future are we turning this into?
into_future
)Creates a future from a value.