Expand description
Reusable axum middleware that emits TelemetryEvent::ApiError on
every HTTP response with status >= 400. Mounts on any axum
router an agent crate exposes (status-server dashboard, MCP HTTP
front-end, etc.).
Agent-side events omit operator_principal — agent dashboards
are typically loopback-bound and not authenticated as operators.
Orchestrators emitting the mirror event populate the principal
field from their own auth layer.
Structs§
- ApiError
Telemetry - Bundle the emitter and a reusable
TelemetryContextso the middleware can build the event without per-request context lookups. Status-server-style routes are non-task-scoped, so the context’sjob_id/round/phaseareNone.
Functions§
- api_
error_ telemetry_ middleware - Middleware entry point. Mount via
axum::middleware::from_fn_with_state. The state is aOption<Arc<ApiErrorTelemetry>>so callers can passNoneto disable the layer at config time without a separate router shape.