You would never deploy a web application without logging, metrics, and distributed tracing. Yet most organizations deploy LLM applications with nothing more than print(response).
LLM applications are harder to observe than traditional software. Inputs and outputs are unstructured text. Quality is subjective. Failures are silent — the model doesn't throw an exception when it hallucinates, it confidently returns wrong information.
AI observability is the discipline of making LLM application behavior visible, measurable, and debuggable.
What Makes LLM Observability Different
Traditional application monitoring tracks:
- Request latency, error rates, throughput.
- Resource utilization (CPU, memory, network).
- Database query performance.
LLM applications need all of that, plus:
| Dimension | What to Track | Why It Matters | |---|---|---| | Token usage | Input/output tokens per request | Direct cost driver | | Quality | Hallucination rate, factual accuracy | Silent failures | | Prompt performance | Score per prompt version | Regression detection | | Retrieval quality | RAG precision, recall, relevance | Context affects output | | Agent traces | Multi-step reasoning paths | Debugging agentic loops | | Guardrail triggers | Blocked inputs/outputs | Security monitoring | | Model latency | TTFT, TPS, total generation time | User experience | | Cost per query | Token cost × volume | Financial governance |
The Observability Stack
Layer 1: Structured Logging
Every LLM call should emit a structured log entry:
{
"trace_id": "abc-123",
"span_id": "span-456",
"timestamp": "2026-07-15T10:30:00Z",
"model": "gpt-4o",
"prompt_version": "invoice-extraction/v1.2",
"input_tokens": 1247,
"output_tokens": 389,
"latency_ms": 2340,
"ttft_ms": 180,
"temperature": 0.1,
"cost_usd": 0.0089,
"guardrail_triggered": false,
"user_id": "user-789",
"tags": ["production", "invoice-pipeline"]
}
Layer 2: Distributed Tracing for Agents
Agentic workflows involve multiple LLM calls, tool invocations, and retrieval steps. Standard request-response tracing doesn't capture this.
Trace: Customer Support Agent (trace-id: abc-123)
│
├── Span 1: Intent Classification (LLM call)
│ ├── Model: mistral-7b
│ ├── Tokens: 120 → 15
│ ├── Result: "billing_inquiry"
│ └── Duration: 45ms
│
├── Span 2: RAG Retrieval
│ ├── Query: "billing dispute resolution process"
│ ├── Results: 5 chunks (relevance: 0.89, 0.85, 0.82, 0.71, 0.65)
│ └── Duration: 120ms
│
├── Span 3: Response Generation (LLM call)
│ ├── Model: claude-3.5-sonnet
│ ├── Tokens: 2100 → 450
│ ├── Guardrail: PII check passed
│ └── Duration: 1800ms
│
└── Span 4: Tool Call - Create Support Ticket
├── Tool: jira_create_ticket
├── Parameters: {priority: "medium", type: "billing"}
└── Duration: 340ms
Total Duration: 2305ms | Total Cost: $0.012
Layer 3: Quality Monitoring
Online evaluation — Score a sample of production responses automatically:
# Sample 5% of production responses for quality evaluation
async def quality_monitor(request, response, context):
if random.random() > 0.05:
return # Skip 95% of requests
scores = await evaluate(
input=request,
output=response,
retrieved_context=context,
metrics=["faithfulness", "relevance", "completeness"]
)
emit_metric("quality.faithfulness", scores.faithfulness)
emit_metric("quality.relevance", scores.relevance)
if scores.faithfulness < 0.7:
alert("Low faithfulness detected", trace_id=request.trace_id)
Drift detection — Monitor for distribution shifts in inputs or outputs that indicate the model's operating conditions have changed:
- Input length distribution shifting.
- New topics appearing that weren't in training/eval data.
- Output confidence scores trending downward.
Layer 4: Cost Dashboards
Track spend at multiple granularities:
- Per model: Which model is consuming the most budget?
- Per feature: Which product feature is the most expensive to operate?
- Per user: Are specific users driving disproportionate costs?
- Per prompt: Which prompt is the most token-hungry?
Daily Cost Breakdown:
├── Invoice Extraction: $45.20 (12,400 requests × $0.0036/req)
├── Customer Support Bot: $128.90 (8,200 requests × $0.0157/req)
├── Report Generation: $67.30 (340 requests × $0.198/req)
└── Total: $241.40
Monthly Projection: $7,242
Tools and Platforms
Open Source
| Tool | Strength | Best For | |---|---|---| | Langfuse | Tracing, evaluation, prompt management | Teams wanting full control | | OpenLLMetry | OpenTelemetry-native LLM instrumentation | Teams already using OTel | | Phoenix (Arize) | Trace visualization, retrieval analysis | RAG debugging |
Commercial
| Tool | Strength | Best For | |---|---|---| | LangSmith | Deep LangChain integration, hub | LangChain-native teams | | Datadog LLM Observability | Integration with existing APM | Enterprises on Datadog | | Arize AI | Production monitoring, embeddings analysis | ML-mature organizations |
Build vs. Buy
For most enterprises, the right approach is:
- Buy tracing and visualization (Langfuse or similar).
- Build custom quality evaluation pipelines (your evaluation criteria are unique).
- Integrate cost tracking with existing cloud billing dashboards.
Common Anti-Patterns
- Logging only errors. LLM failures are usually silent (hallucinations, low-quality outputs). You must proactively evaluate quality, not just catch exceptions.
- Ignoring token costs until the bill arrives. Set budget alerts and per-feature cost caps from day one.
- No baseline metrics. Without baseline quality scores, you can't detect regressions. Establish baselines before shipping.
- Observing the model but not the retrieval. In RAG applications, most quality issues originate in retrieval (wrong chunks, stale data), not in the model.
- Over-sampling for evaluation. Evaluating 100% of production requests with an LLM-as-judge costs more than the production model itself. Sample strategically.
Our Observability Stack at ATMA-AI
Every LLM application we deploy at ATMA-AI includes a full observability layer — distributed tracing for agent workflows, automated quality scoring, cost attribution, and anomaly alerting. Our platform provides enterprise teams with real-time visibility into their AI systems' behavior, quality, and economics.
Need observability for your LLM applications? Talk to our platform engineering team.