Skip to content

perf(test): evaluate hour-scale promtool tests every hour #4456

Closed

Description

@dan-petty

Problem Description

One case of the test row takes more time than any other test: tests/prometheus/test_k8s_monitoring_alerting.py::test_each_unit_tested_rule_fires_on_a_sample_and_stays_quiet_on_a_normal_series[roadmap-service-activity]. It runs promtool test rules on tests/fixtures/prometheus_rules/roadmap_service_activity_tests.yaml.

That file sets evaluation_interval: 1m. Seven of its 16 test groups use interval: 1h series and an eval_time of 150 h or 200 h, for the alert RoadmapServiceAlternativesNotSearching (ranges of 3 d and 7 d, added by #3870 on 2026-11-07). promtool evaluates every rule of the group at each evaluation interval from 0 to the last eval_time of a test group. Thus each of these groups makes 9,000 to 12,000 evaluation rounds of the 4 rules of the group.

The other files with hour-scale cases already set evaluation_interval: 1h: research_tests.yaml, roadmap_service_tools_tests.yaml and ai_spend_tests.yaml.

With --dist worksteal, the local test row cannot end before its slowest test, so this one case puts a floor under the test row. In CI it is the slowest test of its shard.

Reproduction Steps

  1. Run uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k "test_each_unit_tested_rule and activity" -n0 --durations=5.
  2. Read the time of the [roadmap-service-activity] case.

Expected vs Actual Behavior

Expected: each promtool case takes a few seconds, as the cases of the other groups do.

Actual:

Where Time of the case
GitHub runner, shard 3 of run 42938256840 on main (2026-11-11) 63.8 s
Local gate logs of the last 5 days, 24 runs under load median 147 s, max 263 s
promtool test rules on the file as it is (local, load 40 to 75) 166 s CPU
The same 16 groups split in two files, 1m and 1h 6.7 s CPU together

Both split files pass with SUCCESS.

Proposed fix

  1. Move the 7 hour-scale test groups to a new file tests/fixtures/prometheus_rules/roadmap_service_activity_hourly_tests.yaml with evaluation_interval: 1h. Keep the minute-scale groups in the old file.
  2. Let one rule group have more than one promtool test file. Each file tests only alerts of its group, and the files of a group together test every alert of the group.
  3. Add a guard test: no promtool test group evaluates more than a fixed number of rounds (its last eval_time divided by the evaluation_interval of its file). The guard reads the durations with the existing devops_cli.prometheus.client.parse_duration. It fails on the file as it is (12,000 rounds) and passes after the split.

The fix changes only tests and test fixtures. It does not change k8s/monitoring/prometheus-values.yaml.

Environment Diagnostics

Devcontainer on WSL2, 16 CPUs, promtool 3.15.1. CI installs the pinned promtool in each test shard (Install promtool step of ci.yml).

Logs, Traces, or Terminal Output

Found by the measurement of #4405. Related: #4250 balances the shards by measured time; this fix removes the slowest single test.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Activity

  1. added
    source/agent
    type/infra
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  2. 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/infra. The perf prefix of the title gives the type.
    • Scope: none. The title has the scope test, and .github/labels.yml declares no scope/test label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. It removes the slowest single test from the CI row but does not block any release.
    • Value: Medium. It removes a 160-second floor under the test row and the slowest test in CI.
    • Effort: Medium. It requires splitting a fixture file, updating test code for multi-file groups, and adding a guard test.
    • Related: fix(ci): test shards take up to 11 minutes, over the budget #4250, which asks for a different change. Both reduce CI test time, but #4250 balances shard assignments while the candidate shortens one specific test by splitting its fixture file.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 11, 2026
  4. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 05:46 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/mediumpriority/p2-mediumsource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions