Education › Inference › Stage 7: Production inference systems

Inference SLOs and observability

Turning TTFT and ITL into SLOs, and dashboards and alerts for latency, throughput, GPU use and errors.

Advanced ~35 min read Module 14 of 15

An inference service needs the same reliability discipline as any production system, with metrics that fit how LLMs behave. This lesson turns time to first token and inter-token latency into service level indicators and objectives, shows the PromQL to measure them from engine histograms, designs burn-rate alerts, and lays out the observability stack: engine, GPU and gateway metrics, traces with the GenAI semantic conventions, and logs that do not leak prompts.

After this module you can
  • Define SLIs and SLOs for TTFT, inter-token latency, availability and correctness
  • Compute SLI ratios and percentiles from Prometheus histograms
  • Write multi-window burn-rate alerts for an inference SLO
  • Assemble metrics from the engine, DCGM and the gateway into one dashboard
  • Trace requests with GenAI attributes while protecting prompt data

From latency metrics to SLOs

A service level indicator (SLI) is a ratio of good events to all events; a service level objective (SLO) is the target for that ratio over a window; the error budget is what is left over. For LLM inference, good SLIs reflect what users feel.

SLIGood eventExample SLO
ResponsivenessTTFT under 0.5 s99% of requests over 28 days
Streaming smoothnessInter-token gaps under 50 ms99% of gaps over 28 days
AvailabilityRequest completed without a 5xx or timeout99.9% over 28 days
Quality (sampled)Passes an automated evaluation check95% of sampled requests over 7 days

Pick thresholds that sit on real histogram bucket boundaries so the ratio is exact; vLLM's default TTFT histogram has a 0.5 s bucket and its inter-token latency histogram a 50 ms one. Measure the SLO at the gateway or client where possible, and use engine histograms to explain breaches.

Keep the list short. Two latency SLOs and one availability SLO per model endpoint is plenty to start; more objectives mean more alerts and more arguments about which one matters. Revisit thresholds after a month of data: if you never come close to burning the budget, the target may be too loose to protect users; if you burn it every week, either the system or the target needs to change.

Measuring with PromQL

SLI: share of requests with TTFT under 0.5 s, over 5 minutes
promql
sum(rate(vllm:time_to_first_token_seconds_bucket{model_name="chat", le="0.5"}[5m]))
/
sum(rate(vllm:time_to_first_token_seconds_count{model_name="chat"}[5m]))
p95 TTFT and p99 inter-token latency for dashboards
promql
histogram_quantile(0.95,
  sum by (le) (rate(vllm:time_to_first_token_seconds_bucket{model_name="chat"}[5m])))

histogram_quantile(0.99,
  sum by (le) (rate(vllm:inter_token_latency_seconds_bucket{model_name="chat"}[5m])))

Record these as recording rules (for example model:ttft_good:ratio_rate5m) so alerts and dashboards read one cheap series. Engine histograms only see requests that reached the engine; requests rejected by the gateway or timed out in front of it must come from gateway metrics, which is another reason to put the availability SLI there.

Alerting on burn rate

Alert on how fast you are spending the error budget, not on single bad minutes. With a 99% TTFT SLO the budget is 1% slow requests. A burn rate of 14.4 means spending the budget 14.4 times faster than sustainable, which would exhaust 2% of a 30-day budget in an hour. The standard pattern pages on a fast burn confirmed over a short and a long window, and opens a ticket for a slow burn.

Two windows guard against two failure modes. The long window (one hour) proves the problem is sustained, so a few slow requests during a deploy do not wake anyone. The short window (five minutes) proves it is still happening, so the alert resolves quickly once the cause is fixed instead of firing for an hour afterwards. A second, slower tier, for example a burn rate of 6 over six hours, catches gradual degradation such as a growing prompt length that slowly erodes TTFT, and usually opens a ticket rather than paging.

Page when the TTFT budget burns fast (99% SLO, 1-hour and 5-minute windows)
yaml
groups:
  - name: inference-slo
    rules:
      - alert: ChatTTFTBudgetFastBurn
        expr: |
          (1 - model:ttft_good:ratio_rate1h{model_name="chat"}) > (14.4 * 0.01)
          and
          (1 - model:ttft_good:ratio_rate5m{model_name="chat"}) > (14.4 * 0.01)
        labels:
          severity: page
        annotations:
          summary: "chat TTFT error budget burning 14x too fast"
Tip

Pair every SLO alert with a runbook link that starts with the four diagnostic panels: TTFT and ITL percentiles, waiting versus running requests, KV-cache usage, and throughput. They distinguish queueing, prefill, decode and memory problems in a minute.

The observability stack

  • Engine metrics (vllm:* or equivalents): queue, running, cache usage, TTFT, inter-token latency, tokens, preemptions.
  • GPU metrics from DCGM: memory used, Tensor Core and memory activity, power, NVLink throughput and error counters.
  • Gateway metrics: request rate, status codes, rejections (429s), per-tenant token usage, upstream latency.
  • Traces with OpenTelemetry: one span per request with child spans for retrieval, tool calls and model calls, using GenAI semantic-convention attributes such as gen_ai.request.model and gen_ai.usage.input_tokens and gen_ai.usage.output_tokens.
  • Logs: request IDs, model, token counts, latency and finish reason; not raw prompts and outputs unless policy allows, and then redacted and access-controlled.

Put cost on the same dashboard: tokens per second times your cost per million tokens gives spend in near real time, and per-tenant token counters make chargeback and abuse detection possible. The Grafana lesson in the open-source track walks through building exactly this dashboard.

Hands-on practice

SLOs and alerts for your own endpoint

  1. Scrape a running vLLM server with Prometheus (and dcgm-exporter if you have it).
  2. Write recording rules for the TTFT-good ratio over 5 minutes and 1 hour using the le="0.5" bucket.
  3. Add the fast-burn alert from this lesson and test it with promtool test rules by feeding a synthetic burst of slow requests.
  4. Build a Grafana row with p95 TTFT, p99 inter-token latency, waiting versus running, and KV-cache usage.
  5. Overload the server deliberately and confirm the alert fires and the panels tell you why.
  6. Write a one-page runbook: what each panel means and the first action for each failure pattern.
Cheat sheet

Inference SLOs and observability — at a glance

Main things to focus on

  • SLIs should match what users feel: TTFT, smooth streaming, availability, quality.
  • Choose thresholds on real histogram bucket boundaries.
  • Measure SLOs at the gateway; explain breaches with engine metrics.
  • Alert on error-budget burn rate over two windows, not single spikes.
  • Combine engine, GPU, gateway metrics with GenAI-attributed traces.
  • Never log raw prompts by default; log IDs, counts and timings.

PromQL

rate(X_bucket{le="0.5"}[5m]) / rate(X_count[5m])Share of events under a threshold
histogram_quantile(0.95, sum by (le) (rate(X_bucket[5m])))Percentile from a histogram
sum(rate(vllm:generation_tokens_total[5m]))Output tokens per second
sum by (code) (rate(gateway_requests_total[5m]))Status-code mix at the gateway (name varies)

SLO arithmetic

error budget = 1 - SLO99% SLO -> 1% budget
burn rate = observed bad ratio / budget1 = exactly on budget
14.4x for 1h ~ 2% of a 30-day budgetFast-burn page threshold
6x for 6h ~ 5% of a 30-day budgetSecond page or ticket tier

GenAI trace attributes

gen_ai.request.modelModel requested
gen_ai.usage.input_tokens / output_tokensToken counts per call
gen_ai.response.finish_reasonsWhy generation stopped

Dashboard rows

SLO status + budget remainingTop row
TTFT / ITL percentilesUser experience
waiting vs running, KV usageSaturation
tokens/s, cost/hour, GPU memoryThroughput and spend

Common pitfalls

  • SLO thresholds between histogram buckets, giving misleading ratios.
  • Paging on single bad minutes instead of burn rate.
  • Only engine metrics, missing requests rejected before the engine.
  • Logging full prompts and outputs into a shared log system.
  • Dashboards with dozens of panels and no clear top row.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →