logging
**Observability** is the **ability to understand the internal state of a system by examining its external outputs** — built on three pillars: logs (discrete events for debugging), metrics (aggregated numerical measurements for monitoring), and distributed traces (request flow tracking across services), enabling engineering teams to detect, diagnose, and resolve issues in complex ML systems, LLM serving infrastructure, and microservice architectures where traditional debugging is impossible.
**What Is Observability?**
- **Definition**: A system property that measures how well you can infer internal states from external outputs — observable systems emit sufficient telemetry (logs, metrics, traces) to answer arbitrary questions about system behavior without deploying new code or instrumentation.
- **Three Pillars**: Logs (timestamped event records for debugging specific incidents), Metrics (aggregated numerical time-series for dashboards and alerting), and Traces (end-to-end request paths across distributed services for latency analysis).
- **Beyond Monitoring**: Traditional monitoring answers "is it broken?" with predefined checks — observability answers "why is it broken?" by providing the data needed to investigate novel failure modes that weren't anticipated when alerts were configured.
- **ML-Specific Challenges**: ML systems have unique observability needs — model quality degradation (drift), non-deterministic outputs, GPU utilization, token throughput, and cost tracking require specialized instrumentation beyond standard web service observability.
**Three Pillars in Detail**
| Pillar | Purpose | Data Type | Tools |
|--------|---------|----------|-------|
| Logs | Debug specific events | Structured text records | ELK Stack, Loki, CloudWatch |
| Metrics | Monitor aggregate health | Numerical time-series | Prometheus, Datadog, Grafana |
| Traces | Track request flow | Span trees across services | Jaeger, Zipkin, OpenTelemetry |
**LLM-Specific Observability**
- **Latency Metrics**: Time to First Token (TTFT), Time Per Output Token (TPOT), end-to-end generation time — critical SLA metrics for LLM serving.
- **Throughput**: Tokens per second, requests per second, concurrent users — capacity planning metrics.
- **Cost Tracking**: Cost per request, cost per token, model-specific cost allocation — essential for multi-model deployments.
- **Quality Monitoring**: Hallucination detection, safety filter triggers, user feedback scores — model-specific quality signals.
- **GPU Utilization**: GPU memory usage, compute utilization, batch efficiency — infrastructure optimization metrics.
**LLM Observability Tools**
- **LangSmith**: LangChain-native tracing and evaluation platform — traces chain/agent execution with prompt/response logging.
- **Langfuse**: Open-source LLM observability — traces, evaluations, prompt management, and cost tracking.
- **Arize Phoenix**: ML observability with LLM tracing — embedding drift detection and retrieval quality monitoring.
- **Helicone**: Proxy-based LLM logging — sits between your app and the LLM API, capturing all requests/responses with zero code changes.
- **OpenTelemetry**: Vendor-neutral observability framework — standardized instrumentation for traces, metrics, and logs across any backend.
**Observability is the essential capability for operating complex ML and LLM systems in production** — providing the logs, metrics, and traces needed to detect performance degradation, diagnose failures, optimize costs, and maintain service quality across distributed AI infrastructure where traditional debugging approaches cannot reach.