Skip to content

feat(telemetry): an intake outcome counter and implement step seconds #4067

Closed

Description

@dan-petty

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 its result.
  • 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 with row=implement.
  • uv run pytest tests/telemetry/test_roadmap_intake_implement_metrics.py -k step_names - the step values are members of StepName.
  • 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_intake over four candidates that give the results placed, skipped, failed and duplicate
  • 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_total as a counter with unit 1

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, publish and watch with row=implement and result=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 checks sample with row=implement and result=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 checks sample is at least 10 seconds and the publish sample 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.publish and StepName.watch exist and equal checks, publish and watch

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_seconds already exist for the implement row?: Yes. Issue feat(telemetry): step seconds and a gate counter for the stage row #4066 delivered devops_cli_roadmap_step_seconds with unit s and the labels repo, row, step and result. 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_seconds add 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 phrase times the histogram buckets in 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_total with the labels repo and result, and the values placed, skipped, failed and duplicate. (best practice) [sources: src/devops_cli/telemetry/instruments.py, docs/TELEMETRY.md, src/devops_cli/roadmap/intake/intake.py]
    • Chosen: A new counter with repo and result. 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.
  • Where do the three StepName members go?: Add checks, publish and watch to the StepName StrEnum in src/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.
  • Where should the publish timer start and end?: Start the publish timer after _scoped_checks returns, 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. _push runs _scoped_checks first, so a timer around _push would count the checks twice.
    • Rejected: Time all of _push. It includes the scoped checks and makes the publish sample overlap the checks sample.
  • What does result=error mean for a timed implement step?: Use ok when the step returns without an error and its checks pass. Use error when 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 checks timer 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.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4061

Activity

  1. added
    source/agent
    type/feature
    scope/telemetry
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/telemetry. The (telemetry) scope of the title gives the scope.
    • Priority: P2-Medium. It improves observability of the implement job but does not block a release or fix a defect.
    • Value: Medium. Operators gain per-step timing and an intake outcome count, which aids debugging slow runs.
    • Effort: Medium. The body estimates about 2.5 hours of build work across intake, implement, and docs files.
    • Related: feat(telemetry): step seconds and a gate counter for the stage row #4066, which asks for a different change. 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.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    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.

  5. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  6. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at fe1d00b (see proposed design in issue body).

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 8, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 8, 2026
  9. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 22:36 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/telemetrysource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions