Struct tower_http::trace::TraceLayer
source · [−]pub struct TraceLayer<M, MakeSpan = DefaultMakeSpan, OnRequest = DefaultOnRequest, OnResponse = DefaultOnResponse, OnBodyChunk = DefaultOnBodyChunk, OnEos = DefaultOnEos, OnFailure = DefaultOnFailure> { /* private fields */ }trace only.Expand description
Layer that adds high level tracing to a Service.
See the module docs for more details.
Implementations
Create a new TraceLayer using the given MakeClassifier.
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
pub fn on_request<NewOnRequest>(
self,
new_on_request: NewOnRequest
) -> TraceLayer<M, MakeSpan, NewOnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
pub fn on_request<NewOnRequest>(
self,
new_on_request: NewOnRequest
) -> TraceLayer<M, MakeSpan, NewOnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
Customize what to do when a request is received.
NewOnRequest is expected to implement OnRequest.
pub fn on_response<NewOnResponse>(
self,
new_on_response: NewOnResponse
) -> TraceLayer<M, MakeSpan, OnRequest, NewOnResponse, OnBodyChunk, OnEos, OnFailure>
pub fn on_response<NewOnResponse>(
self,
new_on_response: NewOnResponse
) -> TraceLayer<M, MakeSpan, OnRequest, NewOnResponse, OnBodyChunk, OnEos, OnFailure>
Customize what to do when a response has been produced.
NewOnResponse is expected to implement OnResponse.
pub fn on_body_chunk<NewOnBodyChunk>(
self,
new_on_body_chunk: NewOnBodyChunk
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, NewOnBodyChunk, OnEos, OnFailure>
pub fn on_body_chunk<NewOnBodyChunk>(
self,
new_on_body_chunk: NewOnBodyChunk
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, NewOnBodyChunk, OnEos, OnFailure>
Customize what to do when a body chunk has been sent.
NewOnBodyChunk is expected to implement OnBodyChunk.
pub fn on_eos<NewOnEos>(
self,
new_on_eos: NewOnEos
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, NewOnEos, OnFailure>
pub fn on_eos<NewOnEos>(
self,
new_on_eos: NewOnEos
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, NewOnEos, OnFailure>
Customize what to do when a streaming response has closed.
NewOnEos is expected to implement OnEos.
pub fn on_failure<NewOnFailure>(
self,
new_on_failure: NewOnFailure
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, NewOnFailure>
pub fn on_failure<NewOnFailure>(
self,
new_on_failure: NewOnFailure
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, NewOnFailure>
Customize what to do when a response has been classified as a failure.
NewOnFailure is expected to implement OnFailure.
pub fn make_span_with<NewMakeSpan>(
self,
new_make_span: NewMakeSpan
) -> TraceLayer<M, NewMakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
pub fn make_span_with<NewMakeSpan>(
self,
new_make_span: NewMakeSpan
) -> TraceLayer<M, NewMakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
Create a new TraceLayer using ServerErrorsAsFailures which supports classifying
regular HTTP responses based on the status code.
Create a new TraceLayer using GrpcErrorsAsFailures which supports classifying
gRPC responses and streams based on the grpc-status header.
Trait Implementations
fn clone(
&self
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
fn clone(
&self
) -> TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure>
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> RefUnwindSafe for TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> where
M: RefUnwindSafe,
MakeSpan: RefUnwindSafe,
OnBodyChunk: RefUnwindSafe,
OnEos: RefUnwindSafe,
OnFailure: RefUnwindSafe,
OnRequest: RefUnwindSafe,
OnResponse: RefUnwindSafe,
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> Send for TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> where
M: Send,
MakeSpan: Send,
OnBodyChunk: Send,
OnEos: Send,
OnFailure: Send,
OnRequest: Send,
OnResponse: Send,
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> Sync for TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> where
M: Sync,
MakeSpan: Sync,
OnBodyChunk: Sync,
OnEos: Sync,
OnFailure: Sync,
OnRequest: Sync,
OnResponse: Sync,
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> Unpin for TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> where
M: Unpin,
MakeSpan: Unpin,
OnBodyChunk: Unpin,
OnEos: Unpin,
OnFailure: Unpin,
OnRequest: Unpin,
OnResponse: Unpin,
impl<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> UnwindSafe for TraceLayer<M, MakeSpan, OnRequest, OnResponse, OnBodyChunk, OnEos, OnFailure> where
M: UnwindSafe,
MakeSpan: UnwindSafe,
OnBodyChunk: UnwindSafe,
OnEos: UnwindSafe,
OnFailure: UnwindSafe,
OnRequest: UnwindSafe,
OnResponse: UnwindSafe,
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