Observability and Reliability

Topics Covered

What to Measure in LLM Serving

Latency has several parts

Throughput and saturation

Errors and their kinds

Cost as an operational metric

Quality signals in operations

Golden signals adapted

Percentiles, not averages

Engine level metrics

Provider metrics for API calls

Per tenant and per feature views

Cardinality and cost of telemetry

Synthetic probes

A worked example

An LLM serving system fails in ways that ordinary web services do not. It can be up and returning answers while first tokens take ten seconds, GPU memory thrashes from preemption, or a provider silently degrades quality. This lesson covers how to observe LLM serving, the metrics, traces and logs that matter, and how to keep it reliable: service levels, capacity and overload handling, failover across models and providers, and incident response.

Latency has several parts

A single latency number hides what users feel. Time to first token measures how long a user waits before anything appears, and it is dominated by queueing and prefill. Time per output token, also called inter token latency, measures how fast the answer streams once it starts, and it is dominated by decode and batch size. End to end latency combines both with the output length. Each responds to different causes and different fixes: a long queue raises time to first token but not time per token, while an oversized batch raises time per token for everyone. Dashboards should show all three, as percentiles, not averages.

First the wait for the first token, from queue and prefill. Then the stream, paced by decode. Each has its own fix.

Throughput and saturation

Throughput is measured in requests per second and, more usefully, in input and output tokens per second, since requests vary enormously in size. Saturation signals show how close the system is to its limits: queue depth and queue wait time, running batch size, KV cache utilization, and the rate of preemptions, where the engine evicts a running request to free memory and later recomputes it. Rising preemptions are an early warning: the engine is overcommitted, and latency will degrade sharply soon. GPU utilization alone is misleading, since a GPU can report high utilization while doing little useful work under memory bound decode.

Errors and their kinds

Errors in LLM serving come in several kinds. Hard errors include timeouts, out of memory crashes, rate limit rejections from providers and malformed requests. Soft errors return a response that is technically successful but wrong in shape: invalid JSON from a structured output request, a truncated answer that hit the maximum token limit, an empty response or a refusal where none was expected. Counting soft errors explicitly, by validating outputs and recording why validation failed, catches problems that status codes miss entirely.

Every response says success. Validation finds broken JSON and truncated answers hiding among them.

Cost as an operational metric

Cost belongs on the operational dashboard, not only in monthly finance reports. Tokens per request, cost per request by feature and model, cached token share, and spend rate per hour reveal problems quickly: a prompt change that doubled input length, a retry loop that multiplies calls, an agent stuck in a tool loop, or a routing bug sending everything to the largest model. Alerts on spend rate catch runaway costs within hours instead of at the end of the month.

Quality signals in operations

Operational monitoring should include quality proxies alongside latency and errors: sampled judge scores on live traffic, explicit user feedback rates, retry and rephrase rates, and refusal rates. These move when a provider changes a model, a retrieval index goes stale or a prompt regression ships. Treating a drop in sampled quality like a latency spike, with alerts and an on call response, closes the gap between evaluation and operations.

Golden signals adapted

The classic golden signals of latency, traffic, errors and saturation still apply, with LLM specific versions: time to first token and time per output token for latency, tokens per second for traffic, hard and soft errors for errors, and KV cache utilization, queue depth and preemptions for saturation. Adding cost and quality gives six signals that together describe the health of an LLM service. Every dashboard and alert should map to one of them.

Percentiles, not averages

LLM latency distributions have long tails. A few requests with very long prompts or outputs, or requests that landed on a replica during a preemption storm, take many times longer than the median. An average blends these with the many fast requests and hides the tail, while the users who hit the tail are the ones who complain. Reporting the median, p95 and p99 of time to first token and time per output token, and breaking them down by feature, model and prompt length bucket, shows both the typical experience and the worst common experience. Normalizing end to end latency by output length, or tracking time per output token directly, avoids mistaking a feature that writes longer answers for a slower system.

Most first tokens arrive fast. A few take many times longer. Only the p99 reveals them.

Engine level metrics

Serving engines such as vLLM, SGLang and TensorRT LLM expose detailed metrics that should be scraped into the monitoring system: number of running and waiting requests, KV cache usage, prefix cache hit rate, preemptions, batch size, prompt and generation throughput, and histograms of time to first token and inter token latency as measured inside the engine. Comparing engine measured latency with client measured latency separates time spent inside the engine from time spent in the network, gateway, retrieval or client. A large gap points outside the engine; a small gap with high latency points to engine load.

Provider metrics for API calls

When calling external APIs, the provider is a black box, so client side measurement is essential. Record latency breakdowns, token counts, cached tokens, rate limit responses and errors per provider, model and region. Track rate limit headroom, the remaining requests and tokens per minute that providers report, since approaching limits causes sudden rejections at peak. Provider status pages often lag real problems, so your own error and latency metrics are the first signal of a provider incident.

Per tenant and per feature views

Aggregate dashboards can look healthy while one customer or feature suffers. A tenant sending very long prompts may see slow first tokens and exhaust shared capacity, and a single feature with a broken prompt may produce soft errors invisible in the overall rate. Breaking key metrics down by tenant, feature and model, with top consumers listed, makes these problems visible and supports fair usage policies, such as per tenant token rate limits that keep one heavy user from degrading everyone else.

Cardinality and cost of telemetry

Detailed telemetry has its own cost. Labels with many possible values, such as user identifiers, prompt hashes or document identifiers, explode the number of metric time series and can overwhelm monitoring systems. A common split puts low cardinality dimensions such as model, feature, region and status on metrics, and high cardinality details such as user, session and prompt version on traces and logs, where they can be queried without creating millions of series. Sampling traces for high volume, healthy traffic while keeping all traces for errors and slow requests controls storage costs.

Synthetic probes

Real traffic metrics only show problems when users are affected and only for paths users take. Synthetic probes send fixed test requests on a schedule, for example a short prompt and a long prompt to each model and region every minute, and record latency, errors and whether the output passes a simple check. Probes detect outages on low traffic paths, verify that fallbacks still work and give a clean baseline unaffected by changes in the traffic mix. Probe results should be tagged so they are excluded from product analytics and cost reports.

A worked example

Imagine time to first token p95 jumps from one second to six while time per output token stays flat. Flat decode speed rules out an oversized batch. Engine metrics show waiting requests climbing and KV cache usage near full, with preemptions rising. The trace view shows one tenant began sending prompts of eighty thousand tokens an hour ago. The six signals together point to a single cause in minutes: very long prefills are monopolizing capacity. The mitigation is to route that tenant to dedicated long context capacity and apply a per tenant token limit, after which queue wait returns to normal.

Measure tokens, not just requests

Requests vary from ten tokens to a hundred thousand. Throughput, cost and capacity only make sense when measured in input and output tokens per second.