Skip to content

fix(service): the metrics row sends too many counted requests - #6095

Merged
dan-petty merged 2 commits into
mainfrom
fix/3941-metrics-row-counted-requests
Nov 17, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/3941-metrics-row-counted-requests

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Derive taxonomy counts from open Items in the roadmap store. Query workflow runs and milestones through the GitHub session. Reduce the per-round request budget from five to four.

Closes #3941

Change: openspec/changes/archive/2026-11-17-3941-metrics-row-counted-requests/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/service The long-running devops Service and its lanes labels Nov 17, 2026
@dan-petty
dan-petty marked this pull request as ready for review November 17, 2026 03:16
The metrics row sent five requests in each round. It listed open issues
a second time to count taxonomy labels. It also queried workflow runs
and milestones through gh without conditional requests.

Derive taxonomy counts from the open Items in the roadmap store. Query
workflow runs and milestones through the GitHub session. Reduce the
per-round request budget from five to four.
The metrics row now reads the workflow runs and the milestones through
the GitHub session (#3941). The row tests faked only gh, so the session
reads got a 404, reached the network guard, or failed to mint a token
for the App. GitHubFake.serve_session answers the session GETs of the
repository through the web fake. The App tests use a real RSA key and
answer the token exchange.

The change removed one blind except from metrics.py, so the swallowed
failures ceiling of the file falls from 4 to 3.
@dan-petty
dan-petty force-pushed the fix/3941-metrics-row-counted-requests branch from 808e40d to 5f46994 Compare November 17, 2026 08:13
@dan-petty

Copy link
Copy Markdown
Owner Author

Fix of the failing checks

The branch is rebased onto origin/main (new head 5f4699456). The merge commits of main are gone.

Failure Cause Fix
test_the_metrics_job_of_the_app_reads_the_traffic_of_the_repository[read] and [refused] The change of this pull request, not a later main change: the tests pass on main. The row now reads the workflow runs and the milestones through the GitHub session. The tests faked only gh, and their App key app-key is no RSA key, so the session could not mint a token. Each read logged a warning. The tests use an RSA key made for the run and answer the token exchange. GitHubFake.serve_session answers the session reads of the repository through the web fake, as the fake answers gh.
test_the_metrics_job_walks_the_version_tags_of_its_own_clone, test_the_metrics_row_counts_the_failed_deliveries_of_the_hooks_of_its_repository (tests/roadmap/test_roadmap_run_metrics.py) and test_the_metrics_row_reads_no_status_page_and_raises_when_its_collection_fails (tests/roadmap/test_roadmap_status_rows.py) The same cause. The session reads got a 404 or reached the network guard, so the row logged warnings or did not raise. These tests also call github.serve_session(web).
swallowed failures row The change removed one blind except from src/devops_cli/github/metrics.py (4 to 3). The ratchet fails until the ceiling holds the gain. --lower sets the ceiling of the file to 3. The ratchet only went down.

Proof: uv run pytest tests/roadmap/test_roadmap_run_metrics.py tests/roadmap/test_roadmap_status_rows.py tests/github/test_github_metrics.py tests/github/test_github_metrics_request_budget.py gives 73 passed. uv run devops ci --check --only swallowed-failures,lint,format,typecheck,test-tree,docs,openspec passes. tests/roadmap tests/github tests/server tests/telemetry gives 10481 passed. One local failure, test_review_facts.py::test_the_facts_of_a_version_window, needs lizard from the review extra, which the local venv does not hold. It does not touch this change.

@dan-petty
dan-petty enabled auto-merge (squash) November 17, 2026 08:18
@dan-petty
dan-petty merged commit b3fc5dc into main Nov 17, 2026
23 checks passed
@dan-petty
dan-petty deleted the fix/3941-metrics-row-counted-requests branch November 17, 2026 08:20
dan-petty pushed a commit that referenced this pull request Nov 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.171.0](v0.170.0...v0.171.0)
(2026-11-17)


### Features

* **roadmap:** Run review scanners in the runner pod
([#6114](#6114))
([ddde85a](ddde85a))
* **service:** Roll the Service with a surge release
([#6146](#6146))
([a459b65](a459b65))


### Bug Fixes

* **k8s:** Run kube-linter on the Argo CD builds in CI
([#6112](#6112))
([dba90f1](dba90f1)),
closes [#6068](#6068)
* **k8s:** Take the k8s area of the config-read list to zero
([#6124](#6124))
([0857ee5](0857ee5)),
closes [#6119](#6119)
* **roadmap:** judge a pyproject tool setting by its diff
([#6089](#6089))
([0a787eb](0a787eb)),
closes [#3491](#3491)
* **roadmap:** Name both command registration forms
([#6148](#6148))
([0d3b1e1](0d3b1e1))
* **roadmap:** Read the files of a named pull request
([#6144](#6144))
([5a29fed](5a29fed))
* **roadmap:** refuse a placeholder group title in a plan
([#6092](#6092))
([cfd820b](cfd820b))
* **service:** the metrics row sends too many counted requests
([#6095](#6095))
([b3fc5dc](b3fc5dc))

---
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>
dan-petty added a commit that referenced this pull request Nov 19, 2026
The metrics row read every moved Item before every Item with no entry,
in the order of the open list. When 20 or more held Items moved before
each round, an Item with no entry and an Item in the 21st place never
got a read. The round now reads the Items oldest entry first: an Item
that the record does not hold, then a moved Item by the updated_at of
its entry. A deferred Item keeps its older entry, so it comes first in
the next round.

An owned Item with no entry that the cap defers has no label times in
the round, so the round skips its claim and logs no false "No labeled
event" warning. The warning for an unreadable record now says that the
round reads at most 20 Items. docs/CLUSTER.md compares the band of the
issue with the same query, with no status filter, for all repositories.
The plan states 24 requests for one new pod (#6095 set the fixed reads
to 4), drops the repeated tasks and names the live check that follows
the merge.
dan-petty added a commit that referenced this pull request Nov 19, 2026
The metrics row read every moved Item before every Item with no entry,
in the order of the open list. When 20 or more held Items moved before
each round, an Item with no entry and an Item in the 21st place never
got a read. The round now reads the Items oldest entry first: an Item
that the record does not hold, then a moved Item by the updated_at of
its entry. A deferred Item keeps its older entry, so it comes first in
the next round.

An owned Item with no entry that the cap defers has no label times in
the round, so the round skips its claim and logs no false "No labeled
event" warning. The warning for an unreadable record now says that the
round reads at most 20 Items. docs/CLUSTER.md compares the band of the
issue with the same query, with no status filter, for all repositories.
The plan states 24 requests for one new pod (#6095 set the fixed reads
to 4), drops the repeated tasks and names the live check that follows
the merge.
dan-petty added a commit that referenced this pull request Nov 19, 2026
Issue #3634 reports a metrics row that spent 627 to 1000 GitHub requests
an hour after #3601, against 222 to 305 before it, because each new pod
read the label events of every open Item again. This change keeps those
label times in `item-label-times.json` of each repository, keyed by the
`updated_at` of each Item, so a new pod reads no events of an Item that
the file holds. A round reads the events of at most 20 Items, oldest
entry first, so Items that move in each round do not keep another Item
out.

Measured cost of one new pod: 24 GitHub requests in its first round over
30 open Items, the 4 fixed reads of the row and 20 label-event reads.
The count is the sum of `devops_cli_github_requests_total` for row
`metrics` in one offline round against the GitHub fake. The plan said
25, because the fixed reads were 5 then; #6095 set
`METRICS_ROW_GITHUB_REQUEST_BUDGET` to 4.

Closes #3634

Change:
`openspec/changes/archive/2026-11-18-3634-the-age-metrics-keep-their-reads/`

---------

Co-authored-by: devops-cli-service[bot] <349441588+devops-cli-service[bot]@users.noreply.github.com>
Co-authored-by: Daniel Petty <contact@danielpetty.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/service The long-running devops Service and its lanes type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(service): the metrics row sends too many counted requests

1 participant