Expand description
Axum wiring: routes, request/response shapes, and observe-mode trace construction (SPEC §7.1, §7.1a — forward unchanged, record asynchronously, zero added latency).
Structs§
- AppState
- Shared state handed to every request handler. Cheap to clone: an
Arced config, a pooled HTTP client, and a bounded channel sender.
Functions§
- app
- Build the axum router:
POST /v1/messages,GET /v1/capabilities,GET /healthz,GET /metrics. - build_
experiment_ log - Build the shared experiment-log backend from
[route.challenger] redis_url. - build_
paired_ ledger - The paired-challenger spend ledger, seeded with today’s spend from the persisted pairs.
- build_
promoter_ async - build_
tenant_ rate_ limiter - build_
verified_ cache - parse_
openai_ request - Parse an OpenAI Chat Completions request body into the normalized
ModelRequest. - tenant_
rate_ limit_ middleware - Axum middleware (ADR 0004 §D6): enforce the per-tenant request rate limit. Must run AFTER
auth_middlewareso the resolvedTenantIdis already in request extensions. A no-op (never returns 429) whenAppState::tenant_rate_limiterisNone.