Traditional software either works or crashes. AI software can be "up" and still be wrong, slow, expensive or off-brand. That gap is why AI observability has become one of the fastest-growing search topics among teams shipping LLM features. This guide merges the advice of four industry sources (Datadog, Apache Doris, Mastra and PromptLayer) into one practical checklist.
Key takeaways
- Log every request as a trace: prompt, retrieved context, tool calls, response, latency, tokens and cost.
- Uptime is not enough. A successful response can still be a wrong one, so score quality as well.
- Link each trace to the prompt version that produced it, or you will not know which change broke quality.
- Alert on trends, redact personal data and set retention limits from day one.
What Is AI Observability?
PromptLayer defines LLM observability as collecting and analysing telemetry (traces, logs, metrics and evaluations) from applications built on large language models, so teams can understand behaviour, track down failures, control cost and spot quality drops in production. It answers questions like: Why did the assistant give that answer? Which document did it use? How much did that conversation cost? Is quality improving or slipping this week?
Traces and Spans: The Foundation
Datadog's documentation explains the core data model. Each application request becomes a trace. A trace may be a single model call, a predefined workflow or a dynamic agent run. Each trace is broken into spans, one per decision or workflow step, recording inputs, outputs, latency and errors. Apache Doris makes the same point from a debugging angle: observability must span the whole pipeline (prompt building, retrieval, model call, post-processing), because the root cause of a bad answer may sit in the prompt, the retriever or the model.
Measuring only total response time tells you the app is slow. Tracing individual steps tells you where the time goes.
What to Capture on Every Request
- The full prompt, including system instructions, model settings and conversation history.
- Retrieved context in RAG systems, and whether the model actually used it. See our RAG guide.
- Tool calls with inputs, outputs and errors, for agents.
- The raw and final response.
- Latency per step, including time to first token.
- Token counts and cost, attributed per request, per feature, per model and per user.
- The prompt template version that produced the trace.
- User feedback: thumbs up or down, edits, escalations to a human.
Metrics That Matter
| Area | What to watch | Why |
|---|---|---|
| Quality | Relevance, correctness, consistency, safety scores | Subtle failures such as vague or invented answers rarely trigger error alerts |
| Cost | Tokens in and out, cost per query and per user | Small growth in prompt size becomes a large bill at scale |
| Speed | End-to-end latency, slowest 5% of requests | Users abandon slow assistants |
| Reliability | Timeouts, refusals, provider errors | Provider downtime is a common cause of outages |
| Retrieval | Hit quality and relevance of retrieved passages | Bad retrieval cannot be fixed by a good model |
Evaluation: The Verdict on Each Trace
Mastra puts it neatly: observability gives you the record; evaluation gives you the verdict. Practical advice from the sources:
- Define "good" before launch: factual accuracy, correct tool choice, task completion, tone.
- Start with a small, hand-curated dataset of real questions with known good answers, then grow it from production traffic.
- Combine offline and online checks. Run the fixed dataset before each deploy, and score a sample of live traffic afterwards.
- Mix methods: automated scoring (including model-as-judge) plus regular human review.
- Watch trends, not single results. One failed score is noise; a falling average over a day is a signal.
Be wary of the metrics themselves: Apache Doris notes that an answer can score well and still fail the user, so keep humans in the loop. The same idea underpins our agent-building plan.
Alerts Worth Setting Up
- Daily or per-user cost above a threshold, plus token-budget overruns.
- A spike in errors, refusals or "I don't know" answers.
- Latency above target for a sustained period.
- A sustained drop in evaluation or feedback scores.
Mastra warns about alert fatigue: noisy alerts hurt adoption more than missing data. Also add rate limits and back-off to retry logic so failures do not turn into cost spikes.
Privacy and Retention
Traces contain exactly the text your users typed. Redact personal data, credentials and proprietary content before storage, set sampling and retention rules that match your compliance needs, restrict trace access by role and add guardrails against prompt injection and data leakage. Datadog's platform even scans and redacts sensitive data automatically, but whichever tool you use, decide the policy yourself.
Challenges to Expect
- Quality is subjective and many tasks have no single correct answer.
- Outputs are non-deterministic, so failures can be hard to reproduce. Storing the full trace lets you replay them.
- Detailed logs are expensive at scale, so sample intelligently.
- Most teams combine tracing, evaluation and monitoring tools; if possible choose tools that support OpenTelemetry so you can switch vendors without re-instrumenting.
Getting Started This Week
- Log prompt, response, tokens, latency and user feedback in structured form.
- Tag every log with the prompt version.
- Build a 30-question evaluation set and score it before each release.
- Review 20 random conversations every week.
- Add one cost alert and one quality alert.
You would never run a payment system without logs and alerts. An assistant that talks to your customers deserves the same care. Node-devs can add tracing, evaluation and dashboards to your existing AI features so you always know what they are doing.
References and further reading
This guide was compiled from the sources below. We compared them, kept the points they agree on and wrote the article in our own words. Check the originals for more detail.
- LLM Observability documentation (Datadog)
- LLM observability (Apache Doris)
- LLM observability platform: a complete guide for AI teams (Mastra)
- LLM observability (PromptLayer)




