LLM Observability Guide: How to Monitor Quality, Cost, Latency, and Failures
LLM observabilityAI monitoringproduction AItelemetryapplication reliability

LLM Observability Guide: How to Monitor Quality, Cost, Latency, and Failures

PPrompt Forge Editorial Team
2026-12-04
8 min read

Learn how to monitor LLM applications with practical methods for tracking quality, cost, latency, retrieval, tools, safety, and failures.

Monitoring an LLM application requires more than recording API errors. This guide presents a repeatable observability workflow for tracking quality, cost, latency, retrieval behavior, tool calls, safety events, and user feedback so your team can identify failures, estimate operating impact, and make informed changes after each deployment or model revision.

Overview

LLM observability is the practice of collecting enough operational and quality data to explain what an AI application did, why it behaved that way, and whether the result was useful. Traditional application monitoring still matters, but an LLM request can fail in less obvious ways: the API may return a successful response containing an unsupported claim, a retrieval step may select irrelevant context, or a tool call may complete with an incorrect argument.

A practical monitoring design combines four layers:

  • Logs: Structured records of requests, responses, errors, model settings, token usage, and application decisions.
  • Traces: A timeline connecting the user request to prompt construction, retrieval, model calls, tool calls, validation, retries, and the final response.
  • Evaluations: Automated or sampled tests that measure correctness, relevance, citation behavior, format compliance, and other task-specific criteria.
  • Human review: Feedback from users, support teams, domain experts, or quality reviewers who can identify problems automated checks miss.

Use logs to answer what happened, traces to answer where it happened, evaluations to assess whether it was acceptable, and human review to validate that your measurements reflect real user needs. An LLM monitoring tool can collect some or all of these signals, but the monitoring model should be defined before choosing a platform.

The core signals to monitor

  • Quality: Evaluation scores, validation failures, user ratings, escalation rates, unsupported-answer flags, and task completion.
  • Cost: Input tokens, output tokens, cached or reused context where applicable, requests by model, tool-use costs, and cost per successful task.
  • Latency: Total request duration, time to first token for streaming experiences, model duration, retrieval duration, tool duration, and retry time.
  • Reliability: Provider errors, timeouts, rate-limit responses, malformed outputs, failed retries, and incomplete workflows.
  • Retrieval: Query text or a privacy-safe identifier, number of retrieved items, scores or ranks when available, filtering results, empty retrievals, and citation coverage.
  • Safety and governance: Policy-trigger events, sensitive-data detection, blocked requests, permission failures, and access to protected tools or data.

How to estimate

Start with a request-level event model. Every user interaction should receive a correlation ID, and each operation within that interaction should receive a span or child event. A simple flow might be:

  1. Accept the request and record a privacy-safe user or session identifier.
  2. Build the prompt and record the prompt version, system-instruction version, and relevant feature flags.
  3. Run retrieval, if used, and record retrieval duration, result count, filters, and a reference to the selected documents.
  4. Call the model and record the model identifier, response status, token usage, finish reason, and duration.
  5. Run tools or external actions and record tool name, validated arguments, result status, duration, and retry count.
  6. Validate the output for schema, citations, policy requirements, and task-specific rules.
  7. Store feedback and evaluation results against the same correlation ID.

For cost estimation, calculate each model call separately and then add other billable or operational components. The general formula is:

Model cost = (input tokens ÷ provider unit) × input rate + (output tokens ÷ provider unit) × output rate

If a workflow makes several model calls, sum the calls rather than estimating only the final response. A more useful planning measure is:

Cost per successful task = total workflow cost ÷ number of tasks that meet the acceptance criteria

This measure exposes hidden costs from retries, failed tool calls, repeated retrieval, and responses that users must regenerate. Keep provider rates outside application code where possible. Store the rate card version and currency with the estimate so a later review can distinguish a traffic change from a pricing-input change.

For latency, collect distributions rather than only averages. Track median, upper-percentile, and maximum duration for the complete request and its major spans. The exact alert level depends on the product experience, but a sudden change from your established baseline is usually more actionable than a generic threshold. Separate queue time, retrieval time, model time, tool time, and post-processing time to identify the responsible component.

For quality, create a small evaluation set representing real tasks and known edge cases. Measure the dimensions that matter for the application: groundedness for a RAG workflow, valid JSON for a structured extraction workflow, correct tool selection for an agent, or factual review for a content workflow. Run the set before and after prompt, model, retrieval, or parser changes. Sample production traffic as well, because test cases rarely represent every input pattern.

Inputs and assumptions

Your estimates are only as reliable as the inputs behind them. Define these values explicitly in a worksheet or configuration file:

InputWhat to recordWhy it matters
TrafficRequests per day, peak concurrency, and expected growthDetermines capacity, rate-limit exposure, and monthly volume.
Workflow shapeAverage model calls, retrieval calls, tool calls, and retries per requestA single user action may create several billable or failure-prone operations.
Token distributionInput and output tokens by workflow, preferably with percentilesAverages can hide long prompts and unusually large responses.
Provider inputsModel identifier, current input and output rates, limits, and telemetry fieldsPricing and available usage fields can change, so preserve the source and date.
Quality targetAcceptance rules and minimum evaluation scorePrevents cost optimization from rewarding unusable answers.
Reliability baselineError, timeout, validation-failure, and retry ratesShows whether a change improves the whole workflow rather than only response time.
Privacy policyAllowed prompt content, retention period, redaction rules, and access controlsObservability data can contain the same sensitive material as the application.

A useful event schema might include:

{
  "trace_id": "generated-correlation-id",
  "span_id": "generated-operation-id",
  "timestamp": "event-time",
  "environment": "production",
  "workflow": "support-answer",
  "prompt_version": "version-reference",
  "model": "model-reference",
  "operation": "retrieval|generation|tool|validation",
  "input_tokens": 0,
  "output_tokens": 0,
  "duration_ms": 0,
  "status": "success|error|timeout|blocked",
  "retry_count": 0,
  "retrieval_count": 0,
  "tool_name": null,
  "validation_result": "pass|fail|not-run",
  "evaluation_score": null,
  "feedback": null,
  "redaction_status": "applied"
}

Do not treat this as a requirement to store raw prompts and responses indefinitely. Use redaction, access controls, sampling, hashing, or references to protected storage according to your data requirements. The event should make a request diagnosable without exposing more content than necessary.

Create separate views for operations and quality. An operations dashboard can show request volume, error rate, timeout rate, latency percentiles, token volume, estimated cost, and retry rate. A quality dashboard can show evaluation results by prompt version and model, validation failures, user feedback, retrieval-empty rate, citation or grounding checks, and escalations. Segment both dashboards by workflow, model, release, region, and customer tier when those dimensions are relevant.

Metric-to-symptom troubleshooting

Observed symptomSignals to inspectLikely investigation path
Responses became slowLatency percentiles, queue time, retrieval duration, output tokens, retriesFind the span that changed; check traffic, context length, provider responses, and retry behavior.
Costs increased without equivalent traffic growthTokens per request, model mix, tool calls, retries, regeneration rateCompare workflow shape and token distributions with the previous release.
Answers are less relevantEvaluation scores, retrieval ranks, empty retrievals, prompt version, user feedbackSeparate retrieval degradation from prompt or model behavior.
Agent actions failTool selection, argument validation, permission errors, tool duration, retriesInspect the complete trace and distinguish model choice from tool implementation failure.
Structured output breaksSchema-validation failures, finish reason, output length, parser errorsCheck truncation, prompt changes, schema complexity, and repair loops.
Users report unsafe or unsupported answersSafety events, citations, evaluator flags, feedback, retrieval sourcesReview the specific trace, preserve the incident context, and add a regression case.

Worked examples

Example 1: Estimating a multi-step workflow

Assume a support-answer workflow handles 10,000 requests in a planning period. Each request normally makes one retrieval operation and one model call. Five percent of requests make a second model call for repair or clarification. Use hypothetical token and rate inputs for the estimate: 2,400 input tokens and 500 output tokens for the normal call, 1,000 input tokens and 250 output tokens for the repair call, and provider rates represented by the variables Rin and Rout.

Normal model usage is 10,000 × 2,400 input tokens and 10,000 × 500 output tokens. Repair usage is 500 × 1,000 input tokens and 500 × 250 output tokens. The total estimate is therefore:

Total cost = (24,000,000 ÷ provider unit × Rin) + (5,000,000 ÷ provider unit × Rout) + (500,000 ÷ provider unit × Rin) + (125,000 ÷ provider unit × Rout)

Keep retrieval, storage, monitoring, and other service costs as separate line items unless your provider pricing combines them. If evaluation runs repeat the workflow, estimate them separately so production cost is not confused with test cost. Finally, divide the total by the number of successful answers, not merely the number of requests, when comparing architectures.

Example 2: Diagnosing a quality decline

Suppose a release shows stable request volume but a lower groundedness evaluation score. The first step is not to change the model immediately. Compare the release with the previous version across prompt version, retrieved-document count, empty-retrieval rate, filter behavior, citation validation, output length, and retry rate. If retrieval counts fell while prompt and model identifiers stayed constant, investigate indexing, filters, or query construction. If retrieval is stable but validation failures increased after a prompt change, add the failed examples to the regression set and test the prompt independently.

This trace-based approach avoids treating every quality problem as a model problem. It also creates a repeatable incident record that can be reviewed after the fix.

When to recalculate

Revisit your LLM observability setup whenever an input that affects behavior, cost, or reliability changes. At minimum, recalculate after:

  • A model, provider, tokenizer, context limit, output limit, or API version changes.
  • Provider pricing, included usage, rate limits, or telemetry fields change.
  • A prompt, system instruction, response schema, retrieval strategy, chunking method, or tool definition changes.
  • Traffic volume, peak concurrency, average context length, or user mix changes.
  • Retries, fallbacks, model routing, caching, batching, or streaming are introduced.
  • A production incident reveals a missing event, unsafe data exposure, or unmeasured failure mode.
  • Evaluation results or user feedback show that the current acceptance criteria no longer match the product.

Use a deployment checklist to make recalculation routine:

  1. Record the change, owner, date, and affected workflow.
  2. Update provider rates, limits, and telemetry mappings from the current documentation or account data.
  3. Run the regression evaluation set and compare quality, latency, token usage, validation, and failure metrics with the prior baseline.
  4. Replay representative traces with redacted production examples when appropriate.
  5. Estimate cost using normal, high-usage, and retry-heavy scenarios.
  6. Set or review alerts based on the new baseline, with separate alerts for operational failure and quality degradation.
  7. Confirm that sensitive fields remain redacted and that access to traces is limited to the people who need it.

The goal is not to collect every possible field. It is to connect each important user outcome to enough evidence for diagnosis. Start with one workflow, define its acceptance criteria, instrument the complete trace, and add metrics only when they help explain a decision. Recalculate the model after meaningful changes, preserve the assumptions behind each estimate, and treat production feedback as a continuous input to your evaluation set.

Related Topics

#LLM observability#AI monitoring#production AI#telemetry#application reliability
P

Prompt Forge Editorial Team

AI Development Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.