pub struct InFlightRequestsCounter { /* private fields */ }metrics only.Expand description
An atomic counter that keeps track of the number of in-flight requests.
This will normally combined with InFlightRequestsLayer or InFlightRequests which will
update the counter as requests arrive.
Implementations
Run a future every interval which receives the current number of in-flight requests.
This can be used to send the current count to your metrics system.
This function will loop forever so normally it is called with tokio::spawn:
use tower_http::metrics::in_flight_requests::InFlightRequestsCounter;
use std::time::Duration;
let counter = InFlightRequestsCounter::new();
tokio::spawn(
counter.run_emitter(Duration::from_secs(10), |count: usize| async move {
// Send `count` to metrics system.
}),
);Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for InFlightRequestsCounter
impl Send for InFlightRequestsCounter
impl Sync for InFlightRequestsCounter
impl Unpin for InFlightRequestsCounter
impl UnwindSafe for InFlightRequestsCounter
Blanket Implementations
Mutably borrows from an owned value. Read more
follow-redirect only.Create a new Policy that returns Action::Follow only if self and other return
Action::Follow. Read more
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more