What is the difference between metrics, logs and traces?
BeginnerConceptReliability, monitoring & incidents
Answer
In one line: Metrics are numbers measured over time, logs are detailed records of individual events, and traces follow a single request as it travels through many services — together they're the three pillars of observability.
Metrics
- Numeric time series:
http_requests_total, CPU %, p95 latency. - Cheap to store, fast to query, great for dashboards and alerts.
- Tell you that something is wrong and how big it is.
- Tools: Prometheus, CloudWatch, Azure Monitor, Datadog.
Logs
- Timestamped text or JSON records:
2026-12-02T10:15:03Z ERROR order=123 payment timeout after 5000ms. - Rich detail, but large and more expensive to store and search.
- Tell you what happened in a specific case.
- Tools: ELK/EFK (Elasticsearch, Fluent Bit/Fluentd, Kibana), Loki, Splunk, CloudWatch Logs.
Traces
- Show the path of one request across services, broken into spans with timings:
gateway 20 ms → orders 40 ms → payments 3,200 ms → bank API 3,100 ms. - Tell you where time is spent or where a failure started in a distributed system.
- Tools: Jaeger, Grafana Tempo, Zipkin, AWS X-Ray; instrument with OpenTelemetry.
| Metrics | Logs | Traces | |
|---|---|---|---|
| Format | Numbers over time | Event records | Request path with spans |
| Best for | Alerts, trends, dashboards | Detailed debugging | Finding slow/failing hops |
| Cost | Low | High | Medium (often sampled) |
How they work together during an incident:
- Metric alert: checkout error rate jumped to 6%.
- Trace: failing requests all slow down in the payments service calling the bank API.
- Logs: payments logs show
connection pool exhaustedwith the exact error.
Good practice: include a trace ID / request ID in every log line, so you can jump from a trace straight to its logs.
Tip for interviews: use an incident story like the one above — it shows you know how to use all three together.
More on Reliability, monitoring & incidents
What are SLAs, SLOs and SLIs?BeginnerWhat is an error budget, and how is it used?IntermediateWhat are the four golden signals of monitoring?BeginnerWhat makes a good alert? How do you avoid alert fatigue?BeginnerWhat is an incident, and what is incident management?BeginnerWhat are MTTR, MTTD, MTBF and MTTF?Beginner