Observability Stack for LLM Apps: Logs, Traces, and Evals — professional topic visual

Observability Stack for LLM Apps: Logs, Traces, and Evals

An LLM observability stack lets you answer one question quickly for any single request: what did the model see, what did it do, and was the result any good? Conventional monitoring tells you the service returned 200 in 1.4 seconds. It cannot tell you that the answer cited the wrong policy, that retrieval returned nothing, or that a prompt edit made replies 30% longer. Those are the failures LLM apps actually have.

This post lays out a stack in four layers, the exact fields worth capturing, what to sample and for how long, how to keep it from becoming a privacy liability, and which alerts earn a page. It is the app-level view; for autonomous loops with many steps, pair it with the agent observability stack, and for the deployment context see the LLMOps production guide.

Four layers, four different questions

LayerQuestion it answersTypical signalRetention
1. Service metricsIs it up, fast, and affordable?Request rate, error rate, TTFT, ITL, tokens, cost13+ months, aggregated
2. TracesWhat happened in this request?Spans for retrieval, model calls, tool calls, guardrails14–30 days, sampled
3. Content logsWhat exactly was said?Prompts, completions, retrieved chunks (redacted)7–30 days, tightly sampled
4. Quality scoresWas it good?Judge scores, user feedback, schema validity, citation checksAggregates long, examples short

Most teams build layer 1 on day one because it reuses existing tooling, layer 2 after their first mysterious bug, and layers 3 and 4 only after a customer complaint. Reverse that if you can: layer 4 is the only one that tells you whether the product works.

A reference pipeline

Instrument with OpenTelemetry so you are not locked to a vendor. The OpenTelemetry community maintains semantic conventions for generative AI, including attribute names for model, token usage, and operation type; adopting them means a trace from your app and one from a framework look the same. Send spans to a collector, fan out to a trace store, derive metrics from spans, and write redacted content to a separate store with its own access controls.

  1. App and gateway emit spans and structured logs with the same trace ID.
  2. Collector applies sampling rules and strips fields marked sensitive before data leaves your network.
  3. Trace store and metrics backend hold spans (short term) and derived series (long term).
  4. Content store keeps redacted prompts and completions, encrypted, with per-role access.
  5. Eval workers pull a sample of finished traces, score them, and write scores back as attributes so quality is queryable next to latency.

What one generation span should carry

FieldWhy you will want it
trace_id, parent span, request_idJoin model calls to the user request and to tool spans
model name and exact snapshotAliases move; you need to know which weights answered
prompt template ID and version, index build IDThe answer to “what changed on Thursday?”
input, cached-input, output, reasoning token countsCost and latency analysis; see LLM cost attribution
temperature, max_tokens, finish_reasonTruncation (length) is a classic silent failure
TTFT and total durationSeparate waiting from generating
tenant and feature tagsSlice every chart by who and what
retrieval doc IDs and scores (RAG apps)Debug grounding without storing full text
guardrail verdicts, refusal flag, validation errorsSpot policy and format regressions
quality scores and user feedback (added later)Quality next to latency, same query

Sampling and retention that you can defend

  • Keep 100% of metadata (the span without bodies). It is small and makes every aggregate trustworthy.
  • Keep 100% of failures: errors, timeouts, guardrail blocks, schema failures, thumbs-down, and any request with a score under your threshold.
  • Sample 2–10% of content from healthy traffic; raise it to 100% for a release’s first hour, a new tenant’s first day, or a route under investigation.
  • Short content retention (7–30 days) with legal hold as an explicit, audited exception. Long retention of user text is rarely worth the liability.
  • Tail-based trace sampling at the collector so you decide after seeing the whole trace whether it was interesting.

Redact before storage, not at query time. Apply the PII patterns from your policy at the collector, and treat the content store as the most sensitive system you run. Retrieval documents are not exempt: a chunk can contain someone’s email address even if the user never typed one.

Five dashboards, not fifty

  1. Golden signals by route: request rate, error rate, TTFT p50/p95/p99, ITL, and tokens per request.
  2. Cost: spend per hour, cost per successful task, cache hit rate, top ten tenants by spend.
  3. Quality: daily average judge score, schema-valid rate, citation-valid rate, thumbs-down rate, split by release.
  4. Retrieval: empty-result rate, top score distribution, fraction of answers citing a retrieved chunk.
  5. Release comparison: any metric above for the last two prompt/model/index versions, side by side.

Alerts that earn a page

Alert on user-visible symptoms and on burn rate of your objectives, not on raw counters. Examples, using the same objective style as agent SLAs:

AlertConditionSeverity
Fast error burn5xx + timeout rate > 5% for 5 minutesPage
Slow first tokenp95 TTFT > 2× objective for 10 minutesPage
Quality dropJudge score or schema-valid rate down > 8% vs 7-day median over 1 hour on ≥ 200 samplesPage during business hours
Cost spikeSpend rate > 3× trailing 24-hour median for 30 minutesPage
Cache hit-rate slumpDown 20 points vs 7-day medianTicket
Empty retrieval> 10% of RAG requests return no chunksTicket, page if rising

When one of these fires, the next step should be a documented runbook, not improvisation; the incident response guide gives a structure. Quality alerts need minimum sample sizes. A judge score computed from twelve conversations is noise, and false pages train people to ignore the real ones.

Online evals: scoring production without drowning in cost

Sample 1–5% of completed traces, score them with a rubric-based judge model plus deterministic checks (valid JSON, citations resolve to retrieved IDs, banned phrases absent), and write scores back to the trace. Budget the judge: scoring 5% of 2 million monthly requests at roughly 1,500 tokens each with a small model is on the order of 150 million tokens, which is tens of dollars to a few hundred, small next to the main bill. Calibrate the judge against a human-labeled set quarterly; the offline side of the same loop is covered in agent evals in CI.

Ways the observability stack itself goes wrong

  • Exporting inside the request path. Synchronous span export adds latency to every call and can take the app down when the backend is slow. Batch and export asynchronously, and drop data before dropping requests.
  • High-cardinality labels on metrics. Putting user IDs or raw prompt hashes on a Prometheus series can multiply storage by orders of magnitude. Keep tenant and feature on metrics; keep IDs on traces.
  • Broken trace context across queues. If a background worker or a retry job starts a fresh trace, the story of one request splits in two. Propagate the trace ID in message metadata.
  • A judge that drifts. If the evaluation model is an alias that updates, your quality line can move without your product changing. Pin it and keep a frozen reference set to detect judge drift.
  • Dashboards nobody opens. If a panel is not tied to an alert or a release check, delete it. Fewer, trusted charts beat a wall of them.

Build, buy, or mix

  • Hosted LLM observability products get you prompt viewers, dataset tooling, and eval integrations quickly. Check data residency, redaction hooks, and export options before signing.
  • Open-source tools cost engineering time but keep data in your VPC.
  • Existing APM already holds layer 1 and often layer 2. Many teams stay there for service metrics and add a specialist tool only for prompt viewing and evals.

Whichever you choose, insist on OpenTelemetry-compatible ingestion and a raw export. The cost of switching tools is the cost of re-instrumenting your code.

A three-week rollout

  1. Week 1: wrap every model and tool call in a span with the fields above; ship golden-signal and cost dashboards; tag tenants and features.
  2. Week 2: add redaction at the collector, failure-biased sampling, and a content store with access controls; write the first two runbooks. Tool-level detail is the subject of tracing LLM tool calls.
  3. Week 3: turn on online scoring for the highest-risk route, set the quality and cost alerts, and add release comparison to your deploy checklist alongside canary prompts.

FAQ

What is LLM observability?

It is the practice of capturing metrics, traces, content logs, and quality scores for LLM applications so you can see what the model received, what it produced, and whether the output was correct, not just whether the service responded.

How is LLM observability different from regular APM?

APM tracks latency, errors, and resource use. LLM observability adds prompt and completion content, token and cost accounting, retrieval and tool spans, and quality evaluation, because most LLM failures return a successful status code with a wrong answer.

Should I log full prompts and responses?

Log them only with redaction, tight access control, and short retention, and sample healthy traffic rather than keeping everything. Keep full metadata for all requests and full content for failures and low-scoring traces.

What metrics should I alert on for an LLM app?

Alert on error and timeout rate, time to first token, cost burn rate, and a quality indicator such as schema-valid rate or judge score with a minimum sample size. Treat cache hit rate and empty-retrieval rate as early-warning tickets.

Do I need OpenTelemetry for LLM tracing?

It is not required, but it is the safest choice. OpenTelemetry has generative AI semantic conventions and broad vendor support, so you can change backends without re-instrumenting your application.

Related reading

About Mudasir Syed

Check Also

AI Agent Evaluation and Observability Guide — professional topic visual

AI Agent Evaluation and Observability Guide

AI agent evaluation: practical guide with definitions, implementation checklist, security notes, and internal links across the agentic stack.

Leave a Reply