Expand description
Aspect-oriented interceptors.
An Interceptor sits around a handler: it sees the inbound
RequestContext before extraction and the Response on the way out. Use
it for logging, timing, response envelopes, caching — anything that
shouldn’t live in handler bodies.
Apply with the #[UseInterceptors(...)] attribute on a handler or
controller impl block. Multiple interceptors compose in declaration
order (first listed = outermost layer).
Structs§
- Envelope
Response - Wrap successful JSON responses in
{ "data": ... }. Errors pass through untouched so RFC 7807 ProblemDetails reaches the client verbatim. - Latency
Log - Log method + path + status + latency on each request.
- Next
Handler - Continuation handed to an interceptor. Calling
.run(ctx)invokes the next layer (or the handler itself if this is the innermost interceptor). - Telemetry
Log - Emit a structured log line for every request via the
tracingcrate. - Trace
Interceptor - Full-stack observability interceptor: structured log + OTLP span + Prometheus.
Traits§
- Interceptor
- One layer of the aspect chain.