Skip to content

feat(telemetry): measure how long roadmap items wait in each state - #3601

Merged
dan-petty merged 21 commits into
mainfrom
feat/2919-stuck-item-age-metrics-and-one
Nov 5, 2026
Merged

dan-petty merged 21 commits into
mainfrom
feat/2919-stuck-item-age-metrics-and-one

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Nothing shows how long a roadmap item waits in a state. Items wait in Ready, in Planned and as stopped drafts for hours or days before a person sees them.

This change adds three gauges. They are the age of the oldest open item in each state, the number of that item, and the age of the oldest claim. The metrics row of the Service sends them per repository. The age starts at the time of the label event that set the current label. The row reads those events only when a status or owner label changes.

This change adds one alert, RoadmapServiceItemStuck. It fires for an item that waits in blocked, or in ready with a plan, for more than 24 hours. The alert names the item. The change also adds one panel, Oldest Item Age by State, to the project dashboard.

Closes #2919

Change: openspec/changes/archive/2026-11-05-2919-stuck-item-age-metrics-and-one/

Record the decisions on the open questions of the plan: the alert window, the plan flag, items with no labeled event, the status cache limit and the stopped pod limit. Correct the line references. Re-check the premise on origin/main.
Declare three gauges. The item age and the item number take the labels repo, state and plan. The claim age takes repo. Tick tasks 1.1 and 1.2 and move each verification into a nested line.
Add label_changes to the roadmap store. The GitHub store reads the issue's own events listing. The in-memory store returns the changes its writes recorded. Tick tasks 2.1 and 2.2.
Compute the age of the oldest open item in each state and plan pair, its number, and the age of the oldest claim, from the labeled events of each item. A failed read sends no age and keeps the other metrics. Tick tasks 3.1 and 3.2.
The metrics row asks for the age of the oldest item in each state. A run from a workstation does not ask for it. Tick tasks 4.1 and 4.2.
Add the rule group roadmap-service-items with RoadmapServiceItemStuck. It fires for a blocked item, or a ready item with a plan, older than 24 hours, and names the item. The promtool unit tests cover the five cases of the spec. Tick tasks 5.1 and 5.2.
Add the panel Oldest Item Age by State beside the items panels, and move the rows below it down by 8. A test checks the queries, the unit, the grid position and that no panel overlaps another. Tick tasks 6.1 and 6.2.
Regenerate docs/TELEMETRY.md from the instrument descriptions. Tick task 7.1.
Archive the change folder and merge its spec deltas into the project metrics dashboard and roadmap service alerts specs.
This reverts commit 87a96a6befa050ad3ae30bbbf0e445fc8eec1974.
The summary of RoadmapServiceItemStuck printed "Item # of <repo>" when
the number series was missing. The sign now sits inside the conditional
block, so the summary reads "Item of <repo>" in that case (#2919).
A round of one repository cleared the cached label times of every
other repository. The cache now drops only the entries of the
repository that the round reads (#2919).

The label slug rule now lives once, in label_slug of roadmap/store.py.
The metrics module uses it for the state label.
The descriptions of the item age and the oldest item number gauges
had sentences over the ASD-STE100 limit. The text is shorter and the
meaning is the same. docs/TELEMETRY.md is generated from the new text
(#2919).
The description of RoadmapServiceItemStuck is shorter. It keeps the
runbook pointer and the command that a person runs (#2919).
The age metrics read the label events of an open item. The rejected
option named that read as a cost, so the note records the change-only
reads that keep the steady cost low (#2919).
The runbook named three promtool fixtures and missed the fixture of
the item age group. It now names all four, and its sentences are
shorter (#2919).
The proposal, design, tasks and spec deltas had sentences over the
ASD-STE100 limits. The text is split into shorter sentences, and the
requirements, scenarios and task checks keep their meaning. The
design now states that the ADR has a note for the item age reads
(#2919).
Archives the change of issue #2919 and merges its spec deltas into
openspec/specs.
@dan-petty dan-petty added type/feature Type feature: a new function scope/telemetry OpenTelemetry tracing spans, Prometheus metrics, and Jaeger labels Nov 5, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Publish notes for issue #2919

Result. All 23 GitHub checks pass on commit b1ee73b. This pull request stays a draft. The stage recommendation is draft, and a person has not reviewed the diff yet.

Local checks

  • The branch is rebased onto origin/main d254410. The rebase had no conflicts.
  • uv run devops ci test on the eight changed test files: 516 passed.
  • uv run devops docs check: all documentation files are up to date.
  • A fix to the generated text of two instrument rows (commit a0b6d59) was made after the earlier runs. tests/telemetry/test_telemetry_instruments.py: 51 passed.
  • Full uv run devops ci: pytest reported 18654 passed, 2 skipped, 4 failed and 1 error. The failures are the known host-state tests of issues fix(ci): host state fails four tests and one case #3585 and fix(ci): the pytest step of devops ci exceeds the 5-minute budget #3593. They are in tests/crypto/test_ssh.py, tests/telemetry/test_config_env_overrides.py, tests/commands/test_devcontainer_install_tools_dry_run.py and tests/ai/test_tool_executor_contract.py. No other check failed. The coverage row shows fail. The log reads "Required test coverage of 85.0% reached. Total coverage: 94.50%".
  • The full run started before the last two commits. It waited for the CI gate. The GitHub checks ran on b1ee73b and passed.
  • The pytest step took 6 minutes 51 seconds. The budget is 5 minutes. Issue fix(ci): the pytest step of devops ci exceeds the 5-minute budget #3593 covers this, and a comment with this measurement is added there.

Fail-to-pass. The replay uv run devops ci fail-to-pass --base origin/main gave this result. Five tests fail on the base. Three test modules fail to collect on the base. 261 tests pass on the base. The GitHub check is skipped, because the title is a feat, not a fix.

Deviations.

  • The finish CI log held no result. It stopped at a wait for the CI gate. The full run in this publish stage is the first complete local run.
  • A generated text defect was found and fixed. The rows devops_cli_roadmap_item_age_seconds and devops_cli_roadmap_oldest_item_number in docs/TELEMETRY.md ended with two periods. The source descriptions now end with one period.
  • The archive was reverted and written again, as the history rule asks. The archive is the last commit, b1ee73b.

Open items.

  1. A person reviews the diff. The archived tasks list this step.
  2. The four host-state tests and the one error stay open in fix(ci): host state fails four tests and one case #3585 and fix(ci): the pytest step of devops ci exceeds the 5-minute budget #3593. They do not come from this change.
  3. The suite takes more than 5 minutes. Issue fix(ci): the pytest step of devops ci exceeds the 5-minute budget #3593 tracks it.
  4. A person decides when the pull request is ready. The stage recommendation is draft.

@dan-petty
dan-petty marked this pull request as ready for review November 5, 2026 09:49
@dan-petty
dan-petty merged commit 05c9ebd into main Nov 5, 2026
23 checks passed
@dan-petty
dan-petty deleted the feat/2919-stuck-item-age-metrics-and-one branch November 5, 2026 12:05
dan-petty pushed a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.61.0](v0.60.0...v0.61.0)
(2026-11-05)


### Features

* **roadmap:** check each behavior group fails on base before the change
([#3602](#3602))
([7b8a4a1](7b8a4a1))
* **roadmap:** the inbox lists every person wait of each service repo
([#3616](#3616))
([b81913b](b81913b))
* **telemetry:** measure how long roadmap items wait in each state
([#3601](#3601))
([05c9ebd](05c9ebd))


### Bug Fixes

* **github:** send a GET again when its connection is lost
([#3608](#3608))
([4528f49](4528f49))
* **roadmap:** accept a clean merge by a person on a branch
([#3603](#3603))
([4fff490](4fff490))
* **roadmap:** the stage job waits for an open plan that creates a path
([#3613](#3613))
([7e66373](7e66373))

---
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 14, 2026
Issue #3794 pins the GitHub request budget of one metrics-row round. The
row must stay near its pre-#3601 level of about 222 to 305 requests an
hour over a period with two rollouts. The live measurement needs two
deployments, so a pull request cannot take it. The offline test in this
change pins the five reads of one round with one page of each listing,
and fails on a new read or an extra page.

Closes #3794

Change:
`openspec/changes/archive/2026-11-14-3794-pin-metrics-row-request-budget/`
dan-petty added a commit that referenced this pull request Nov 16, 2026
…5850)

Issue #3634 reports that the metrics row 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: the only copy of
those times was the process dict `_item_label_times`. The 2000-request
hourly budget holds every row, so the age metrics crowd out the others,
and each rollout adds to the cost. The change keeps those times in
`item-label-times.json` of each repository, versions each entry by the
Item's `updated_at`, and caps the label-event reads of one round at 20.
An offline test measures one new pod at 25 requests in its first round
over 30 open Items: the 5 fixed reads of the row plus the 20 reads of
the cap.

Plans #3634

Change: `openspec/changes/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>
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/telemetry OpenTelemetry tracing spans, Prometheus metrics, and Jaeger type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(telemetry): stuck-item age metrics and one alert for the roadmap

1 participant