Skip to content

feat(monitoring): route page alerts to chat and ticket alerts to issues #5471

Open

Description

@dan-petty

Update 2026-11-26 (infra move): Alertmanager and the environment alert rules moved to dan-petty/homelab.

This issue keeps the "Do this" step and its test for the product alerts (rules in k8s/devops/monitoring/). The environment alert rows, the route checks and the live page count are in the homelab follow-up. docs/SRE.md is now docs/guidelines/sre.md.

Follow-up: dan-petty/homelab#300.


Problem or Motivation

The SRE service spec (docs/guidelines/sre.md, #5445) sets at most 2 pages a day. A ticket is an issue, or a comment on the open issue of its cause, and it does not notify a person at once. Today Alertmanager sends the critical and the warning alerts to one Mattermost receiver (k8s/README.md, Receiver). So a page does not differ from a ticket.

Measured on 2026-11-13 at 16:20 UTC:

  • sum(increase(alertmanager_notifications_total{integration="mattermost"}[7d])) is 453: about 65 notifications a day, and 0 failed.
  • sum by (rule_group) (prometheus_rule_group_rules) gives 47 rules in the 12 environment groups.
  • The alert table of the environment rules in k8s/README.md has the columns Alert, Fires when, For and Severity. It has no "Do this" step. The alert tables of docs/CLUSTER.md have one. So a ticket from an environment rule cannot tell the reader what to do.

Proposed Solution

  • Keep the critical route on the Mattermost alert channel.
  • Route warning to a webhook receiver that opens an issue, or comments on the open issue of the same alert and labels. The issue or the comment holds the "Do this" step of the alert row.
  • Add a "Do this" column to the environment alert table of k8s/README.md, with one step for each rule.
  • Add a test that fails when an alert rule has no row with a "Do this" step.

Acceptance Criteria

  • A test of the Alertmanager values proves that critical goes to the Mattermost receiver and warning goes to the ticket receiver.
  • Each row of the environment alert table of k8s/README.md has a "Do this" step, and a test fails on a rule with no such row.
  • Live proof: in the 7 days after the rollout, the alert channel gets 2 pages a day or fewer, and each warning alert has an issue or a comment.

Existing Tool Considered

Alertmanager webhook_configs is the standard receiver interface. First check an open bridge from an Alertmanager webhook to GitHub issues, such as m-lab/alertmanager-github-receiver (Apache-2.0), for its maintenance. If no bridge is maintained, the webhook router of the Roadmap Service takes the Alertmanager payload. Cost to build that route: about 0.4 M tokens and 3 hours.

Related

#4709 (the burn-rate alerts that page), dan-petty/homelab#344, #3655, dan-petty/homelab#356.

Source: #5445

Owner decision 2026-11-13

The owner accepted the design of the roadmap pipeline split (tracker #5482) on 2026-11-13. That design rejects an Alertmanager route that files issues. The incident job of #5477 reads the Alertmanager API and is the one writer of incident issues, so one alert never gets two issues. This changes the scope of this item:

  • Alertmanager routes page alerts (critical) to chat only: the Mattermost alert channel.
  • A ticket-level alert (warning) becomes an issue only through the incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 (one writer). This item adds no webhook receiver, no route to issues and no bridge from Alertmanager to GitHub issues.
  • Removed from the scope: the warning route to a webhook receiver, the ticket receiver, the receiver test of warning, and the check of a bridge such as m-lab/alertmanager-github-receiver.
  • Kept in the scope: the "Do this" column of the environment alert table in k8s/README.md, with one step for each rule, and the test that fails on a rule with no such row. The incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 can then give the step in its issue.
  • Move warning off the chat route only when the incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 runs in mode on, so no warning alert is lost in the gap. warning then goes to a receiver with no integration, and the incident job reads it from the Alertmanager API.

These criteria replace the first and the third criterion above:

  • A test of the Alertmanager values proves that critical goes to the Mattermost receiver and that no route sends an alert to a receiver that files issues.
  • Live proof: in the 7 days after warning leaves the chat route, the alert channel gets 2 pages a day or fewer. A comment gives the count.

Alternatives check of 2026-11-23: none.
Tool: none found.
Reason: Searches found only the Alertmanager-to-GitHub issue bridge, which the owner decision rules out; no tool writes a per-alert "Do this" step or tests the alert table against the rule files.

Lacks:

  • Per-alert Do this step in the environment alert table
  • Test that fails on a rule with no Do this row
  • Route change for warning that loses no alert

Proposed design

Problem statement

Alertmanager sends both critical and warning alerts to one Mattermost receiver, so a page and a ticket look the same. The owner decision of 2026-11-13 makes the incident job of #5477 the only writer of incident issues, so this item adds no webhook receiver and no route to issues. It adds a Do this step to each row of the alert table in k8s/README.md and a test that fails on an alert rule with no such row, and it verifies that critical stays on the Mattermost channel with no issue-filing route. The move of warning off chat waits on #5477 and is deferred to a new issue.

Acceptance criteria

Requirement: Critical alerts stay on chat

The Alertmanager configuration SHALL route every critical alert to the Mattermost receiver.

Scenario: The live route test of a critical alert

  • WHEN a person runs kubectl -n monitoring exec statefulset/prometheus-alertmanager -c alertmanager -- amtool config routes test severity=critical
  • THEN the command prints mattermost as the receiver.

Requirement: No route files issues

The Alertmanager configuration SHALL define no receiver that files issues and no route to one.

Scenario: The live route tree names only chat and null

  • WHEN a person runs kubectl -n monitoring exec statefulset/prometheus-alertmanager -c alertmanager -- amtool config routes show
  • THEN the command prints a routing tree whose receivers are only null and mattermost.

Requirement: Warning stays on chat in this change

The Alertmanager configuration SHALL keep every warning alert on the Mattermost receiver in this change.

Scenario: The live route test of a warning alert

  • WHEN a person runs kubectl -n monitoring exec statefulset/prometheus-alertmanager -c alertmanager -- amtool config routes test severity=warning
  • THEN the command prints mattermost as the receiver.

Requirement: Each alert row gives a Do this step

Each row of the alert table under ## Alerting in k8s/README.md SHALL have a non-empty Do this step.

Scenario: The alert table lists every rule with a step

  • WHEN a person runs uv run devops ci test tests/prometheus/test_k8s_monitoring_alerting.py
  • THEN the command exits 0 and the test passes for every alert rule with a Do this step.

Requirement: A missing Do this row fails the test

The alert table test SHALL fail when an alert rule has no row with a non-empty Do this step.

Scenario: An alert rule has no Do this row

  • WHEN a person adds an alert rule to k8s/monitoring/prometheus-values.yaml with no table row and runs uv run devops ci test tests/prometheus/test_k8s_monitoring_alerting.py
  • THEN the command exits non-zero and the failure names the alert rule with no Do this step.

Existing Tool Considered

false

Key questions

  • What scope does the owner decision of 2026-11-13 set for this item?: critical alerts stay on the Mattermost alert channel. The incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 is the only writer of incident issues. This item adds no webhook receiver, no route to issues and no bridge. It keeps the Do this column and its test. warning leaves chat only when feat(roadmap): add incident and supervise jobs that read the SLOs #5477 runs in mode on. (best practice) [sources: k8s/README.md:605]
    • Chosen: Keep the owner decision of 2026-11-13. The owner accepted the pipeline split design. The design makes the incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 the one writer of incident issues.
    • Rejected: Keep the original ticket receiver and issue route. The owner decision removes the ticket receiver, the route to issues and the bridge.
  • Does this item move warning off the Mattermost route now?: No. No code holds the incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 yet, and warning still routes to the Mattermost receiver. The move and its 7-day live proof are deferred to a new issue that waits on feat(roadmap): add incident and supervise jobs that read the SLOs #5477 running in mode on. (best practice) [sources: openspec/changes/archive/2026-11-13-5445-add-the-sre-service-spec/design.md:10, k8s/monitoring/prometheus-values.yaml:111, k8s/README.md:693]
  • What does the Do this column hold for each alert?: One non-empty action step for each rule row, in the style of the Do this column of docs/CLUSTER.md: the command or check that resolves the alert. The incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477 can then give that step in its issue. (best practice) [sources: docs/guidelines/sre.md:77, docs/guidelines/sre.md:219, docs/guidelines/production-readiness.md:53, k8s/README.md:622]
    • Chosen: Add a Do this column with one step for each rule. The owner decision keeps this part, and the SRE guideline requires a runbook row with a Do this step for each alert.
    • Rejected: Keep the four columns and no action step. A ticket from an alert cannot tell the reader what to do.
  • Where does the test that fails on an alert rule with no Do this row live, and how does it find the rule?: Add the test to tests/prometheus/test_k8s_monitoring_alerting.py. It reads the alert rules of k8s/monitoring/prometheus-values.yaml and k8s/devops/monitoring/prometheus-rules-values.yaml and the alert table of k8s/README.md, and fails naming each rule with no row or an empty Do this cell. That module already reads the same files and checks a row of docs/CLUSTER.md. (best practice) [sources: tests/prometheus/test_k8s_monitoring_alerting.py:65, tests/prometheus/test_k8s_monitoring_alerting.py:66, tests/prometheus/test_k8s_monitoring_alerting.py:68, tests/prometheus/test_k8s_monitoring_alerting.py:69, tests/prometheus/test_k8s_monitoring_alerting.py:493]
    • Chosen: Add the test to tests/prometheus/test_k8s_monitoring_alerting.py. That module already reads the alert rules and the docs, and it checks a row of docs/CLUSTER.md.
    • Rejected: Add a new tests/commands/k8s/test_alert_runbooks.py. No such file or directory exists, and the alerting tests live in tests/prometheus/.
    • Rejected: Check the table by hand only. A hand check does not fail when a new rule has no row.
  • Which command proves that the Alertmanager route keeps critical on chat and sends no alert to an issue-filing receiver?: Use the live amtool config routes test and amtool config routes show in the Alertmanager pod, as the production-readiness guideline names. amtool config routes test severity=critical prints the receiver, and amtool config routes show prints the route tree with its receivers. A pytest test that reads k8s/monitoring/prometheus-values.yaml is not the proof: the values are a config file, and the k8s gate renders kustomize manifests, not the Helm values of Alertmanager. (best practice) [sources: docs/guidelines/production-readiness.md:54, k8s/README.md:714]
    • Chosen: Live amtool config routes test and amtool config routes show. The production-readiness guideline names amtool config routes test as the check of the page and ticket routes, and the Alertmanager pod holds amtool.
    • Rejected: A pytest test that reads the Alertmanager values. A test asserts no value of a config file, and the k8s gate does not read the Helm values of the Alertmanager config.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/monitoring
    status/new
    value/medium
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Scope change, with the reason.

    The owner accepted the design of the roadmap pipeline split (tracker #5482) on 2026-11-13. That design rejects an Alertmanager route for incident filing. The incident job of #5477 reads the Alertmanager API and is the one writer of incident issues. A second writer, such as a webhook route from Alertmanager to issues, can file two issues for one alert. The accepted design wins over this item.

    The body of this item now has the section "Owner decision 2026-11-13":

  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches turned up no relevant open tool: the results were unrelated documentation pages, and the one candidate the issue names, m-lab/alertmanager-github-receiver, is open and maintained but the owner decision of 2026-11-13 removed the Alertmanager-to-GitHub-issues bridge, the ticket receiver and its check from the scope, because the incident job of #5477 is the single writer of incident issues. What remains is the "Do this" step for each environment alert row in k8s/README.md and an in-repo test that fails on a rule with no such row, which is project documentation and a project test rather than a need that an external tool or library covers.

    Tool: none found

    Lacks:

    • A "Do this" step for each row of the environment alert table in k8s/README.md
    • A test that fails when an alert rule has no table row with a "Do this" step
    • An Alertmanager route that files issues is explicitly out of scope (single writer is the incident job of feat(roadmap): add incident and supervise jobs that read the SLOs #5477), so no bridge from Alertmanager to GitHub issues is wanted
    • A check of a bridge such as m-lab/alertmanager-github-receiver was removed from the scope by the owner decision

    Tools considered:

    Searches run:

    • prometheus alert rule linter check every alert has runbook annotation, results: 5
    • Alertmanager webhook receiver that opens GitHub issues bridge maintained, results: 5
    • m-lab alertmanager-github-receiver, results: 5
    • cloudflare pint prometheus rule linter alerts annotation runbook, results: 5
    • prometheus alertmanager github receiver, results: 5
    • runbook_url annotation required for every alert prometheus rule test, results: 5
    • promdoc generate markdown documentation from prometheus alert rules, results: 5
    • cloudflare pint, results: 5
    • keephq keep alert to github issue, results: 5

    Sources:

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  7. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  8. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9be129e (see proposed design in issue body).

    Moved to new items: dan-petty/homelab#369.

  9. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor

    Evidence for the Do this step of AlloyRemoteWriteSamplesFailed, from #6439.

    From 2026-11-15 to 2026-11-19, each firing of this alert had one cause: two series of one target had the same label set and different values at one timestamp. Prometheus answered HTTP 400 duplicate sample for timestamp, and Alloy dropped the full batch of up to 2,000 samples, also the samples of other targets. Two labeldrop rules of the gateway ServiceMonitor (#5896) made the collisions. The pull request of #6439 removes them.

    A Do this step that finds the cause:

    1. In Loki, read the error text: {namespace="monitoring", container="alloy"} |= "non-recoverable error".
    2. For duplicate sample for timestamp, take the existing value of one line, for example V, and find the series that holds it: <family>_created > V < V+1. The job label names the target. Then look for a relabel rule of that target that drops a label.
    3. Count the refusals in the Prometheus log, not only in the Alloy log: {namespace="monitoring", container="prometheus-server"} |= "Out of order sample from remote write". On 2026-11-19, Prometheus gave 3,807 HTTP 400 answers in 24 h, and the Alloy log held 1,145 lines.

    The alert shows only the collisions between batches. Inside one batch, Prometheus keeps the first sample of a label set and drops the rest with no counter (tsdb/head_append.go:1341-1354 at Prometheus v3.16.0). The step can say that a quiet alert does not prove correct values.

    The OpenSpec tasks of #6439 name this item as the owner of the row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/monitoringsource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions