Repository navigation
Description
Split from #5210.
Problem: The main change adds a zero sample at Job start, but the 7-day PromQL comparison cannot run in the pull request. Why deferred: The check needs the deployed change and 7 days of production data. It also checks the premise on the state after #4697 if #4697 merges first. Acceptance criteria: 1. After the deploy of #5210, query one Job counter over 7 days. 2. The check MUST show that sum(increase(...)) and sum(last_over_time(...)) differ by less than 5%. 3. Record the query and both values in a comment on #5210.
Proposed design
Problem statement
After #5210 deploys, the zero sample at each Job start must make increase() count a Job counter's first value. No pull request can run the 7-day PromQL comparison that shows this. This item runs sum(increase(...)) and sum(last_over_time(...)) over the stage Job counter for a 7-day window after the deploy. It shows that the two totals differ by less than 5 percent. It records both queries and both values in a comment on #5210. The check reads the state after #4697.
Acceptance criteria
Requirement: Seven-day increase of the stage Job counter
The check SHALL query one Job counter over a 7-day window at least 7 days after the deploy of #5210.
Scenario: Seven-day increase of the stage Job counter
- WHEN
uv run devops prometheus query 'sum(increase(devops_cli_roadmap_stage_total{job="roadmap-stage"}[7d]))'runs at least 7 days after the fix(telemetry): runner Job counters keep their first count in increase() #5210 deploy - THEN the command prints one numeric value for the 7-day increase of
devops_cli_roadmap_stage_total
Requirement: Seven-day last value of the stage Job counter
The check SHALL query the sum of the last value of each stage Job series over the same 7-day window.
Scenario: Seven-day last value of the stage Job counter
- WHEN
uv run devops prometheus query 'sum(last_over_time(devops_cli_roadmap_stage_total{job="roadmap-stage"}[7d]))'runs - THEN the command prints one numeric value for the sum of the last value of each series
Requirement: The two totals differ by less than 5 percent
The check MUST show that sum(increase(...)) and sum(last_over_time(...)) differ by less than 5 percent.
Scenario: Relative difference of the two totals
- WHEN
uv run devops prometheus query 'abs(sum(increase(devops_cli_roadmap_stage_total{job="roadmap-stage"}[7d])) - sum(last_over_time(devops_cli_roadmap_stage_total{job="roadmap-stage"}[7d]))) / sum(last_over_time(devops_cli_roadmap_stage_total{job="roadmap-stage"}[7d]))'runs - THEN the command prints one value below 0.05
Requirement: The query and the values are on #5210
The check SHALL record both PromQL queries and both 7-day values in a comment on #5210.
Scenario: Comment on #5210
- WHEN the comparison finishes, the check posts a comment on fix(telemetry): runner Job counters keep their first count in increase() #5210, and
uv run devops gh api repos/dan-petty/devops-cli/issues/5210/comments --jq '.[].body'runs - THEN the output holds both PromQL queries, both 7-day values, their difference and the date of the run
Existing Tool Considered
No alternatives check has run on this item. Prometheus, which the project already runs for telemetry, covers the need. increase() and last_over_time() compute the two 7-day values (docs/TELEMETRY.md:53, docs/TELEMETRY.md:80). devops prometheus query reads them from the cluster (docs/commands/prometheus.md). It lacks a scheduled runner. No job in the project repeats this comparison, so the run happens once. Run it at least 7 days after the #5210 deploy. The change builds no code, so it has no build cost.
Key questions
- Which Job counter does the check query?: Query
devops_cli_roadmap_stage_total{job="roadmap-stage"}. The stage Job counts its item in this counter before its check-in (openspec/specs/roadmap-stage/job/spec.md:305). The metric has one count for each item by repository and result (docs/TELEMETRY.md:152). Each stage Job pod emits one count and exits, so its last value and its increase are the same. A series with no zero sample has one sample, andincrease()does not count it. The issue body names no metric, so the comment on fix(telemetry): runner Job counters keep their first count in increase() #5210 records the selector. (best practice) [sources: openspec/specs/roadmap-stage/job/spec.md:305, docs/TELEMETRY.md:152, k8s/devops/cronjob-stage.yaml]- Chosen: devops_cli_roadmap_stage_total{job="roadmap-stage"}. It is the stage Job's per-item counter. Each Job pod adds one series that lives inside the window, so the last value and the increase are comparable.
- Rejected: devops_cli_command_total{job="devops-cli-job"}. Every command of the cluster Job increments it, so one missing first value is too small a part of the total to show.
- Rejected: devops_cli_service_stage_jobs_total. It is the Service's counter of stage Job submissions. A Job pod does not emit it, so no Job-start zero sample applies.
- Which PromQL functions compare a counter over a 7-day window?: Use
sum(increase(<counter>[7d]))for the growth andsum(last_over_time(<counter>[7d]))for the sum of the last value of each series. The issue body names both.docs/TELEMETRY.md:53says a zero sample makesincrease()count a counter's first value.docs/TELEMETRY.md:80shows that the project reads a value at the end of a range withlast_over_time.devops prometheus queryruns both (docs/commands/prometheus.md). (best practice) [sources: docs/TELEMETRY.md:53, docs/TELEMETRY.md:80, docs/commands/prometheus.md]- Chosen: increase() and last_over_time(). increase() sums the counter growth over the range, and last_over_time() gives the value at the end of the range. Each stage Job series starts at zero in the window, so the two are comparable.
- Rejected: rate(). rate() gives a per-second value, so it gives no 7-day total.
- Rejected: delta(). delta() is for gauges and does not handle a counter reset.
- Rejected: irate(). irate() uses the last two samples and gives a per-second value, not a 7-day total.
- Which state does the check read when fix(telemetry): keep one metric stream per workload #4697 merges first?: Read the state after fix(telemetry): keep one metric stream per workload #4697. The code at
k8s/devops/cronjob-stage.yamlnames fix(telemetry): keep one metric stream per workload #4697, so the deploy of fix(telemetry): runner Job counters keep their first count in increase() #5210 includes its change. [sources: k8s/devops/cronjob-stage.yaml]
Fit
Fits in one pull request.
Suspected block
Seven days of production telemetry data after the #5210 deploy.
Activity
devops-cli-service commentedon Nov 19, 2026
Both concern the Job counter zero-sample fix; #5210 adds the zero sample in code, while this item verifies the fix with a 7-day PromQL comparison after deploy.devops-cli-service commentedon Nov 19, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Owner question: See Suspected block in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence