Skip to main content

Module middleware

Module middleware 

Source
Expand description

Cross-cutting middleware. Ports the reusable concerns of agent_core/api/: request-id propagation (request_id) and the API latency SLO (latency_slo).

Structs§

RequestId
A request id, available to handlers via Extension<RequestId>.

Constants§

SLO_BUDGET_MS
The API latency budget (p95 ≤ 1s is the product line). Requests over this are logged at warn so a regression surfaces without a profiler.

Functions§

latency_slo
Time each request, attach x-response-time-ms, and warn past the SLO budget.
request_id
Mint (or honor a client-supplied) request id, stash it in extensions for handlers, and echo it on the response.