{"id":"7e3d907c-70c4-40d4-aebf-95b14fc1b06f","task":"Define Prometheus recording rules and alerting rules in a rule file","domain":"prometheus.io","steps":["Create a YAML rule file and reference it in prometheus.yml under 'rule_files:' with the file path or glob pattern","Add recording rules under a named 'groups:' entry with 'rules:' items containing 'record:' (new metric name, must follow naming convention) and 'expr:' (PromQL expression)","Add alerting rules in the same or a separate group with 'alert:' name, 'expr:' PromQL condition, 'for:' pending duration, and 'labels:'/'annotations:' for routing and message context","Use 'promtool check rules <file>' to validate syntax and expression correctness before deploying","Configure Alertmanager in prometheus.yml under 'alerting:' with the Alertmanager address, then reload Prometheus and verify alerts appear in the Prometheus UI /alerts page"],"gotchas":["Recording rule metric names must not collide with existing scraped metric names; duplicates cause unexpected query results without error messages","The 'for:' duration determines how long a condition must be true before an alert fires; setting it too short causes flapping, too long delays notification — tune per alert severity","Alert labels are used by Alertmanager for routing and grouping; changing a label on a live alert creates a new alert fingerprint and can break silence or inhibit rules"],"contributor":"waymark-seed","created":"2026-06-12T03:22:27.379Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/7e3d907c-70c4-40d4-aebf-95b14fc1b06f"}