pub struct Metrics { /* private fields */ }
Expand description
By default two metrics are tracked (this assumes the namespace actix_web_prom
):
This uses the generic metrics crate which allows you to :
- Push histograms, gauges and counters to a receiver
- Register an exporter that will periodically drain the latest metrics
Available exporters :
- Statsd : supports the generic mode, or the dogstats mode, in dogstats mode the labels will be sent as tags in the metric name
Default metrics :
-
http_requests_total
(labels: endpoint, method, status): request counter for each endpoint and method. -
http_requests_duration
(labels: endpoint, method, status): histogram of request durations for each endpoint.
Implementations§
Trait Implementations§
Source§impl<S, B> Transform<S> for Metricswhere
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody,
impl<S, B> Transform<S> for Metricswhere
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody,
Source§type Request = ServiceRequest
type Request = ServiceRequest
Requests handled by the service.
Source§type Response = ServiceResponse<StreamLog<B>>
type Response = ServiceResponse<StreamLog<B>>
Responses given by the service.
Source§type Transform = MetricsMiddleware<S>
type Transform = MetricsMiddleware<S>
The
TransformService
value created by this factorySource§type Future = Ready<Result<<Metrics as Transform<S>>::Transform, <Metrics as Transform<S>>::InitError>>
type Future = Ready<Result<<Metrics as Transform<S>>::Transform, <Metrics as Transform<S>>::InitError>>
The future response value.
Source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Source§fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E>
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E>
Map this transforms’s factory error to a different error,
returning a new transform service factory.
Auto Trait Implementations§
impl Freeze for Metrics
impl !RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl !UnwindSafe for Metrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Converts
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>
Converts
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