Skip to content

test(telemetry): verify Job counter increase after the zero-sample deploy #6425

Open

Description

@devops-cli-service

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

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

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, and increase() 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 and sum(last_over_time(<counter>[7d])) for the sum of the last value of each series. The issue body names both. docs/TELEMETRY.md:53 says a zero sample makes increase() count a counter's first value. docs/TELEMETRY.md:80 shows that the project reads a value at the end of a range with last_over_time. devops prometheus query runs 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.yaml names 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.

Dependencies

#5210

Activity

  1. added
    type/test
    scope/telemetry
    source/agent
    status/new
    value/medium
    effort/low
    on Nov 19, 2026
  2. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

    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.

  4. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    ContributorAuthor

    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.

  5. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

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/lowpriority/p2-mediumscope/telemetrysource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions