rama::http::layer::trace

Trait OnFailure

pub trait OnFailure<FailureClass>:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_failure(
        &self,
        failure_classification: FailureClass,
        latency: Duration,
        span: &Span,
    );
}
Expand description

Trait used to tell Trace what to do when a request fails.

See the module docs for details on exactly when the on_failure callback is called.

Required Methods§

fn on_failure( &self, failure_classification: FailureClass, latency: Duration, span: &Span, )

Do the thing.

latency is the duration since the request was received.

span is the tracing Span, corresponding to this request, produced by the closure passed to TraceLayer::make_span_with. It can be used to record field values that weren’t known when the span was created.

Implementations on Foreign Types§

§

impl<FailureClass> OnFailure<FailureClass> for ()

§

fn on_failure(&self, _: FailureClass, _: Duration, _: &Span)

Implementors§

§

impl<F, FailureClass> OnFailure<FailureClass> for F
where F: Fn(FailureClass, Duration, &Span) + Send + Sync + 'static,

§

impl<FailureClass> OnFailure<FailureClass> for DefaultOnFailure
where FailureClass: Display,