Error ratios & Prometheus-style rules
Alert on a symptom users can feel
Lesson 11 of 20 · 12 min · Module 4: A plan and actionable alerts
An alert should point to a meaningful condition that warrants action.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Choose a symptom rather than a vague activity count
- Use the recorded metric deliberately
The idea
An alert combines a defined metric, a condition, and a timing requirement. Its state should follow the supplied evidence, rather than the presence of a rule name.
groups:
- name: capacity
rules:
- alert: LowDisk
expr: disk_free_ratio < 0.1
for: 10m
01Choose a symptom rather than a vague activity count
An error ratio can reflect a user-facing problem more directly than a raw count of log messages. The metric must have a documented meaning and unit.
02Use the recorded metric deliberately
This lab supplies a precomputed ratio and compares it with a threshold. It does not run a full Prometheus query engine or compute a rate from raw counters.
03Give the operator a useful signal
A named alert, severity, and clear annotation help someone decide what to investigate. An alert without an action can become ignored noise.
Your turn
What the checks look for
- Names the intended symptom
- Holds for five minutes before firing
- Labels severity
Take this with you
Connect alerts to meaningful symptoms and a documented response.
Go a little further
Write a useful annotation describing the first diagnostic action.