Implements OSS9. New relay-traces crate reads chat/json inferences by the
GIN-indexed tensorzero::api_key_public_id tag, joined with model_inferences
for model, provider, tokens, latency, cost and finish reason.
- GET /relay/traces: caller's own traces, newest first, keyset paging,
window bounded (1-2160 h). Operator keys may use scope=all and key=.
- GET /relay/traces/{inference_id}: model calls plus stored bodies; a trace
owned by another key returns 404, same as a missing one.
- relay-traces-retention: 14 d bodies, 90 d metadata (OD-RY2 defaults, env
overridable), batched deletes against one cutoff, dry-run mode. Shipped in
the relay image; systemd service/timer in crates/relay-traces/deploy (not
installed).
- Relay UI: /observability/keys list (live refresh on the first page) and
detail page; sidebar "Key Traces".
- No new tables or migrations.
Tests: 8 unit tests; live test on a scratch copy of the inference tables
proves key isolation, operator scope, paging and window-exact retention;
UI vitest 7/7, tsc and eslint clean; cargo check -p gateway clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>