Skip to content

fix(telemetry): Service counters read true across pods and repos #3495

Closed

Description

@dan-petty

Problem

The Service counters give a false picture to a person who reads them. These series come from the prometheus_client registry through the /metrics scrape (src/devops_cli/telemetry/metrics.py:10). They split by pod, and each release makes a new pod. A label set has no series until its first increment, so increase() loses the first value.

devops_cli_service_implement_failures_total also has only the label class (src/devops_cli/roadmap/implement_submit.py:253-255), so it mixes 3 repositories.

Evidence in the window 2026-11-03T15:05Z to 2026-11-04T15:05Z, with 16 pods in the series:

class increase() over 24 h sum of the per-pod maximum
ci_infra 39.0 59
plan_defect 0 8
refused_tool 7.1 12
timeout 7.1 9

The pod that was live at the start of the window can add earlier counts, so the right column is an upper bound. Stop comments on devops-cli alone show ci_infra 6 and plan_defect 8. So increase() shows ci_infra as the top cause and no plan defect, and nobody can read the split by repository.

Other facts:

  • k8s/monitoring/prometheus-values.yaml:23: the created-timestamp feature acts on remote write 2.0 from the collector. The _created series of the scrape path are stored as plain series.
  • k8s/monitoring/prometheus-values.yaml:665-677: the alert expressions work around the missing first sample (fix(monitoring): the roadmap Service alerts count the first value of a new series and see a lane of a new pod #2505).
  • docs/TELEMETRY.md:22-25 says that a new pod writes the series of the pod before it. The scraped series have a pod label, so this is false for them.
  • devops_cli_service_jobs_total has the labels lane, repo and result, and no row label.
  • k8s/README.md:688 tells the reader of RoadmapServiceGitHubRequestsHigh to lower the budget. The alert follows the budget, so a lower budget makes it fire sooner.

Not in this item: RoadmapServiceRestarted reads a container restart by design, and RoadmapServiceUnavailable covers a rollout. devops_cli_ai_* has no series for devops-coder, but #3066 owns token spend.

Expected

Each label set of each Service counter exists at 0 from the start. The failure counter has a repo label. A query gives a true total over a pod change. The documents state how the series behave.

Acceptance criteria

  • A test: each class of the failure counter exists at 0 for each repository after start.
  • A test: the repo label holds only values of service.repos.
  • A promtool test: a query gives a true total over a pod change. Add a recording rule only if this test shows the need.
  • A test: devops_cli_service_jobs_total holds a row label.
  • A promtool test: the alert expressions hold with the fix(monitoring): the roadmap Service alerts count the first value of a new series and see a lane of a new pod #2505 workaround removed.
  • docs/TELEMETRY.md and k8s/README.md state the scrape behavior and the labels of the counter.
  • The action text of RoadmapServiceGitHubRequestsHigh does not say to lower the budget.

Existing tool considered

prometheus_client: calling .labels(...) at start creates a child at 0. promtool and the rule tests in tests/fixtures/prometheus_rules/ hold the query results. Prometheus recording rules only if the test needs one.

Order

Related

Related: #2919, #3162, #3066, #2536, #2505

Activity

  1. added
    source/agent
    type/bug
    scope/telemetry
    status/new
    value/high
    effort/medium
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 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/bug. The fix prefix of the title gives the type.
    • Scope: scope/telemetry. The (telemetry) scope of the title gives the scope.
    • Priority: P2-Medium. Incorrect operational data misleads operators but does not break service delivery.
    • Value: High. The current counters hide the true top failure class and hide per-repo splits, so operators act on wrong data.
    • Effort: Medium. Requires counter initialisation changes, a new label, docs updates, unit tests, and promtool rule tests across several files.
    • Related: fix(monitoring): the roadmap Service alerts count the first value of a new series and see a lane of a new pod #2505, which asks for a different change. Both address the increase() first-sample gap on Service alerts; #2505 fixed the alert expressions as a workaround, while this candidate fixes the counter itself and removes that workaround.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 4, 2026
  4. dan-petty commented on Nov 5, 2026

    @dan-petty
    OwnerAuthor

    Answer from project standards, under the owner's instruction of 2026-11-05.

    1. Does devops_cli_service_identity_refused_total get a zero series?
    Answer: no. It stays with no zero series. Its label identity holds the identity that GitHub refuses, so the value of the label is not known before a refusal. The alert RoadmapServiceIdentityRefused reads > 0 with no workaround term. Source: design.md of the change 3495-service-counters-zero-series-repo-label, and the two counts in src/devops_cli/server/service.py. docs/TELEMETRY.md and k8s/README.md state this exception.

    2. A round that fails before its first row counts no job. Is this in scope?
    Answer: it is a real gap, and it is separate work. A failure of a round has no row, so it needs its own label value or counter and its own alert. No open issue covered it, so #3666 now holds it. Source: AGENTS.md rule 11, and the search of open issues.

    3. Which label does devops_cli_service_implement_failures_total use for the repository, and does #3069 agree?
    Answer: repo, the label of the other Service counters (devops_cli_service_jobs_total, devops_cli_service_triggers_total). The values are those of service.repos. #3069 plans devops_cli_service_implement_jobs_total{repo,item_class,result} and a gauge with {repo,class}, so it reads the same label, and no further agreement is necessary. Source: src/devops_cli/server/counter_series.py, and the body of #3069.

    4. Does a live Prometheus query prove the change?
    Answer: not before the merge. The series change only after the deploy, and promtool holds the query results offline. The pull request comment holds the queries to run after the deploy. Source: the acceptance criteria of this issue, which ask for promtool tests, and AGENTS.md rule 8.

    Two more points came from a read of the final diff, and the branch holds them. Both follow from the count for each row:

  5. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 5, 2026
  6. removed
    status/in-review
    owner/agent
    on Nov 5, 2026
  7. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor
  8. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-05 19:48 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/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions