Interview Prep/Monitoring & Observability/PromQL and recording rules

`promtool test rules` fails with `expected: ... got: nil` for an alert test

AdvancedTroubleshootingPromQL and recording rules
Answer

Likely causes → eval_time is earlier than the alert's for duration allows, input series intervals are wrong, or labels in exp_labels miss rule-added labels like severity.

Diagnose → Run the alert expression in the test file as a promql_expr_test to see raw output at eval_time.

Fix → Set eval_time past for (e.g. for: 5m → eval_time: 10m), use series notation like '0+10x20', and list every label including rule labels.

Prevent → Keep a test file per rule file and run it in CI.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL and recording rules