Before installing anything, it helps to know what monitoring is for. A monitoring system exists to answer two questions about a service: is it serving its users properly right now? and, when it is not, why not? Every metric you collect and every alert you write in this course should help answer one of those questions. Collecting numbers that answer neither only costs storage and attention.
This lesson gives you the vocabulary the rest of the course relies on: metrics, symptoms and causes, white-box and black-box monitoring, the four golden signals, and the RED and USE methods. You will finish by writing the monitoring questions for the course's practice service.
Metrics, Logs and Traces
Three kinds of telemetry are common, and they answer different questions:
- Metrics are numbers measured over time, such as "requests handled so far" or "memory in use now". They are cheap to store and aggregate, which makes them good for spotting that something changed and for alerting.
- Logs are records of individual events, such as one failed request with its error message. They explain a particular event in detail.
- Traces follow one request across several services and show where its time went.
Prometheus and Grafana, as used in this course, work with metrics. A metric can tell you that 3% of requests are failing; a log or trace is often what tells you which request and why. This course stays with metrics and treats logs and traces as a boundary.
Symptoms and Causes
A symptom is something a user of the service experiences: requests fail, or they are slow, or the service cannot be reached at all. A cause is a condition inside the system that may produce symptoms: a full disk, high CPU use, a database that has stopped answering.
The distinction matters most for alerts, because an alert interrupts a person. If you alert on causes, you will be woken for a disk at 91% that never affected anyone, and you will still miss failures whose cause you did not think to watch. If you alert on symptoms, every alert means users are affected, and you then use cause-level metrics on dashboards to find out why. The Prometheus project's own guidance summarises this as: keep alerting simple, alert on symptoms, and avoid pages where there is nothing to do.
That does not make cause metrics useless. They belong on the dashboards you open while investigating, and a few causes are worth a non-urgent ticket because they predict a symptom soon, such as a disk that will be full in four hours.
White-Box and Black-Box Monitoring
White-box monitoring uses measurements from inside the system: the service counts its own requests and errors, the operating system reports its memory. It can see causes, and it can see problems that have not yet reached users.
Black-box monitoring tests the system from outside, as a user would: send a request to the health page and check that a correct answer comes back in time. It sees only symptoms, but it catches failures that the inside view cannot report, such as the whole service being unreachable. A service that has crashed cannot count its own errors.
Good monitoring uses both. In this course the shop reports its own metrics (white-box), and later a probe tests it from outside (black-box).
The Four Golden Signals, RED and USE
You need a starting list of what to measure. Three well-known lists help.
The four golden signals, from Google's site reliability engineering book, are the measurements to have if you can only have four for a user-facing system:
| Signal | Meaning | Shop example |
|---|---|---|
| Latency | How long requests take | Time to answer /api/orders |
| Traffic | How much demand there is | Requests per second |
| Errors | How many requests fail | Responses with status 500 |
| Saturation | How full the system is | Requests in progress, CPU or memory headroom |
The RED method applies to anything that serves requests: Rate (requests per second), Errors (failed requests per second or as a fraction) and Duration (how long requests take, usually as a distribution). RED describes the user's experience, so it reports symptoms.
The USE method applies to resources such as CPU, memory and disks: Utilisation (how busy the resource is), Saturation (work waiting for it, such as a queue) and Errors (error events from the resource). USE describes how the machines are doing, so it mostly reports causes.
A practical rule follows: alert on RED, investigate with USE. Grafana's dashboard guidance gives the same advice.
What Makes an Alert Worth Sending
Before writing any alert, ask the questions the site reliability book recommends for a page: does it detect a condition that is urgent, actionable, and affecting users now or very soon? Could it ever be safely ignored? If the honest answer is "this sometimes fires and nobody needs to do anything", it should not interrupt a person. It might become a ticket, a dashboard panel, or nothing.
Two further consequences shape later lessons:
- Alert as close to the user as possible. If the shop's overall error rate is fine, a slow internal component does not need a page of its own.
- Allow for short blips. A single slow second is not an incident, which is why alerting rules can require a condition to last before firing.
Worked Example: Questions for the Shop
The shop is a small HTTP service with two routes that do simulated work
(/api/products and /api/orders), a health page (/healthz), and a
switch that adds delay or errors on purpose. A steady load generator sends
it about five requests a second. What should its monitoring answer?
Start with the user's view (RED):
- How many requests per second does each route receive? (Rate)
- What fraction of API requests fail? (Errors)
- How long do API requests take, and how slow are the slowest few percent? (Duration)
- Does the health page answer correctly when tested from outside? (Black-box availability)
Then add what you would look at while investigating (USE and saturation):
- How many requests are being handled at this moment?
- How busy are the CPU and memory of the machine running the shop?
Finally, the monitoring system's own health:
- Is Prometheus actually collecting the shop's metrics, and since when?
Question 7 is easy to forget and essential. If collection stops, every other question quietly returns old or empty answers. The next lessons show how Prometheus answers it.
Notice what is not on the list: "is the shop's process running?". A running process can still fail every request. Questions 2 and 4 cover availability from the user's point of view; the process check adds little.
Which of these would page someone? Questions 2 and 3 (failing or slow user requests) and 4 and 7 (the service or its monitoring is gone) describe symptoms. Questions 5 and 6 are for investigation.
Check Your Understanding
Classify each proposed alert as a symptom or a cause, and say whether it should page a person.
- More than 5% of
/api/ordersrequests returned status 500 over the last ten minutes. - CPU use of the shop's host is above 80%.
- The health page has not answered an outside probe for three minutes.
- The shop's memory use grew by 10% in an hour.
- The slowest 5% of API requests took longer than one second for fifteen minutes.
- Prometheus has not collected any shop metrics for five minutes.
Answers
- Symptom; page. Users are getting errors, and the rate is sustained.
- Cause; do not page. Busy CPU is not harmful in itself. If it makes requests slow, alert 5 fires. Show CPU on the investigation dashboard.
- Symptom; page. From the outside, the service is down.
- Cause; do not page. It may be normal growth. At most a ticket if a trend predicts running out of memory.
- Symptom; page, or a ticket if your stated objective tolerates slow periods. Slowness affects users directly.
- A symptom of the monitoring system. Page or ticket, depending on how much blind time you can accept, because without collection every other alert is silent.