Repository navigation
Description
Problem
Intake has no counter of placed, skipped, failed or duplicate-flagged candidates. The implement job has no timer for the scoped checks, the publish step and the watch of the PR checks. The scoped checks take about 3.5 minutes. The watch takes up to 3600 s. Nobody can see which of them is slow.
Expected
Intake. Add the counter devops_cli_roadmap_intake_candidates_total with the labels repo and result. The values of result are placed, skipped, failed and duplicate. apply_intake adds 1 for each candidate. Series count: 4 per repo.
Implement. Use the histogram devops_cli_roadmap_step_seconds of the issue #4066, with row set to implement. Add three StepName members: checks, publish and watch. The implement job times:
checks: the scoped checks (_scoped_checks);publish: the push and the draft PR;watch: the watch of the PR checks (watch_pull).
result is ok or error. Series count: 3 steps x 2 results = 6 per repo, times the histogram buckets.
Document both series in docs/TELEMETRY.md. State the series counts there.
The implement Job runs in a runner pod. Check that the Job sends its samples to the collector before it ends. If it does not, the pull request says so and times the steps in the Service from the log of the Job instead.
No live model run (AGENTS.md rule 13).
Acceptance criteria
-
uv run pytest tests/telemetry/test_roadmap_intake_implement_metrics.py -k intake_outcome- intake emits one outcome counter for each candidate, with itsresult. -
uv run pytest tests/telemetry/test_roadmap_intake_implement_metrics.py -k implement_step- the scoped checks, the publish step and the watch each emit one histogram sample withrow=implement. -
uv run pytest tests/telemetry/test_roadmap_intake_implement_metrics.py -k step_names- the step values are members ofStepName. -
grep -q 'devops_cli_roadmap_intake_candidates_total' docs/TELEMETRY.md- the documentation lists the new counter (it prints nothing today).
Every command above fails on the unchanged code. The pull request cites the fail-to-pass run (devops ci fail-to-pass --base <ref>).
Feasibility
I read these files at origin/main: intake.py (apply_intake), implement_run.py (_scoped_checks, _push, _checks), implement_pull.py (watch_pull), telemetry/instruments.py and docs/TELEMETRY.md. I did not run the code. I did not check how a runner pod sends telemetry. That is why the pull request must check it.
The change makes no GitHub request.
Existing tool considered
telemetry/instruments.py (emit) and tool_metrics.py as the pattern. No new library.
Cost
Build: about 45k tokens and 2.5 h. Keep: about 3k tokens per quarter. Fix: about 10k tokens and 0.5 h.
Related
Part of #3027. #3069, #3650, #3655, #3076. Order: after the issues #4061 and #4066.
Proposed design
Problem statement
Intake does not count the candidates that it places, skips, fails or flags as duplicates. The implement job does not time the scoped checks, the publish step or the watch of the pull request checks. The roadmap cannot see which phase is slow. This change adds one intake outcome counter and three implement step timings, and it documents both metric series.
Acceptance criteria
Requirement: Intake outcome counter
apply_intake SHALL add one to devops_cli_roadmap_intake_candidates_total for each candidate, with the repo label and the result label set to placed, skipped, failed or duplicate.
Scenario: Each intake outcome counts once
- WHEN a test runs
apply_intakeover four candidates that give the resultsplaced,skipped,failedandduplicate - THEN the counter holds one increment for each result, with the label of the repository
Requirement: Declared intake instrument
devops_cli_roadmap_intake_candidates_total SHALL be an entry of INSTRUMENTS with kind counter and unit 1, and each count SHALL go through emit.
Scenario: The instrument registry holds the counter
- WHEN a test reads
INSTRUMENTS - THEN it holds
devops_cli_roadmap_intake_candidates_totalas a counter with unit1
Requirement: Intake series start at zero
The intake row SHALL send a zero value for each of the four results for a repository before its first candidate.
Scenario: Four series exist for each repository
- WHEN the intake row starts for a repository that has no candidate with the result
duplicate - THEN the counter holds a zero value for that repository and the label
result=duplicate
Requirement: Implement step samples
The implement job SHALL record one devops_cli_roadmap_step_seconds sample with row=implement for each call of _scoped_checks, of the publish and of watch_pull.
Scenario: Each implement step emits one sample
- WHEN a test runs the implement job with a fake scoped check, a fake push and a fake watch
- THEN the histogram holds one sample for each of the steps
checks,publishandwatchwithrow=implementandresult=ok
Requirement: Implement step error result
The implement job SHALL set result=error on a step sample when the step raises an error or its checks fail.
Scenario: A failed step records an error
- WHEN the scoped checks raise an error
- THEN the histogram holds one
checkssample withrow=implementandresult=error
Requirement: Publish excludes checks
The publish timer SHALL measure only the push and the draft pull request.
Scenario: Scoped check time stays out of publish
- WHEN the scoped checks take 10 seconds and the push takes 2 seconds
- THEN the
checkssample is at least 10 seconds and thepublishsample is about 2 seconds
Requirement: StepName members
StepName SHALL hold the members checks, publish and watch.
Scenario: Step names are enum members
- WHEN a test reads
StepName - THEN
StepName.checks,StepName.publishandStepName.watchexist and equalchecks,publishandwatch
Requirement: Telemetry documentation
docs/TELEMETRY.md SHALL list devops_cli_roadmap_intake_candidates_total and devops_cli_roadmap_step_seconds with their series counts.
Scenario: Documentation names both series
- WHEN a test reads
docs/TELEMETRY.md - THEN the file contains both metric names, four intake series per repository and six implement series per repository
Existing Tool Considered
No alternatives check has run. The OpenTelemetry Python SDK, through src/devops_cli/telemetry/instruments.py and emit, covers the need. It lacks the roadmap metric names, the repo, result and step labels and the three step values, which this change adds. The change builds its own code: about 45k tokens and 2.5 h to build, about 3k tokens per quarter to keep, and about 10k tokens and 0.5 h to fix.
Key questions
- Does the implement Job send its metric samples to the collector before it ends?: Yes. A cluster job pod exports its metrics once when it exits. The SDK flushes one OTLP batch when the command finishes. The collector adds the deltas, and Prometheus stores the series. The fallback in the body is not needed. The pull request reports the samples that the collector received. [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/instruments.py]
- Does
devops_cli_roadmap_step_secondsalready exist for the implement row?: Yes. Issue feat(telemetry): step seconds and a gate counter for the stage row #4066 delivereddevops_cli_roadmap_step_secondswith unitsand the labelsrepo,row,stepandresult. Its description already names the implement row and this issue. This change adds the samples and the step values only. [sources: src/devops_cli/telemetry/instruments.py, docs/TELEMETRY.md] - How many series does
devops_cli_roadmap_step_secondsadd for one repository?: Six series: three steps times two results. Prometheus 3 stores an exponential histogram as a native histogram under the instrument name. The buckets add no series, so the phrasetimes the histogram bucketsin the body does not hold. [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/instruments.py] - Which instrument and labels should the intake outcome use?: Add the counter
devops_cli_roadmap_intake_candidates_totalwith the labelsrepoandresult, and the valuesplaced,skipped,failedandduplicate. (best practice) [sources: src/devops_cli/telemetry/instruments.py, docs/TELEMETRY.md, src/devops_cli/roadmap/intake/intake.py]- Chosen: A new counter with
repoandresult. It gives one count for each candidate outcome and four series for each repository. - Rejected: Reuse
devops_cli_roadmap_row_seconds. It measures the time of a row and gives no count of candidate outcomes.
- Chosen: A new counter with
- Where do the three
StepNamemembers go?: Addchecks,publishandwatchto theStepNameStrEnum insrc/devops_cli/roadmap/failure.py. (best practice) [sources: src/devops_cli/roadmap/failure.py, src/devops_cli/roadmap/step_metrics.py, openspec/changes/archive/2026-11-08-4056-record-the-failure-class-and-step/design.md]- Chosen: Add the members to
StepName. The step values stay one-word members of the step enum that the failure record and the step metrics share. - Rejected: Use free-form strings for the step values. A free-form value bypasses the enum check and invites spelling variants.
- Rejected: Add a second enum in the implement module. Two step enums split the step values that the failure record and the metrics share.
- Chosen: Add the members to
- Where should the
publishtimer start and end?: Start thepublishtimer after_scoped_checksreturns, and stop it after the push and the draft pull request exist. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, openspec/changes/archive/2026-11-01-3043-runner-hooks-and-scoped-ci/design.md]- Chosen: Time the push and the draft pull request only.
_pushruns_scoped_checksfirst, so a timer around_pushwould count the checks twice. - Rejected: Time all of
_push. It includes the scoped checks and makes thepublishsample overlap thecheckssample.
- Chosen: Time the push and the draft pull request only.
- What does
result=errormean for a timed implement step?: Useokwhen the step returns without an error and its checks pass. Useerrorwhen it raises an error or its checks fail. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/roadmap/implement/implement_run.py]- Chosen: Error on an exception or a failed check. A failed check must show as an error, not only an exception.
- Rejected: Error on an exception only. A failed check would look successful and hide the slow or broken step.
- Should the intake row send a zero for each result before its first candidate?: Yes. The Service starts each label set of its counters at zero (fix(telemetry): Service counters read true across pods and repos #3495). The four series then exist for each repository, and the first count lies in a series. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/instruments.py]
- Chosen: Send zero for each of the four results at the start of the row. The four series exist for each repository, and the first count of a result shows.
- Rejected: Send only the results that occur. A result that no candidate has gives no series, and a series with one sample can drop from a rate or increase query.
- Does the
checkstimer cover the fix rounds inside_scoped_checks?: Yes. One sample covers each call of_scoped_checks, with its fix rounds. A sample is one call of the step. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, docs/TELEMETRY.md]- Chosen: One sample for each call of
_scoped_checks. The method is the step that the body names, and one sample is one call. - Rejected: One sample for each scoped check run. The body names three steps and six series, so a second sample per run breaks the count.
- Chosen: One sample for each call of
Fit
Fits in one pull request.
Suspected block
None.
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.
featprefix of the title gives the type.(telemetry)scope of the title gives the scope.It improves observability of the implement job but does not block a release or fix a defect.Operators gain per-step timing and an intake outcome count, which aids debugging slow runs.The body estimates about 2.5 hours of build work across intake, implement, and docs files.Both use the histogram devops_cli_roadmap_step_seconds and the StepName enum; #4066 creates the instrument for stage, while this candidate adds checks, publish, and watch members and wires the implement job to emit samples.devops-cli-service commentedon Nov 8, 2026
Refine cannot set this item to Ready at ba4679c while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/telemetry/instruments.py.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at fe1d00b (see proposed design in issue body).
feat(telemetry): count intake outcomes and time implement steps (#4187)
devops-cli-service commentedon Nov 8, 2026
Released in v0.95.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.95.0
devops-cli-service commentedon Nov 8, 2026
Live since 2026-11-08 22:36 UTC