Observability for AI Apps: Traces, Costs, Hallucinations, and Feedback Loops
Your APM says the system is up while the model lies, loops, and quietly drifts. Here's the observability stack we actually run for production LLM apps.
Standard APM tells you an AI app is up but not whether it's correct or affordable, so trace every LLM call, track cost in real time, detect hallucinations with stacked signals, and alert only on what matters.
A web app that returns 200 OK is probably fine. An LLM app that returns 200 OK might be confidently lying to your users, looping itself into a $5,000 bill, or quietly degrading because OpenAI shipped a new model checkpoint last night. Your APM has no opinion on any of that. Datadog and New Relic tell you the system is up. They cannot tell you the system is correct, and for AI products correctness is the whole game.
Why your APM goes silent exactly when it matters
Traditional monitoring tracks latency, error rates, resource use, and status codes. All necessary. None sufficient. The failures that actually hurt an LLM product are invisible to that stack.
The question changes. Web monitoring answers "is it up?" AI monitoring has to answer "is it producing correct output at a cost we can live with?" Everything below is how we build the second one.
Trace every call, or you're debugging blind
Treat each LLM interaction like a distributed trace. For every call we log the timestamp, the full prompt (system plus user), the model and parameters, the full completion, input and output tokens, time-to-first-token, total latency, computed cost, and any error. For RAG chains we also capture the query embedding, the retrieved documents, the relevance scores, and any rerank step.
Each step becomes a span, so the whole chain renders as one trace. When an answer is wrong, you can walk it backward: bad answer, bad context, bad retrieval, bad embedding. That diagnosis is essentially impossible from plain logs. LangSmith, W&B, or a custom UI all work for the visualization. The capture discipline matters more than the tool.
Cost monitoring that catches the loop before the invoice
Most teams check spend once a month in the provider dashboard. By then the damage is done. We track cost in real time, sliced four ways: per user (who is expensive), per feature (what is expensive), per endpoint (is RAG pricier than chat), and per hour (when do things spike). A flat monthly total hides every problem worth catching.
This is not theoretical. One client had a user trip an infinite loop. The cost monitor flagged it inside ten minutes: that account had burned $47 in an hour against a normal $0.50 a day. We rate-limited them, dug into the logs, and saved roughly $1,100 of overnight spend. Once you measure spend this way, the optimizations are obvious: cache identical queries, route simple work to a cheaper model, trim dead tokens from prompts, batch where you can, and put hard per-user daily caps in place. You can't optimize what you never measured.
Detecting hallucinations is imperfect, and worth doing anyway
Three shapes show up. Factual ("Python was invented in 1995", it was 1991). Contradictory (the model says London then says Paris in the same answer). Contextual (RAG hands it document A, the model cites a document B that doesn't exist). None of them throw an error.
No single check catches them, so we stack signals. Ask the model to score its own confidence and flag the low ones. Validate citations against the documents actually retrieved. Run consistency checks by asking the same question more than once and comparing. Verify hard factual claims against trusted external sources. And lean on users, who are your best detectors. When something trips, flag it for human review, add a caveat to the answer, offer a verified-search fallback, and save it as a negative example for evals. Catching 80% beats catching 0%, and that's the realistic target.
User feedback: the explicit signal is loud, the implicit signal is honest
Thumbs up/down is the obvious one, and when someone votes down we ask why. For high-stakes flows a 1-5 scale gives more resolution. But the strongest signal is implicit, because the user never had to do anything for it: regenerating a response means it missed, editing the response means it was close but wrong, closing the chat fast means it was bad, and copying the response usually means it landed.
Roll those into one satisfaction score and feed it back: bad responses become eval cases and training signal, recurring patterns drive prompt changes, and feature flags let you roll back anything that drops the number. Our working targets, thumbs-up above 70%, thumbs-down under 15%, regeneration under 10%, satisfaction above 0.7, and we alert when any of them slides more than 10% week over week.
Build two dashboards, because leadership doesn't read p95
Engineers need latency percentiles, token usage, error and cache-hit rates, and per-prompt-version performance. Stakeholders need none of that. They need cost per user, cost trend, user satisfaction, feature usage, quality score, and support-ticket reduction. Same underlying data, different framing.
The translation is the whole job. "Prompt tokens down 12%" becomes "cost per user down 20%." "P95 latency 1.2s" becomes "95% of answers in under 1.2 seconds." "Hallucination rate 2.3%" becomes "answer accuracy 97.7%." Say it in the language of the person reading it and the metric suddenly means something to them.
Alert on what pages you, log the rest
Three tiers, and discipline about which is which. Page oncall for: error rate over 5%, cost over 3x baseline (loop or abuse, capable of burning the budget in hours), or quality dropping more than 20%. Slack or email for: quality down 10-20%, cost up 50-100%, p95 over 5s, or satisfaction under 70%. Dashboard-only for cache-hit shifts, feature-usage changes, and model-mix changes.
The fastest way to make alerts useless is to send too many. Aggregate duplicates, cap to once per hour, tune thresholds against real false-positive rates, and auto-clear when metrics recover. Every alert that pages a human needs a runbook attached, or you're just waking someone up to improvise at 3am.
What we actually reach for
Don't build this from scratch. LangSmith is our default for tracing and evals, strong trace UI, dataset management, human-eval tooling, roughly $50-200/mo. Helicone is a lightweight proxy with cost tracking and caching baked in, open source, with a free tier. W&B Prompts is good if you're already living in that ecosystem. Braintrust covers eval-heavy workflows with CI/CD hooks, and Arize is the enterprise drift-and-explainability play.
Budget runs roughly $100-300/mo for LangSmith plus Grafana, $200-500/mo if you DIY (infra plus the dev time, which is the real cost), and $1,000-5,000/mo for a full enterprise stack. It pays for itself the first time it catches a loop or a quality regression before your users, or your invoice, do. Until you've instrumented it, you're flying blind.
We help teams design and ship production-grade software in eLearning, fintech, and AI. Let's talk about your project.
Book a call