caelum0x ab9e54a189 feat(relay): per-key trace view and OD-RY2 trace retention (RY-RL3)
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>
2026-09-29 02:12:42 +03:00
..

TensorZero UI

The TensorZero UI provides a web interface to help manage your TensorZero deployments. The UI provides functionality for observability, optimization, and more.

Running the UI

The easiest way to run the UI is to use the tensorzero/ui Docker image. See the Quick Start and the TensorZero UI Deployment Guide for more information.

Development Setup

Follow the instructions from CONTRIBUTING.md to set up your development environment.

Things to note

  1. To test optimization workflows without real provider APIs, spin up the mock-provider-api and set TENSORZERO_INTERNAL_MOCK_PROVIDER_API=http://localhost:3030 when running the gateway.
  2. For any new code, prefer undefined over null. The only place to use null is for napi-rs compatibility, because it uses null to represent an Option<T>. Never write a type as T | undefined | null.