Monitoring & Observability
Knowing what your system is doing, and why something went wrong, without guessing.
What is it?
A production system will eventually slow down, throw errors, or fail, and someone has to find out why, often under pressure.
Monitoring means tracking key health signals (error rates, response times, resource usage) and alerting when something looks wrong.
Observability is the broader ability to understand why, using:
- Logs: records of individual events.
- Metrics: numeric measurements over time.
- Traces: the path one request took across several services.
Explain like I'm 10
Monitoring is like a car's dashboard warning lights: they tell you something is wrong (check engine, low oil) but not exactly why. Observability is like opening the hood and tracing the problem to a specific wire or part, instead of just knowing a light came on.
Examples
The three pillars, applied to one slow request
// A metric: how many requests are slow right now?
metrics.increment("api.requests.slow", { endpoint: "/checkout" });
// A log: what exactly happened for this one request?
logger.info("Checkout failed", { userId: 42, reason: "payment timeout" });
// A trace: which specific step, across multiple services, was slow?
// checkout-service (12ms) -> payment-service (4800ms) <- the slow one
// -> inventory-service (8ms)How it works
Metrics are lightweight counters and measurements collected continuously (requests per second, average latency, error rate). They're cheap to store and graph, so they're ideal for spotting trends and triggering alerts.
Logs are detailed, timestamped records of specific events, for digging into exactly what happened.
Traces follow one request through several services and show where the time went. Once a system is split into many services, no single log or metric can show the full path.
Why does it exist?
Without them, you only learn something is wrong when a user complains, and then you can't easily find out why. These tools help a team spot problems quickly (often before users do) and find the real root cause instead of guessing.
When to use it
Build them in early for any production system: metrics and alerts for overall health, logs for debugging incidents, and traces once several services call each other.
When not to use it
For a small prototype or personal project nobody depends on, full tooling (dedicated tracing, alerting pipelines) is likely overkill. Basic logging is often enough until the system matters to someone besides you.
Common mistakes
Logging so much low-value detail that the important entries get lost in the noise.
Having metrics and dashboards but no alerts, so problems are noticed only if someone happens to look at a graph.
Relying only on logs in a multi-service system, where one request touches several services and no single log tells the full story. That's what tracing is for.
Practice exercises
- Easy:
Explain in your own words the difference between a metric and a log.
- Medium:
Describe a scenario where a metric alone tells you something is wrong, but you'd need a trace to find out why.
- Hard:
Explain why observability matters much more once a system moves from a monolith to microservices.
Interview questions
What's the difference between monitoring and observability?
Monitoring tracks key signals and alerts when something looks wrong. Observability is the broader ability to understand why, using logs, metrics, and traces together.
What are the three commonly cited 'pillars' of observability?
Logs (detailed records of specific events), metrics (numeric measurements over time), and traces (the path of one request across several services).
Why does tracing become especially important in a microservices architecture?
One request can pass through many services, and no single log or metric shows the whole path. A trace ties the pieces together.