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.

Increment a labeled Prometheus counter when the future is polled.

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.

Polls the inner future.

If the inner future’s [Future::poll][fut-poll] implementation returns a [Poll::Ready][poll-ready] value, Prometheus gauges will be decremented accordingly.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

🔬 This is a nightly-only experimental API. (into_future)

Creates a future from a value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.