Show notes
Why uptime is not health, and why tracing comes first#
An AI endpoint can return HTTP 200 while latency doubles, output quality drops, tool calls fail, or the wrong model is selected for a tenant. Availability alone tells you very little.
Start with the request journey. Capture a correlation ID that follows the request from the application through the gateway, the provider route, the response, the billing record and the user-visible result. Without a single trace identifier, operators are left guessing whether a slow response came from the client, the gateway, the provider, a queue or a retry.
Streaming and asynchronous work need extra care. Record when a request enters a queue, when a provider accepts it, when the first token arrives, when the result is persisted and when the user receives it. For background jobs, link retries and callbacks back to the original trace instead of creating unrelated records.
The metrics that matter#
Measure more than latency:
- Time to first token and total response time
- Tokens per second, input tokens and output tokens
- Payload size and queue delay
- Retry count, timeout rate and cancellation rate
Streaming applications need both time to first token and time to completion, because a fast first token can hide a response that takes far too long to finish.
Then break the numbers down by route. Aggregates can look normal while one model, region, customer tier or feature is failing. Useful dimensions include model, provider, endpoint type, region, status class, application and, where allowed, tenant policy. Keep cardinality under control with stable labels, and put request-specific details in traces rather than metric labels.
Silent quality failures and failure attribution#
A response can be valid JSON and still be unusable. Monitor schema validation, tool-call completion, citation presence, refusal rates, empty outputs, language mismatches and task-specific evaluation scores. For important workflows, sample completed requests for offline review instead of treating availability as a proxy for quality.
Also separate provider failure from application failure. Record the selected route, the fallback decision, the upstream status, a normalized error code and whether the request was retried. That lets a team quickly answer the practical question: did the provider fail, or did our own timeout, payload transformation, authentication or rate-limit policy cause it?
Without that split, every incident turns into a debate about whose fault it was instead of a fast decision about what to fix.
Treat cost as a first-class signal#
Track spend by model, feature, tenant, route and successful outcome. A cheaper model that needs three retries can cost more than a reliable one, which is why cost per successful task is a better signal than raw spend.
Alert on sudden changes in token usage, unusually large prompts, duplicate requests and shifts in cost per successful task, not only on total daily spend. Routing everything through a single OpenAI-compatible gateway such as Crazyrouter can make route and model data easier to collect in one place, but the attribution still has to be designed into your own telemetry.
Alerts, synthetic checks and dashboards#
Build alerts around user impact: error-budget burn, time to first token, failed tool calls, queue age, schema failures and cost anomalies. Avoid paging on every transient provider error. A good alert names the affected route, the likely cause, the current fallback, sample request IDs and a link to the relevant trace or dashboard.
Use synthetic checks carefully. A scheduled request confirms that authentication, routing and a basic model response work. It cannot prove that production prompts, tools, large contexts, regional policies or billing reconciliation work. Keep a small set of synthetic scenarios that represent the real product, and label their spend clearly.
Design dashboards for decisions. The first view should show availability, latency, quality signals, spend, provider health and fallback volume; the next should compare by model and region. Operators should be able to move from an aggregate anomaly to a handful of representative request IDs without digging through raw logs.
Protect telemetry and test it under fire#
Observability is part of the security boundary, not an exception to it. Keep full prompts, completions, API keys and customer documents out of ordinary logs. Redact secrets, hash or tokenize identifiers, sample payloads selectively and apply tenant-scoped access.
Finally, test observability before a real incident does. Deliberately expire a test credential, force a provider timeout, send an invalid tool schema and route a workload to a fallback. Confirm that the right metric moves, the alert fires, the trace is complete and the support view has enough evidence without exposing customer content.
