Repository navigation
Description
Problem
#3495 makes the roadmap run count devops_cli_service_jobs_total for each row of a lane, and removes the count of the whole lane batch from the worker. A round can fail before its first row runs. Examples: service_job cannot get the roadmap store of the repository, or _fetch_filtered_changes in run_due_jobs fails while it reads the changes (src/devops_cli/roadmap/run.py).
Such a round counts no job. The worker logs Service job execution failed and counts devops_cli_service_job_seconds_total, but no series of the job counter grows. So RoadmapServiceJobsFailing does not fire when each round of a repository fails at this level, for example when the listing of changes fails. RoadmapServiceLaneStalled does not fire either, because the worker still sets the job start of the lane.
Expected
A round that fails before its first row is visible to a person through a counter and an alert. The failure of the round has a bounded label set, it starts at zero like the other Service counters, and it is not mixed with the job count of a row.
Acceptance criteria
- A test: a round that fails before its first row adds 1 to a series that names the repository and the lane.
- A test: that series exists at 0 after the start of the Service.
- A test: a round that the stop of the Service ends does not count as a failure.
- A promtool test: an alert fires when each round of a repository and lane fails before its first row, and no row runs.
docs/TELEMETRY.mdandk8s/README.mdstate the series and its labels, and the alert has a row in the alert table.
Existing tool considered
prometheus_client and promtool, which the Service and its rule tests use now. The change needs no new tool. One choice to compare: a reserved value of the label row on devops_cli_service_jobs_total, or a separate counter of failed rounds.
Related
Alternatives check of 2026-11-25: in-use.
The repository already uses this tool.
Tool: prometheus-client (https://pypi.org/project/prometheus-client), Apache-2.0 AND BSD-2-Clause, last activity 2026-07-24, maintained.
Reason: The searches and the package facts confirm prometheus-client, already used by the Service and its rule tests, provides the labeled counter and the zero-primed series the issue needs; only the pre-row detection stays repository code.
Covers:
- Counter with bounded repo and lane labels
- Series primed at zero when the Service starts
- Scrape endpoint that feeds Prometheus alert rules
Lacks:
- Detecting a round that failed before its first row
- Excluding a Service stop or a post-row failure
- Dashboard query, alert rule and their tests
Proposed design
Problem statement
A Service round can fail before its first row runs. service_job can fail while it gets the roadmap store of the repository (src/devops_cli/roadmap/run.py:2112), and run_due_jobs can fail in _fetch_filtered_changes while it reads the changes, before _execute_due_rows starts (src/devops_cli/roadmap/run.py:2053). No series of devops_cli_service_jobs_total grows in that case, so RoadmapServiceJobsFailing does not fire, and RoadmapServiceLaneStalled does not fire either because the worker still sets the job start of the lane (src/devops_cli/server/service.py:700). This change adds the counter devops_cli_service_round_failures_total with the labels repo and lane, counts one pre-row failure in it, creates its series at zero at Service start like the other Service counters (src/devops_cli/server/counter_series.py:91), charts it in the Roadmap Service row, and documents it in docs/TELEMETRY.md. The shepherd returned the item on 2026-11-16 for a split into items of effort low, so the alert rule, its promtool test and the k8s/README.md alert row go to a second item.
Acceptance criteria
Requirement: Pre-row round failure counter
The Service SHALL add 1 to devops_cli_service_round_failures_total with the labels repo and lane when a round fails before its first row runs.
Scenario: Store lookup fails before the first row
- WHEN A Service round raises while it gets the roadmap store of the repository, before any row runs
- THEN The test observes devops_cli_service_round_failures_total with the labels repo and lane increase by 1
Requirement: Zero series at Service start
The Service SHALL create devops_cli_service_round_failures_total at 0 for each configured repository and lane when it starts.
Scenario: Series starts at zero
- WHEN The Service starts with a configured repository and lane
- THEN The test observes the series with the value 0 before any round fails
Requirement: Service stop is not a failure
A round ended by ServiceStoppingError SHALL NOT add to devops_cli_service_round_failures_total.
Scenario: Stopped round before the first row
- WHEN A Service round raises ServiceStoppingError before its first row runs
- THEN The test observes devops_cli_service_round_failures_total unchanged
Requirement: Failure after a row does not count
The Service SHALL count a round in devops_cli_service_round_failures_total only when no row ran in that round.
Scenario: Failure after the first row
- WHEN A Service round runs one row and then raises
- THEN The test observes devops_cli_service_round_failures_total unchanged and devops_cli_service_jobs_total records the failed row
Requirement: Counter charted in the Service row
The Roadmap Service row of the product dashboards SHALL chart devops_cli_service_round_failures_total.
Scenario: Dashboard query names the counter
- WHEN The test reads the Roadmap Service row of the product dashboards (tests/grafana/test_grafana_dashboards.py:1028)
- THEN The row holds a query that names devops_cli_service_round_failures_total
Requirement: Documented counter
docs/TELEMETRY.md SHALL state devops_cli_service_round_failures_total and its labels repo and lane.
Scenario: Documentation names the counter
- WHEN A test reads docs/TELEMETRY.md
- THEN The file contains devops_cli_service_round_failures_total and its labels repo and lane
Existing Tool Considered
prometheus-client (https://pypi.org/project/prometheus-client), in-use: the Service and its rule tests already use it. It gives the labeled counter for devops_cli_service_round_failures_total{repo,lane}, and the prime_counter call of the Service creates that series at zero when the Service starts, as it does for devops_cli_service_jobs_total (src/devops_cli/server/counter_series.py:162). It lacks a way to know that a round failed before its first row, so the row-started flag, the ended_by_stop exclusion, the Service tests and the Roadmap Service dashboard query stay repository code; the RoadmapServiceRoundFailing rule and its promtool test are the second item of the split. That repository code is small, about 50 lines with its tests, at an estimated cost of about 30k tokens and 2 hours to build, keep and fix.
Key questions
- Which metric shape records a round that fails before its first row?: Add a separate counter devops_cli_service_round_failures_total with the labels repo and lane. Do not use a reserved row value on devops_cli_service_jobs_total. (best practice) [sources: src/devops_cli/config/constants.py:1744, src/devops_cli/server/counter_series.py:162, docs/TELEMETRY.md:60]
- Chosen: Separate counter devops_cli_service_round_failures_total. It keeps a bounded label set, it starts at zero with the other Service counters through prime_service_counters, and it does not mix a round failure with a row count.
- Rejected: Reserved row value on devops_cli_service_jobs_total. It mixes round failures with row results, it changes the meaning of the row label, and the alert and the dashboards must exclude one special value.
- Where does the Service count a round that fails before its first row?: Count in service_job, around the store lookup and run_due_jobs. Pass a row-started flag to run_due_jobs and set it before the first due row starts. Add 1 to the counter only when an exception escapes and the flag is false, and only for a Service round, whose lane is set. (best practice) [sources: src/devops_cli/roadmap/run.py:2112, src/devops_cli/roadmap/run.py:2053, src/devops_cli/roadmap/run.py:1855, src/devops_cli/server/service.py:718]
- Chosen: Wrap service_job with a row-started flag. It covers the store lookup in service_job and the change read in run_due_jobs, both of which run before _execute_due_rows.
- Rejected: Count inside the due-row loop only. It misses the store lookup and the change read that happen before the loop starts.
- Rejected: Count in the worker that logs Service job execution failed. The worker cannot tell a pre-row failure from a failure after a row, and the row-started state lives in the roadmap run.
- How does the Service exclude a stop and a failure after a row?: Use ended_by_stop to skip a Service stop. Use the row-started flag to skip a round in which any row started, because that row already counts in devops_cli_service_jobs_total. (best practice) [sources: src/devops_cli/exceptions/roadmap.py:50, src/devops_cli/roadmap/run.py:1848, src/devops_cli/roadmap/service_stop.py:36]
- Chosen: ended_by_stop and a row-started flag. It counts only a pre-row failure, and it leaves a stop and a row failure to their existing paths.
- Rejected: Count every exception from service_job. It counts a Service stop and a failure after a row, and the row counter already records the row failure.
- What else does a new Service counter need besides its increment?: Chart the counter in the Roadmap Service row of the product dashboards. tests/grafana/test_grafana_dashboards.py:1028 reads each CONST_SERVICE_METRIC_ constant and fails unless the row holds a query for it or the constant is in its deferred_metrics set, which is reserved for a counter that another issue charts. No other issue charts this counter, so the row gets a query for it in this item, and the constant is registered in SERVICE_SERIES (tests/telemetry/test_telemetry_instruments.py:87) and primed in prime_service_counters. (best practice) [sources: tests/grafana/test_grafana_dashboards.py:1028, tests/telemetry/test_telemetry_instruments.py:87, k8s/devops/dashboards/roadmap-service-telemetry.json:133]
- Chosen: Chart the counter in the Roadmap Service row. The counter exists to make a pre-row failure visible to a person, and the dashboard test fails on a new Service counter that no query names.
- Rejected: Add the constant to deferred_metrics. That set defers a counter to the issue that owns its dashboard; no issue owns the dashboard of this counter, so the counter would stay invisible.
- Does the change fit in one pull request?: No. Split it into two items of effort low: this issue keeps the counter, its Service tests, its dashboard query and docs/TELEMETRY.md, and the alert rule with its promtool test and the k8s/README.md alert row goes to a second issue. An item is one issue delivered by one pull request that delivers nothing else, and anything bigger is split (CONTEXT.md:12, CONTEXT.md:36); the shepherd returned the item on 2026-11-16 for that split after the stage job planned it 14 times in 48 hours with no plan pull request, and medium-effort items fail the stage job mostly on the plan (feat(roadmap): Split the job grades by the effort of each item #6008). The two parts live apart: the counter in the Service (src/devops_cli/server/counter_series.py) and the rule in the monitoring values (k8s/devops/monitoring/prometheus-rules-values.yaml:58). (best practice) [sources: CONTEXT.md:12, CONTEXT.md:36, k8s/devops/monitoring/prometheus-rules-values.yaml:58, src/devops_cli/server/counter_series.py:91]
- Chosen: Split into two items of effort low: the counter and the alert. The project records that one item is one issue and one pull request and that anything bigger is split (CONTEXT.md:12, CONTEXT.md:36), the shepherd asked for items of effort low, and the counter and the rule are two deliverables in two trees that a person can land and verify apart.
- Rejected: Keep one item with the counter, the alert rule and the documents. The stage job failed to plan this item 14 times in 48 hours, and medium-effort items fail the stage job mostly on the plan (feat(roadmap): Split the job grades by the effort of each item #6008).
Fit
Needs splitting into 2 items:
- feat(telemetry): count a round that fails before its first row - devops_cli_service_round_failures_total with the labels repo and lane, its zero series at Service start, the ended_by_stop and no-row-ran exclusions in service_job and run_due_jobs, the Service tests, the Roadmap Service dashboard query, and docs/TELEMETRY.md
- feat(monitoring): alert on a round that fails before its first row - the RoadmapServiceRoundFailing rule in k8s/devops/monitoring/prometheus-rules-values.yaml, its promtool test in tests/fixtures/prometheus_rules/roadmap_service_tests.yaml and tests/prometheus/test_k8s_monitoring_alerting.py, and the alert row in k8s/README.md
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 5, 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.(telemetry)scope of the title gives the scope.A monitoring gap hides a real failure mode from operators, but the system still runs and other alerts cover some cases.Operators lose visibility into a specific failure class, but the service does not lose data or stop working.The change adds one counter or label value, three tests, one promtool test, and two doc updates.Both deal with Service telemetry counters; #3495 fixes existing counters to read correctly, while the candidate adds a new counter for a gap that #3495's per-row model introduced.fix(telemetry): Service counters read true across pods and repos (#3680)
devops-cli-service commentedon Nov 6, 2026
Status set to Ready at a0f9557 (see proposed design in issue body).
devops-cli-service commentedon Nov 7, 2026
Alternatives check: in-use
Reason: Web searches returned no provider answer, so the check rests on the facts read for
prometheus_clientand on the issue text, which already namesprometheus_client(with promtool) as the tools the Service uses and says no new tool is needed. It supplies the labeled counter primitive for adevops_cli_service_round_failures_total{repo,lane}series that starts at zero, but it cannot itself detect a round that fails before its first row, so the counter increment, the alert rule and the promtool test stay repository code.The item already names this tool.
Tool: prometheus-client (https://pypi.org/project/prometheus-client)
Covers:
repoandlanelabel names) for the per-repository, per-lane round-failure seriesLacks:
ended_by_stopexclusion must be implemented inservice_job/run_due_jobsRoadmapServiceRoundFailingand its promtool test have to be written and wired into the existing rule testsdocs/TELEMETRY.mdandk8s/README.mdTools considered:
Searches run:
Sources:
Checked on 2026-11-07. A person decides what this means for the item. The check changes no label and closes no issue.
21 remaining items
devops-cli-service commentedon Nov 16, 2026
The proposal at 9cc974b needs splitting into 2 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.
docs(spec): archive the change of #3666
chore(main): release 0.261.1 (#7886)
devops-cli-service commentedon Nov 30, 2026
Released in v0.261.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.261.1
devops-cli-service commentedon Nov 30, 2026
Live since 2026-11-30 20:54 UTC