Skip to content

fix(monitoring): RoadmapServiceGitHubWritesHigh counts a request with no method label as a write, so it fired on 341 reads - #2583

Merged
dan-petty merged 3 commits into
mainfrom
fix/2574-writes-alert-method-matcher
Oct 29, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/2574-writes-alert-method-matcher

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

RoadmapServiceGitHubWritesHigh (group roadmap-service-activity, k8s/monitoring/prometheus-values.yaml) now selects the writes with the positive matcher method=~"POST|PUT|PATCH|DELETE", and keeps resource!="graphql". Before, it selected method!="GET". PromQL reads an absent label as the empty string, so that matcher also selected a series with no method label, and each request of that series counted as a write. On 2026-10-29 at 00:28 UTC the rule fired at 341 on reads: the pod ran an image from before #2475, so no series of the pod had the method label. Any other source of the counter without the label, such as a cluster Job from an older image, gave the same false alert.

  • The four methods are CONST_GH_MUTATION_HTTP_METHODS, the set that is_write_request reads. The code puts an upper-case HTTP method on the counter: pace_request gives method.upper(), and gh_request_method gives the method of a gh api argv, or POST for a write and GET for a read. So the set covers each write that the code can send.
  • resource!="graphql" stays, because GraphQL sends a read as a POST, and the roadmap jobs write only through REST.
  • tests/fixtures/prometheus_rules/roadmap_service_activity_tests.yaml adds a promtool case: a series with no method label and 360 requests in an hour does not fire the rule.
  • tests/test_k8s_monitoring_alerting.py pins the new expression with _window_count, and test_the_write_rule_names_each_write_method_of_the_request_classifier holds each method matcher of the rule to CONST_GH_MUTATION_HTTP_METHODS. A new write method in the classifier fails that test until the rule names it too.
  • k8s/README.md, "Roadmap service", "Alerts": the row of the rule names the write methods, says that a series with no method label does not count, and its query uses the selector of the rule.
  • The requirement "A burst of writes or of own deliveries warns" of roadmap-service-alerts names the write methods and holds that a request with no method label does not count.

Change: openspec/changes/archive/2026-10-29-2574-writes-alert-method-matcher/

Closes #2574

…GitHub write

Add the plan of #2574 as the OpenSpec change 2574-writes-alert-method-matcher.

Add the promtool case of a series with no method label and 360 requests in an hour, which must not fire RoadmapServiceGitHubWritesHigh. Pin the expression with the matcher method=~"POST|PUT|PATCH|DELETE", and hold that matcher to CONST_GH_MUTATION_HTTP_METHODS. The three tests fail on the rule of main, which selects method!="GET".
… methods, so a request with no method label is not a write

The rule selected method!="GET". PromQL reads an absent label as the empty string, so a series with no method label, such as one of a pod from before #2475, counted each of its requests as a write. On 2026-10-29 the rule fired at 341 on reads.

The rule now selects method=~"POST|PUT|PATCH|DELETE", the write methods of CONST_GH_MUTATION_HTTP_METHODS, and keeps resource!="graphql". The row of the rule in k8s/README.md names the write methods, and its query uses the selector of the rule.
Archive the change with uv run devops openspec archive. The requirement "A burst of writes or of own deliveries warns" of roadmap-service-alerts now names the write methods and holds that a request with no method label does not count.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results before the push, on the branch after the rebase onto origin/main 97ed0ea, with promtool 3.15.0:

  • uv run devops ci fail-to-pass --base origin/main: 3 tests fail on the base tree and pass on the branch: test_the_roadmap_service_activity_rules_watch_writes_own_deliveries_and_web_search, test_the_write_rule_names_each_write_method_of_the_request_classifier and test_each_unit_tested_rule_fires_on_a_sample_and_stays_quiet_on_a_normal_series[roadmap-service-activity] (the promtool case of a series with no method label fires on the old rule).
  • uv run pytest -q -n 0 tests/test_k8s_monitoring_alerting.py: 41 passed.
  • uv run devops openspec check: passed.
  • uv run devops docs check: passed.
  • Pre-push hook (fast static checks): passed.

Pending a person: after Argo CD applies the rule, read the group roadmap-service-activity on the Alerts page of Prometheus, and check that RoadmapServiceGitHubWritesHigh does not fire on the series with no method label.

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 01:11
@dan-petty
dan-petty merged commit 6dc3aa7 into main Oct 29, 2026
17 checks passed
@dan-petty
dan-petty deleted the fix/2574-writes-alert-method-matcher branch October 29, 2026 01:17
dan-petty pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.13.0](v0.12.0...v0.13.0)
(2026-10-29)


### Features

* **gh:** devops gh issues close records the close reason and a comment
([#2575](#2575))
([97ed0ea](97ed0ea)),
closes [#1658](#1658)
* **monitoring:** the ai spend dashboard counts gateway traffic from the
gateway's own series, shows failed attempts and names each caller
([#2584](#2584))
([33491ca](33491ca))
* **roadmap:** refine writes each criterion as an OpenSpec requirement
([#2591](#2591))
([d9a869f](d9a869f))
* **sandbox:** sandbox commands take a seccomp profile file
([#2588](#2588))
([46958d4](46958d4))


### Bug Fixes

* **monitoring:** RoadmapServiceGitHubWritesHigh counts a request with
no method label as a write, so it fired on 341 reads
([#2583](#2583))
([6dc3aa7](6dc3aa7)),
closes [#2574](#2574)


### Performance Improvements

* **ci:** the gate writes no coverage XML, and the clean-up keeps the
combined data
([#2582](#2582))
([ae9ebb2](ae9ebb2)),
closes [#1743](#1743)
* **roadmap:** intake's embeddings are cached in a password-protected
Valkey in the cluster
([#2578](#2578))
([bfe8a0c](bfe8a0c))


### Code Refactoring

* **devcontainer:** remove the DEVOPS_CLI_SKIP_TOOL_BOOTSTRAP test
switch from product code
([#2580](#2580))
([7e7272e](7e7272e))
* **lint:** lazy exports import names under TYPE_CHECKING
([#2590](#2590))
([c96dbfe](c96dbfe)),
closes [#2010](#2010)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(monitoring): RoadmapServiceGitHubWritesHigh counts a request with no method label as a write, so it fired on 341 reads

1 participant