Struct mas_tower::DurationRecorderLayer
source · pub struct DurationRecorderLayer<OnRequest = (), OnResponse = (), OnError = ()> { /* private fields */ }
Expand description
A Layer
that records the duration of requests in milliseconds.
Implementations§
source§impl DurationRecorderLayer
impl DurationRecorderLayer
sourcepub fn new(name: &'static str) -> Self
pub fn new(name: &'static str) -> Self
Create a new DurationRecorderLayer
.
source§impl<OnRequest, OnResponse, OnError> DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest, OnResponse, OnError> DurationRecorderLayer<OnRequest, OnResponse, OnError>
sourcepub fn on_request<NewOnRequest>(
self,
on_request: NewOnRequest,
) -> DurationRecorderLayer<NewOnRequest, OnResponse, OnError>
pub fn on_request<NewOnRequest>( self, on_request: NewOnRequest, ) -> DurationRecorderLayer<NewOnRequest, OnResponse, OnError>
Set the MetricsAttributes
to use on request.
pub fn on_request_fn<F, T>( self, on_request: F, ) -> DurationRecorderLayer<FnWrapper<F>, OnResponse, OnError>
sourcepub fn on_response<NewOnResponse>(
self,
on_response: NewOnResponse,
) -> DurationRecorderLayer<OnRequest, NewOnResponse, OnError>
pub fn on_response<NewOnResponse>( self, on_response: NewOnResponse, ) -> DurationRecorderLayer<OnRequest, NewOnResponse, OnError>
Set the MetricsAttributes
to use on response.
pub fn on_response_fn<F, T>( self, on_response: F, ) -> DurationRecorderLayer<OnRequest, FnWrapper<F>, OnError>
sourcepub fn on_error<NewOnError>(
self,
on_error: NewOnError,
) -> DurationRecorderLayer<OnRequest, OnResponse, NewOnError>
pub fn on_error<NewOnError>( self, on_error: NewOnError, ) -> DurationRecorderLayer<OnRequest, OnResponse, NewOnError>
Set the MetricsAttributes
to use on error.
pub fn on_error_fn<F, T>( self, on_error: F, ) -> DurationRecorderLayer<OnRequest, OnResponse, FnWrapper<F>>
Trait Implementations§
source§impl<OnRequest: Clone, OnResponse: Clone, OnError: Clone> Clone for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest: Clone, OnResponse: Clone, OnError: Clone> Clone for DurationRecorderLayer<OnRequest, OnResponse, OnError>
source§fn clone(&self) -> DurationRecorderLayer<OnRequest, OnResponse, OnError>
fn clone(&self) -> DurationRecorderLayer<OnRequest, OnResponse, OnError>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<OnRequest: Debug, OnResponse: Debug, OnError: Debug> Debug for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest: Debug, OnResponse: Debug, OnError: Debug> Debug for DurationRecorderLayer<OnRequest, OnResponse, OnError>
source§impl<S, OnRequest, OnResponse, OnError> Layer<S> for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<S, OnRequest, OnResponse, OnError> Layer<S> for DurationRecorderLayer<OnRequest, OnResponse, OnError>
Auto Trait Implementations§
impl<OnRequest, OnResponse, OnError> Freeze for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest = (), OnResponse = (), OnError = ()> !RefUnwindSafe for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest, OnResponse, OnError> Send for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest, OnResponse, OnError> Sync for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest, OnResponse, OnError> Unpin for DurationRecorderLayer<OnRequest, OnResponse, OnError>
impl<OnRequest = (), OnResponse = (), OnError = ()> !UnwindSafe for DurationRecorderLayer<OnRequest, OnResponse, OnError>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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