Explains observability in distributed systems, comparing metrics, logs, and traces with a medical diagnosis analogy and showing how to correlate signals for troubleshooting.
Modern distributed applications can fail in many ways. When something goes wrong, observability gives you the signals and context to understand what happened and why. This guide explains observability using clear analogies, concrete examples, and practical comparisons of the core telemetry signals: metrics, logs, and traces.Observability is the ability to understand a system from the outside — to ask questions and get answers without inspecting internal code or processes. Those answers come from dashboards, traces, logs, or other telemetry outputs. The objective is to surface unknown unknowns: issues you weren’t monitoring directly but that affect your system.
Timeline and notes → logs (detailed, timestamped events)
End-to-end diagnostic tests → traces (request-level paths across services)
Doctors don’t rely on observation alone; they order tests (temperature, blood work, scans). In observability terms, these concise, numeric indicators are metrics.
Logs are verbose records of individual events. They provide contextual details that metrics alone cannot. Think of a patient’s symptom timeline or diary.Example patient event timeline:
2023-10-27T10:00:00Z INFO: Patient entered Mall.2023-10-27T11:30:00Z INFO: Patient watched movie "Action Adventure".2023-10-27T14:00:00Z INFO: Patient entered Football Stadium.2023-10-27T17:00:00Z INFO: Football game ended.2023-10-27T19:00:00Z INFO: Patient had dinner with friends at "Italian Place".2023-10-27T22:00:00Z WARNING: Patient reports occasional cough.2023-10-27T22:30:00Z WARNING: Patient is feeling unusually tired.2023-10-27T23:00:00Z ERROR: Patient's temperature is 101°F (38.3°C). Fever detected.2023-10-27T23:30:00Z ERROR: Patient reports nausea.2023-10-28T00:00:00Z ERROR: Patient's temperature is 102°F (38.9°C). Fever worsening.2023-10-28T00:30:00Z ERROR: Patient reports severe nausea and dizziness.2023-10-28T01:00:00Z ERROR: Patient reports chills and body aches.
In systems, logs include timestamps, severity, event text, and structured fields like client IP, request path, upstream host, etc. Example Nginx upstream error logs:
Distributed traces follow a single request as it travels through services. They show timing, dependencies, and where time is spent — ideal for locating latency hotspots or dependency failures. Think of a medical imaging test that reveals the precise area of impaired blood flow.In a web application example, a checkout request may touch multiple services (frontend → checkout → payment → catalog → shipping). A trace stitches spans from each service into a single end-to-end view, revealing total time and each service’s contribution.A trace (waterfall) view often highlights the slowest span and surfaces exceptions and errors encountered during the request.
These three are often called the “three pillars” of observability. That mental model helps structure thinking, but modern observability goes beyond just three signals.
Baggage: key/value context that travels with a trace (e.g., user ID, region) to help correlate behavior across services.
Profiling: runtime samples of CPU, memory, and heap allocations to find inefficient code paths.
Events and custom context: business events or debug snapshots that add diagnostic clarity.
The “three pillars” is a useful starting point, but real-world observability improves when metrics, logs, and traces are correlated with additional telemetry (baggage, profiling, events). Treat metrics, logs, and traces as core signals that are amplified by richer context.
When metrics, logs, and traces are available and linked, you can answer the key operational question: why is this happening?Example: combining container logs with a shell output confirms a pod’s startup and worker processes:
controlplane ✗ kubectl logs nginx-5808777c-6wbc/docker-entrypoint.sh: is not empty, will attempt to perform configuration/docker-entrypoint.sh: Launching /docker-entrypoint.d/01-listen-on-ipv6.sh/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-listen-on-default.conf/docker-entrypoint.sh: Configuration complete; ready for start up2023/10/08 18:38:10 [notice] 1#1: using the "epoll" event method2023/10/08 18:38:10 [notice] 1#1: start worker process 882023/10/08 18:38:10 [notice] 1#1: start worker process 89
Correlating that output with metrics (CPU, restarts) and traces (request latency) helps determine if an issue is environmental, configuration-related, or application-level.