Monitoring & Alerting
LLM Proxy exposes health and traffic data through its API so you can build dashboards and alerts on top of them.
Health
| Endpoint | Use |
|---|---|
GET /api/health | Full snapshot of database and Redis status; always returns HTTP 200 |
GET /api/health/ready | Returns 503 when not ready; use for load balancer and orchestrator readiness probes |
GET /api/health/live | Always returns 200; use for liveness probes |
curl -s http://localhost:8080/api/health/ready | jq .Traffic and reliability
| Signal | Where |
|---|---|
| Requests, cost, tokens, success rate | GET /api/logs/usage-stats or the Usage dashboard |
| Average response time, average TTFT, tokens/second, cache savings | Same response (summary) |
| Provider/model breakdown, daily series | by_provider, by_model, daily_usage |
| Error rate by status | GET /api/logs?status_code=… or status_code_from/status_code_to |
| Retries and fallbacks | Log metadata: retry_count, fallback_count, fallback_providers |
| Circuit breaker state | GET /api/config/circuit-breaker (admin), with reset endpoints |
| Latest log timestamp and total count (lightweight, for polling) | GET /api/logs/stats |
| Client disconnects | Logs with status 499 |
Usage buckets are always UTC days and hours regardless of server timezone: a start_date without an offset selects a UTC day, and daily_usage keys are UTC dates. Pass a full ISO timestamp with an offset to query a local day.
::: note Averages, not percentiles Latency and throughput are reported as averages; there are no p50/p95/p99 endpoints. To compute percentiles, export request logs (GET /api/logs, cursor pagination, up to 200 per page) into your own store. :::
What to alert on
| Condition | Why |
|---|---|
/api/health/ready != 200 | Database is down, or Redis is enabled and unhealthy |
| Status 5xx trending up | Provider failures, timeouts, or configuration errors (502 = upstream/parse error, 504 = timeout) |
fallback_count > 0 repeatedly | A preferred provider is degraded |
| Circuit breaker trips | Provider outage; the proxy is already routing around it |
| 499s trending up | Clients or CDNs are timing out; check keepalive settings and CDN timeouts |
429 budget_exceeded | A client hit its cap (expected limit or runaway loop) |
429 too_many_auth_failures | Bad key deployed, or probing traffic |
| Audit chain verification fails | Tampering or corruption; investigate immediately |
# 5xx in the last hour
curl -s "http://localhost:8080/api/logs?status_code_from=500&status_code_to=599&page_size=200" \
-H "Authorization: Bearer $ADMIN_JWT" | jq '.items | length'
# Audit integrity (admin)
curl -s "http://localhost:8080/api/logs/audit/verify-integrity" \
-H "Authorization: Bearer $ADMIN_JWT" | jq '{valid, verified_count, errors}'External systems
| System | Integration |
|---|---|
| Langfuse | Per-user tracing (Account → Preferences → Tracing). One observation per request with type-specific input/output (chat messages, embeddings, rerank queries/rankings, image prompts/URLs, audio inputs/outputs), plus usage, cost, and user/session IDs |
| OpenTelemetry (OTLP) | Per-user tracing to any OTLP collector over HTTP/protobuf or gRPC. One CLIENT span per request with GenAI semantic convention attributes, input/output payloads, and llm_proxy.* metadata. See Logs, Usage & Tracing |
| LangSmith | Per-user tracing to LangSmith's OTLP/HTTP gateway. Same span structure, plus gen_ai.system, flattened message attributes, and langsmith.* run correlation |
| Log aggregation | The proxy does not push logs to external sinks (Redis log shipping is not implemented). Pull from GET /api/logs or collect application stdout |
| Application logs | LOG_LEVEL (startup), --log-file, container stdout |
To correlate traces, send x-langfuse-trace-id (or x-trace-id) on a request so Langfuse uses it as the trace ID. Responses return a trace ID header, and both headers are CORS-exposed for browser clients.
Operational hygiene
- Logs default to 30 days of retention; audit logs and usage records share the same window. Adjust this in Settings → Log Management, or clean up manually with
DELETE /api/logs/cleanup?older_than_days=N(admin-only; omitting the parameter applies the configured retention window, and both request logs and usage records are pruned). Adddelete_all=trueto wipe both tables regardless of age. Batch files and job rows use their own Batch Retention Period (default 30 days) and are not affected by manual log cleanup. - Keep
sampling_rateat1.0while investigating issues; lower it to reduce storage without losing metadata. - Usage and logs are stored in the database; see Upgrades & Backups.
- If you see dropped-record warnings in application logs, increase
LOG_WRITE_QUEUE_SIZEorUSAGE_WRITE_QUEUE_SIZEand restart.