Repository navigation
Description
Problem
The row metrics of the roadmap Service is the largest source of requests that GitHub counts. Prometheus, 2026-11-07, one hour, job="roadmap-service", status other than 304: metrics 288, refine 286, other 236, implement 139. The row runs every 13 minutes for each repository (DEFAULT_ROADMAP_METRICS_INTERVAL_MINUTES).
Per round, collect_project_metrics_report (src/devops_cli/github/metrics.py) reads the workflow runs (repos/<repo>/actions/runs), the milestones (repos/<repo>/milestones?state=all), the open issues for the label taxonomy (repos/<repo>/issues?state=open, paginated) and the traffic, all through GhCliClient.api. A gh command has no ETag cache, so it always counts: its status is none. It then reads the Items and the label events of the Items whose status changed. The open issues are read again by the store.
Expected
The row reads through the GitHub session, which sends a conditional request (#3497), so an unchanged answer is a 304 that GitHub and the Service budget do not count (#3939). The taxonomy counts come from the Items that the store has already read, with no second listing.
Acceptance criteria
- A test shows that one metrics round of a repository sends no second listing of the open issues.
- A test shows that the workflow runs and milestones are read through the session.
- After the change is live,
sum(increase(devops_cli_github_requests_total{job="roadmap-service", row="metrics", status!="304"}[1h]))is lower than 288, and the issue records the result.
Existing tool considered
The GitHub session with ETags (#3497) already exists. No library is needed.
Related
Related: #3939, #3794 (the cost of this row over two rollouts), #3497.
Proposed design
Problem statement
The metrics row of the roadmap Service sends 288 counted requests in one hour. It uses GhCliClient.api, which has no ETag cache, and it lists open issues again after the store has read them. The change reads workflow runs and milestones through the existing GitHub session with conditional requests. It also derives taxonomy counts from the open Items that the store already holds.
Acceptance criteria
Requirement: Store-derived taxonomy
The metrics collector SHALL derive taxonomy counts from the open Items that the roadmap store already holds.
Scenario: No second open issue listing
- WHEN one metrics round runs for a repository with a roadmap store
- THEN the collector sends no request to
repos/<repo>/issues?state=openand the taxonomy counts match the labels of the open Items in the store.
Requirement: Session-based workflow run read
The metrics collector SHALL read workflow runs through the GitHub session that sends conditional requests.
Scenario: Workflow runs use the session
- WHEN the metrics collector reads workflow runs for a repository
- THEN the read goes through the session and makes no uncached
gh api repos/<repo>/actions/runscall.
Requirement: Session-based milestone read
The metrics collector SHALL read milestones through the GitHub session that sends conditional requests.
Scenario: Milestones use the session
- WHEN the metrics collector reads milestones for a repository
- THEN the read goes through the session and makes no uncached
gh api repos/<repo>/milestonescall.
Existing Tool Considered
No alternatives check has run. The existing GitHub session with ETags (#3497) covers the need for conditional requests, and no library is needed. It is project code, and it lacks nothing this issue needs. The change reuses that session and builds no new request layer.
Key questions
- Does the repository already have a GitHub session that sends conditional requests?: Yes. The GitHub session with ETags from fix(service): the rows stop repeating reads that find no change #3497 exists, and ADR 0003 requires polling to use conditional requests so an unchanged answer costs nothing. [sources: docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md, src/devops_cli/github/client.py]
- How should the metrics collector get the GitHub session for workflow run and milestone reads?: Add an optional session argument to
collect_project_metrics_report,get_ci_workflow_metricsandget_milestone_metrics. The report passes one session to both readers, so they share its ETag cache. A direct caller that passes no session gets a new session. (best practice) [sources: src/devops_cli/github/metrics.py, src/devops_cli/github/client.py, docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md]- Chosen: Pass one session from the report. It shares the ETag cache and keeps the row on one conditional-request path.
- Rejected: Create a session in each reader. It splits the cache and can send duplicate requests for the same round.
- Rejected: Keep
GhCliClient.api. It has no ETag cache, so every call counts.
- Where should the taxonomy counts come from, and should the old issue listing stay?: Change
get_label_taxonomy_metricsto count the open Items that the roadmap store already holds. Count each label that contains/and group it by its prefix. Do not keep the old open-issue listing, because the project removes replaced paths before 1.0. (best practice) [sources: src/devops_cli/github/metrics.py, docs/adr/0001-github-is-the-roadmap-source.md]- Chosen: Count open Items in the store. The store has already read the issues, so the round sends no second listing.
- Rejected: Keep the open-issue listing. It is the second paginated read that this issue removes.
- Rejected: Add a second taxonomy cache. It duplicates the store and adds a second source of truth.
- Does the metrics command still have a store when no store is passed?: Yes.
collect_project_metrics_reportcallsroadmap_store.get_roadmap_store(target_repo)whenstoreis None, so the command uses the same store-derived taxonomy. [sources: src/devops_cli/github/metrics.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-09: none.
Tool: none found.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(service)scope of the title gives the scope.The metrics row is the largest source of counted requests and risks budget exhaustion, but the service still functions.Reducing counted requests prevents budget warnings and keeps the service responsive under load.Requires changing the read path to use the session, removing a duplicate listing, and adding two tests.Both reduce the metrics row's counted request cost, but #3939 changes the budget counting logic while the candidate changes the metrics row to use the session for conditional requests.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 4f3c45c (see proposed design in issue body).
Moved to new items: #4118.
devops-cli-service commentedon Nov 9, 2026
Alternatives check: none
Reason: Searches for a Python GitHub client or HTTP cache that sends conditional requests found only generic protocol documentation on ETags and 304 responses, not an open, maintained library that could be dropped into this row. The need here is internal wiring — route the workflow-run and milestone reads through the project's own GitHub session with ETags (#3497) and derive the taxonomy counts from the store the round already read — and the issue states that no library is needed, so nothing external covers it.
Tool: none found
Lacks:
Searches run:
Sources:
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
fix(github): count each page of a paginated GitHub read (#5070)
test(service): answer the session reads of the metrics row in its tests
devops-cli-service commentedon Nov 17, 2026
Released in v0.171.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.171.0
devops-cli-service commentedon Nov 17, 2026
Live since 2026-11-17 09:25 UTC
dan-petty commentedon Nov 19, 2026
New evidence from the Service config review of 2026-11-19: the
metricsrow is above the target of this issue again.metricsrow. The row now sends about 821 an hour: 19,707 of about 72,800 counted Service requests in 24 h (27%), the largest single row. A re-run on 2026-11-19 gave 804 an hour. Query:sum(increase(devops_cli_github_requests_total{job="roadmap-service",row="metrics",status!="304"}[24h])) / 24.Plan: no change of
roadmap.metrics.interval_minutesnow. Draft PR #6326 (for #3634) removes one restart cost of this row, the per-process_item_label_timescache (src/devops_cli/github/metrics.py:517). After #6326 is live, measure the row again. If it is still above 288 an hour, a slower cadence is one option, but it must keep a sample ofdevops_cli_roadmap_stalled_itemsin the window of the alertRoadmapServiceItemStuck.