A Prometheus alert has three states: inactive, pending and firing. pending means the condition is true but not for long enough. Only after the for duration does the alert become firing and go to Alertmanager.
Symptom
promtool query instant http://localhost:30090 'ALERTS{namespace="app"}'
ALERTS{alertname="NotesApiErrors", alertstate="pending", namespace="app",
severity="warning"} => 1 @[...]
In the course every fifth request to notes-api fails. After about a minute the rule is met, but the alert is only pending.
Diagnosis
The rule shows how long the condition has to hold.
sum by (namespace) (rate(notes_http_requests_total{code=~"5.."}[2m]))
/ sum by (namespace) (rate(notes_http_requests_total[2m])) > 0.05
for: 2m
Causes
for: 2mThe waiting time is still running
for suppresses short spikes. Two minutes later the same alert is firing – and only then does Alertmanager learn about it.
pending, then goneThe condition does not hold long enough
If the error rate drops below the threshold before for runs out, the alert never fires. That is intended: short spikes wake nobody.
Fix
promtool query instant http://localhost:30090 'ALERTS{namespace="app"}'
ALERTS{alertname="NotesApiErrors", alertstate="firing", namespace="app",
severity="warning"} => 1 @[...]
Don't: Drop for altogether – then every short spike wakes the on-call engineer.
Observability hands-on, Day 4: alerting rules, Alertmanager, receivers, grouping and silencing.
Go to day 4 →
FAQ
Does Alertmanager see pending alerts?
No. Prometheus only sends firing alerts; amtool shows the alert only after for has run out.
How long should for be?
Long enough for short, harmless spikes to disappear and short enough to report a real outage in time – 2m in the lab, often 5–15m in production.