Notes
The question
Observability answers three questions. Is something wrong? Metrics tell you. Where is it wrong? Traces tell you. Why is it wrong? Logs tell you. Monitoring watches the failures you predicted; observability lets you investigate the ones you didn't.
- is something wrong? → metrics
- where is it wrong? → traces
- why is it wrong? → logs
- monitoring: watch known
- failure modes
- observability: answer new
- questions you did not plan for
Metrics
Metrics are numbers over time: cheap to store and easy to graph and alert on. Start with the four golden signals for every service: latency, using percentiles, traffic in requests per second, error rate, and saturation, meaning how full your CPU, memory, connection pools and queues are. Prometheus and Grafana are the common open-source pair.
- latency: p50 / p95 / p99
- traffic: requests per second
- errors: % of 5xx / failures
- saturation: CPU, memory,
- queue depth, connections
- counters, gauges, histograms
- Prometheus + Grafana, Datadog
- cheap to store, easy to alert on
Logs
Logs record individual events. Make them structured, JSON instead of free text, with the service, level, duration and, most importantly, a trace id that ties all logs for one request together. Ship them to a central store so you can search across services. And never log passwords, tokens or card numbers.
{ "ts": "10:42:07.113",
"level": "error",
"service": "payments",
"trace_id": "4bf9…",
"user_id": 812,
"msg": "card declined",
"ms": 1874 }
JSON, not free text
never log passwords or cards Traces
Traces follow one request through every service. The gateway creates a trace id and passes it along in headers; each service records a span with its timing. The picture is instant: the order service took forty milliseconds, payments took nineteen hundred, and inside it one database query took eighteen fifty. Found it. OpenTelemetry is the standard way to emit all three signals.
trace 4bf9 total 1,950 ms ├ gateway 1,950 ├─ order service 40 └─ payment service 1,900 └─ SELECT … 1,850 ← trace id passed in headers (W3C traceparent) OpenTelemetry → Jaeger, Tempo
Alerting
Alerting is where teams go wrong. Page people on symptoms users actually feel: error rate above one percent for five minutes, or latency burning through the SLO. High CPU on its own belongs on a dashboard, not in someone's pager at three a.m. Every alert should be actionable, with a runbook. Too many alerts, and people start ignoring them.
- alert on symptoms users feel:
- error rate > 1% for 5 min
- p99 > 500 ms (SLO burn)
- not on every cause:
- CPU 80% → dashboard, not pager
- every page must be actionable
- and link to a runbook
- too many alerts = ignored alerts
Cost
It isn't free. Logs are the expensive signal, so sample noisy ones and keep them for days or weeks, not forever. Sample traces, keeping every error and slow request. And watch metric cardinality: a label like user id creates millions of time series and a huge bill.
- logs are the expensive one:
- sample debug logs
- short retention (7–30 days)
- traces: sample 1–10%,
- but keep all errors / slow ones
- metrics: watch cardinality
- (no user_id as a label!)
- pay for what helps you debug
Practice
Day to day, each service gets a dashboard of its golden signals and dependencies, with deploy markers so you can see when a release changed the graphs. Add an on-call rotation with runbooks, and after incidents, write blameless postmortems focused on what to change, not who to blame.
- one dashboard per service:
- golden signals + dependencies
- one top-level SLO dashboard
- deploy markers on graphs
- on-call rotation, runbooks
- blameless postmortems:
- what happened, why,
- what we change
Say it like this
In an interview: collect the four golden signals for every service, alert on SLO symptoms like error rate and p ninety-nine, use structured logs carrying a trace id, and OpenTelemetry tracing with sampling that keeps every error. Add business metrics too, like orders per minute; a sudden drop there catches bugs that technical metrics miss.
- "How would you monitor this?"
- golden signals per service
- SLO alerts: error rate, p99
- structured logs with trace id
- OpenTelemetry traces,
- sampled, errors always kept
- business metrics too:
- orders/min, signups/min