Skip to main content
17

Metrics, logs and traces, and what to alert on

MediumObservabilityMonitoringAlerting

What's the difference between metrics, logs and traces, and what should you alert on?

TL;DR

They're the three pillars of observability. Metrics are cheap numeric time series (request rate, error rate, latency percentiles, CPU), good for dashboards, trends and alerts. Logs are detailed event records, good for understanding what happened in a specific case. Traces follow one request across services as a tree of timed spans, good for finding which hop is slow. Alert on symptoms users feel, such as high error rate or latency against your SLO, not on every cause like high CPU. Every page should be urgent, actionable, and linked to a runbook.

Key points

  • Service metrics frameworks: RED (Rate, Errors, Duration) for services and USE (Utilization, Saturation, Errors) for resources. Google's four golden signals: latency, traffic, errors, saturation.
  • Use percentiles (p95, p99), not averages: averages hide the slow tail.
  • Structured logs (JSON) with a trace ID let you jump from a trace to its logs.
  • OpenTelemetry is the vendor-neutral standard for emitting all three.
  • Typical stacks: Prometheus + Grafana (metrics), Loki or Elasticsearch (logs), Tempo or Jaeger (traces), or Datadog, Honeycomb, etc.
  • Cardinality drives cost: never put user IDs or request IDs in metric labels.
  • Alerting: page on SLO burn rate; send cause-level warnings (disk 80% full) to a ticket queue, not a pager. Fight alert fatigue by deleting alerts nobody acts on.

Example

promql
# Error ratio over 5 minutes
sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) > 0.02

# p99 latency
histogram_quantile(0.99, sum by (le) (rate(http_request_duration_seconds_bucket[5m])))

Common follow-ups

  • Monitoring vs observability? Monitoring answers known questions with predefined dashboards. Observability lets you ask new questions about unknown failures from rich telemetry.
  • Why not alert on CPU > 80%? High CPU may be fine; users might not notice. Alert on the symptom and use CPU to diagnose.

What interviewers look for

Tip

Clear roles for each pillar, RED/USE or golden signals, percentiles, and symptom-based, actionable alerting.

  • Red flag: paging on dozens of resource thresholds, with no runbooks.

Was this helpful?