Skip to content

feat(monitoring): record the shared roadmap Service selectors #4562

Done

Description

@dan-petty

Problem or Motivation

41 lines of k8s/monitoring/prometheus-values.yaml select job="roadmap-service", and no recording rule exists (grep -c 'record:' is 0; serverFiles holds only alerting_rules.yml). The move of the roadmap rows into their own pods changes the job and service names of the row series (roadmap-<row>), removes the queue and moves the budget to Valkey. Then each alert, panel and start page widget that reads a raw Service selector breaks, and each must change one by one.

Proposed Solution & Architectural Design

  • Add serverFiles.recording_rules.yml in k8s/monitoring/prometheus-values.yaml with one rule for each selector that alerts, the dashboard and the start page share: for example the failed rounds of 24 hours, the budget used ratio, the suspended rows and the pending work.
  • The issue lists each of the 41 job="roadmap-service" lines and marks it "router health" (it stays on the router job) or "row work" (it reads a recorded series).
  • Rule names follow the level:metric:operations form (https://prometheus.io/docs/practices/rules/).
  • The 6 lane alerts that the sweep item removes get no rule.
  • Check the result of the in-flight observability and caching study first, and use its names if it gives any.

Target Subsystem

Kubernetes & Minikube Automation (monitoring: k8s/monitoring/prometheus-values.yaml).

Existing Tool Considered

Prometheus recording rules (configuration of an open tool, no build). Cost: about 150,000 tokens and 2 hours, about 3,000 tokens a month to keep.

Acceptance Criteria

  • Each "row work" alert reads a recorded series, and its promtool test passes.
  • Rule names follow the level:metric:operations form.
  • The promtool tests stay within the time budget of their check.

Dependencies

None. The start page widgets, the pipeline dashboard alerts (#3655) and the unit alerts of the engine and sweep items read these rules.

Source: #4517

Alternatives check of 2026-11-19: in-use.
The repository already uses this tool.
Tool: prometheus/prometheus (https://github.com/prometheus/prometheus), Apache-2.0, last activity 2026-11-18, maintained.
Reason: Prometheus recording rules in serverFiles and promtool's check and test commands cover the whole need, and its practice page documents the required level:metric:operations naming, ratio form and without clause.

Covers:

  • Recording rules in serverFiles rule groups
  • promtool check rules and promtool test rules unit tests
  • level:metric:operations names with per and ratio
  • without clauses that keep job, repo and row labels

Lacks:

  • Project selector list and router health/row work fixture
  • Test wiring for SERVED_SERIES and RULE_GROUP_TESTS
  • A generator that derives rules from a declared selector list
  • k8s/README.md alerting text naming the group

Proposed design

Problem statement

The job="roadmap-service" selector lines of k8s/devops/monitoring/prometheus-rules-values.yaml read a raw Service job, and no recording rule exists. The move of row work to roadmap-<row> pods changes that job name, removes the queue and moves the budget to Valkey, so each alert, dashboard panel and start page widget that reads a raw selector breaks one by one. This change adds a roadmap-service-recording group to the product rule file, moves the row work alerts to the recorded series and keeps the router health selectors on the router job. The pending work selectors wait in #4606.

Acceptance criteria

Requirement: Recording rule group

The monitoring test suite SHALL fail when the product Prometheus values file holds no roadmap-service-recording group with at least one recording rule, or the product-monitoring-content spec does not list that group.

Scenario: The product rule file holds the recording group

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_group runs.
  • THEN The command exits 0, and a rule file without the group, a group without a record, or a spec that omits the group fails the check.

Requirement: Rule name form

The monitoring test suite SHALL fail a recording rule whose name is not the level:metric:operations form.

Scenario: The check parses each rule name

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_name runs.
  • THEN The command exits 0, and a record value without exactly two colons or with an empty or non-identifier part fails the check.

Requirement: Shared selectors

The roadmap-service-recording group SHALL hold one rule for each covered row work selector: the 24-hour failed jobs, the budget used ratio and the suspended rows.

Scenario: The covered selectors have a rule

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_selectors runs.
  • THEN The command exits 0, each covered selector has exactly one rule that selects job=~"roadmap-service|roadmap-.+", and its record name names the selector's metric, with _per_ and ratio for the budget ratio.

Requirement: Selector fixture

The change SHALL record each line of the product rule file that holds job="roadmap-service" in a fixture with its text and one class, router health or row work.

Scenario: The fixture lists each selector line

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_fixture runs.
  • THEN The command exits 0, and a line of the product rule file that holds job="roadmap-service" with no fixture entry, or an entry with no single class, fails the check.

Requirement: Row work alerts

Each row work alert that the fixture names SHALL read a recorded series in place of a raw job="roadmap-service" selector.

Scenario: The row work alert expressions are checked

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_alerts runs.
  • THEN The command exits 0, and a row work alert whose expression holds job="roadmap-service" or names no record value of the roadmap-service-recording group fails the check.

Requirement: Router health selectors

Each line that the fixture classes router health SHALL stay unchanged in the product rule file.

Scenario: The router health lines are unchanged

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_router runs.
  • THEN The command exits 0, and a router health entry whose text is absent from k8s/devops/monitoring/prometheus-rules-values.yaml fails the check.

Requirement: Recording rules are not alerts

The monitoring tests SHALL keep recording rules out of the alert-rule checks, so a recording rule needs no severity and no Alerting table row.

Scenario: The alert rule list names no recording rule

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_not_alerts runs.
  • THEN The command exits 0, and a record value that reaches the alert-rule list or the baseline rule set fails the check.

Requirement: Served series

The monitoring test SHALL count each record name and each metric that a recording rule selects as served.

Scenario: A recording rule selects an unknown series

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_served runs.
  • THEN The command exits 0, and a record name or a selected metric outside SERVED_SERIES fails the check.

Requirement: Promtool rule tests

The promtool unit tests of the recording rules and of the changed row work alerts SHALL hold a promql_expr_test case for each recording rule and pass within 1,000 rounds of their group.

Scenario: Promtool test rules runs

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_promtool runs; the check writes the roadmap-service-recording group to the file that the test's rule_files names and runs promtool test rules on its test file.
  • THEN The command exits 0, each record value has a promql_expr_test case, and no case evaluates more than 1,000 rounds of its group.

Requirement: Monitoring docs

k8s/README.md SHALL name the roadmap-service-recording group and the row work alerts that read the recorded series.

Scenario: The alerting section names the recorded series

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k roadmap_service_recording_docs runs.
  • THEN The command exits 0, and the ## Alerting section of k8s/README.md names roadmap-service-recording and each row work alert that the fixture names.

Existing Tool Considered

Prometheus (prometheus/prometheus, Apache-2.0, maintained) is in use, as the alternatives block of 2026-11-19 records; that block lists what the tool lacks, so the change adds the project-specific part it names and writes each rule by hand. The written cost is about 150,000 tokens and 2 hours, and about 3,000 tokens a month to keep.

Key questions

  • Does Prometheus recording rules and promtool cover the need, or does the change build its own code?: Prometheus covers it, and the repository already uses it: recording rules live in serverFiles rule groups, and the project installs the pinned promtool and runs promtool check rules and promtool test rules. Adopt the tool; build no selector-to-rule generator. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:14, .github/workflows/ci.yml:191, docs/CLUSTER.md:172, https://prometheus.io/docs/practices/rules]
    • Chosen: Use Prometheus recording rules and promtool. The tool is in use, covers the rule groups and the naming practice, and the project already runs its pinned promtool.
    • Rejected: Write a selector-to-rule generator. It adds code to build and keep, and the alternatives block finds no generator that the project needs.
    • Rejected: Leave the raw selectors in each consumer. The move changes the job name, so each consumer breaks one by one.
  • Where does the recording rule group live?: In serverFiles.devops_cli_alerting_rules.yml of k8s/devops/monitoring/prometheus-rules-values.yaml. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:14, openspec/specs/product-monitoring-content/spec.md:23, tests/prometheus/test_k8s_monitoring_alerting.py:298, k8s/monitoring/prometheus-values.yaml:202]
    • Chosen: Add the group to the product rule file. The product-monitoring-content spec puts every group that selects a devops_cli_ series in that file, and the monitoring tests load it through the merged serverFiles.
    • Rejected: Add serverFiles.recording_rules.yml to k8s/monitoring/prometheus-values.yaml. The environment file may hold no group that selects a devops_cli_ series.
    • Rejected: Add a second serverFiles key to the product file. The spec says the product file holds only devops_cli_alerting_rules.yml.
    • Rejected: Add a separate PrometheusRule resource. The chart loads its rules from serverFiles, so a second rule source adds a deployment path.
  • Which selectors get a recording rule?: The shared row work selectors: the 24-hour failed jobs, the budget used ratio and the suspended rows. The pending work selectors wait in feat(monitoring): record roadmap pending work after the queue move #4606, and the six lane alerts get no rule because the sweep removes them. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:60, docs/CLUSTER.md:45, docs/CLUSTER.md:50, k8s/devops/dashboards/devops-cli.json:322]
    • Chosen: Record the covered row work selectors only. The move changes the job for row pods, and these three selectors are shared by alerts, the dashboard and the start page.
    • Rejected: Record all job="roadmap-service" lines. The router keeps its job, so its health selectors do not break at the move.
    • Rejected: Record the six lane alerts. The sweep removes the lane poll and the lanes, so those alerts and their series go.
    • Rejected: Record the pending work selectors here. The queue move changes the series, and feat(monitoring): record roadmap pending work after the queue move #4606 holds that part.
  • Which job matcher does a row rule use?: job=~"roadmap-service|roadmap-.+". (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:48]
    • Chosen: Match the router job and roadmap-.+. It reads the current router series and the future row pods before and after the move.
    • Rejected: Match job="roadmap-service" only. The row pods get another job name, so the rule stops reading them.
    • Rejected: Match all jobs. It counts workstation and unrelated series.
  • How is the budget used ratio recorded?: One rule divides the sum of devops_cli_service_budget_spent_requests by the sum of devops_cli_service_budget_limit_requests, aggregates each side with without, and names the result ..._per_...:ratio. (best practice) [sources: https://prometheus.io/docs/practices/rules, k8s/devops/dashboards/devops-cli.json:322, src/devops_cli/config/constants.py:1822, src/devops_cli/config/constants.py:1823]
    • Chosen: Record one ratio over the spent requests and the limit. It gives the three consumers one shared series and follows the documented name form.
    • Rejected: Average the per-repo ratios. An average of ratios is not a valid measure of the whole budget.
    • Rejected: Record each side and divide in the dashboard. The alert and the start page cannot read a Grafana division, so the series would not be shared.
  • Which rule name form does the project use?: level:metric:operations. No project ADR or guideline records a form; the Prometheus practice page, fetched 2026-11-20, defines level as the aggregation level and labels, metric as the unchanged metric name, and operations as the operations newest first, and it separates a ratio's metrics with _per_ and calls the operation ratio. (best practice) [sources: https://prometheus.io/docs/practices/rules]
    • Chosen: level:metric:operations. The body requires it and the Prometheus practice documents it.
    • Rejected: Free-form names. They state no aggregation level and no operation.
    • Rejected: Underscore-separated names. They hide the three parts that the colons separate.
  • Does the change move each job="roadmap-service" line to a recorded series?: No. Only the row work selectors move. The router health selectors stay on job="roadmap-service", because the router keeps that job. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:37, k8s/devops/monitoring/prometheus-rules-values.yaml:48, docs/CLUSTER.md:129]
    • Chosen: Move the row work selectors only. The router keeps the job, so its own series do not break.
    • Rejected: Move all job="roadmap-service" lines. The router health alerts do not break at the move, and the body keeps them on the router job.
    • Rejected: Move none. The row work selectors break one by one after the move.
  • How does the change tell a row work selector from a router health selector?: A selector is row work when it reads a metric that a row pod sends: jobs, rows, GitHub requests, the budget, model requests or item age. It is router health when it reads the router itself: its identity refusal, its webhook deliveries or its pod series. The budget is row work, because the rows spend it and it moves to Valkey. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:37, k8s/devops/monitoring/prometheus-rules-values.yaml:60, k8s/devops/monitoring/prometheus-rules-values.yaml:73, docs/CLUSTER.md:45, docs/CLUSTER.md:50]
    • Chosen: Classify by the source of the metric. The move changes the job only for the pods that send the metric, so the source tells which selector breaks.
    • Rejected: Keep the budget alert on the router job. The rows spend the budget and it moves to Valkey, so the router series is not the one that changes.
    • Rejected: Move all selectors. The router keeps job="roadmap-service", so its own series do not break.
  • How does the monitoring test suite learn that a recorded series is served?: Add each record name and each metric that a rule selects to SERVED_SERIES, and add the group to RULE_GROUP_TESTS with its test file; the promtool test writes the group to the file that the test's rule_files names. [sources: tests/prometheus/test_k8s_monitoring_alerting.py:128, tests/prometheus/test_k8s_monitoring_alerting.py:145, tests/prometheus/test_k8s_monitoring_alerting.py:298, tests/prometheus/test_k8s_monitoring_alerting.py:342, tests/prometheus/test_k8s_monitoring_alerting.py:462, tests/prometheus/test_k8s_monitoring_alerting.py:480]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#4606

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/monitoring. The (monitoring) scope of the title gives the scope.
    • Priority: P2-Medium. It is a dependency for #3655 and other alert items but does not block a release on its own.
    • Value: Medium. It makes 41 raw selectors into a few recorded series, so alerts and dashboards stay correct after pod and job name changes.
    • Effort: Low. The body estimates about 2 hours and 150,000 tokens of work.
    • Related: feat(roadmap): a dashboard and alerts for the pipeline #3655, which asks for a different change. Both touch roadmap monitoring in k8s/monitoring/prometheus-values.yaml, but the candidate adds recording rules while #3655 adds the dashboard and alerts that consume them.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 5f75d25 (see proposed design in issue body).

    Moved to new items: #4606.

  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Alternatives check: covers

    Reason: Prometheus recording rules and its promtool already do everything the item needs: a recording-rule file, the documented level:metric:operations naming with without aggregation that keeps labels such as job, and promtool check rules / promtool test rules to validate and unit-test the rules in CI. The issue itself names Prometheus recording rules and promtool as the tool the project already uses, so no other tool is needed.

    Tool: prometheus/prometheus (https://github.com/prometheus/prometheus)

    • License: Apache-2.0
    • Last activity: 2026-11-11
    • Maintained: yes

    Covers:

    • Recording rules in a serverFiles rule file, loaded through the chart's rule_files
    • Documented level:metric:operations rule naming, including _per_ and ratio for ratios
    • without aggregation that preserves labels such as job, repo and row for consumers
    • promtool check rules and promtool test rules to validate and unit-test rule expressions and their series
    • Rules and alerts read one recorded series instead of a raw job="roadmap-service" selector

    Lacks:

    • The project-specific selector list, the router health / row work classification fixture and the README text are not provided by the tool and must be written by hand
    • The test wiring that adds record names to SERVED_SERIES and extends the promtool runner to the recording-rule group is repository code, not a Prometheus feature
    • No generator that derives rules from a declared list of shared selectors; each rule is written and kept by hand

    Tools considered:

    Searches run:

    • Prometheus recording rules for shared selectors used by alerts and dashboards, results: 5
    • promtool test rules unit test recording rules Prometheus, results: 5
    • promtool unit testing rules prometheus documentation, results: 5
    • prometheus recording rules best practices level:metric:operations, results: 5

    Sources:

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

  8. added
    status/new
    and removed
    status/ready
    on Nov 14, 2026
  9. 26 remaining items

  10. added 2 commits that reference this issue on Nov 24, 2026
  11. added
    status/planned
    owner/service
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/planned
    status/in-progress
    on Nov 24, 2026
  12. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    The draft pull request #6978 holds the final title and body. In mode on of roadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.

    Spend: 240 model requests, 30100438 input tokens, 177674 output tokens.

  13. removed
    owner/service
    on Nov 24, 2026
  14. removed
    status/in-review
    on Nov 24, 2026
  15. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-24 13:45 UTC

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/lowpriority/p2-mediumscope/monitoringsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions