Skip to content

test(telemetry): verify the project gauges by repository after the rollout #4729

Open

Description

@devops-cli-service

Split from #4690.

Problem or Motivation

The unit tests check the emitter, but the live Prometheus holds no proof that each repository has its own series. A shared series can stay unseen after the change merges.

Why this part is deferred

The check waits on the rollout of the change and on 24 hours of data. No code change can pass it before that time.

Acceptance Criteria

  • count by (repo) (last_over_time(devops_cli_project_items{job='roadmap-service'}[1h])) gives 7 repositories.
  • For the devops-cli repository, max_over_time(sum(devops_cli_project_items{job='roadmap-service',repo='dan-petty/devops-cli'})[24h:5m]) / min_over_time(sum(devops_cli_project_items{job='roadmap-service',repo='dan-petty/devops-cli'})[24h:5m]) is below 1.2. Today it is 1,940 against 6.
  • max(last_over_time(devops_cli_project_stars{job='roadmap-service',repo='dan-petty/devops-cli'}[1h])) equals stargazers_count from the GitHub API.

Proposed design

Problem statement

The unit tests of #4690 check the emitter only. They do not show that live Prometheus holds one devops_cli_project_items series for each repository. This item runs three live PromQL checks after the rollout. The checks give the count of repository series, the 24-hour stability of the devops-cli series, and the stars value against the GitHub API. A person records the output in the issue.

Acceptance criteria

Requirement: One project-items series for each repository

Live Prometheus MUST hold a devops_cli_project_items series for each of the 7 managed repositories after the rollout of #4690.

Scenario: Repository count after the rollout

  • WHEN The rollout of fix(telemetry): key the project gauges by repository #4690 is complete, 1 hour of data is present, and the operator runs uv run devops prometheus query "count by (repo) (last_over_time(devops_cli_project_items{job='roadmap-service'}[1h]))".
  • THEN The command prints one row for each of the 7 repositories of the setting service.repos, and no row names another repository.

Requirement: Stable devops-cli project-items series

The devops_cli_project_items series of the devops-cli repository MUST keep its 24-hour max-to-min ratio below 1.2.

Scenario: 24-hour variation

  • WHEN The rollout is complete, 24 hours of data are present, and the operator runs uv run devops prometheus query "max_over_time(sum(devops_cli_project_items{job='roadmap-service',repo='dan-petty/devops-cli'})[24h:5m]) / min_over_time(sum(devops_cli_project_items{job='roadmap-service',repo='dan-petty/devops-cli'})[24h:5m])".
  • THEN The command prints a value below 1.2. Before the rollout, the same query gave a max of 1,940 and a min of 6.

Requirement: Project-stars gauge matches GitHub

The devops_cli_project_stars gauge of the devops-cli repository MUST equal stargazers_count from the GitHub API.

Scenario: Stars value after the rollout

  • WHEN The rollout is complete, 1 hour of data is present, and the operator runs uv run devops prometheus query "max(last_over_time(devops_cli_project_stars{job='roadmap-service',repo='dan-petty/devops-cli'}[1h]))" and uv run devops gh api repos/dan-petty/devops-cli --jq .stargazers_count in one step.
  • THEN Both commands print the same integer. When they differ, the operator runs both again after the next metrics round, and they print the same integer.

Requirement: Pending a person after the merge

The operator MUST record the output of the three live checks in the issue after the rollout.

Scenario: Recorded live proof

  • WHEN The three live checks pass after the rollout.
  • THEN The issue holds one comment with the three command outputs and the date of the run.

Existing Tool Considered

No alternatives check has run. Prometheus, the open and maintained server, covers the need. The project reaches it with uv run devops prometheus query '<expr>', which sends the expression to the configured /api/v1/query endpoint. Prometheus lacks a scheduled run and a saved result. A person runs the three queries after the rollout and records the output in the issue. The GitHub REST API, read with uv run devops gh api, gives stargazers_count for the stars check. The item builds no code, so there is no build cost.

Key questions

  • Which tool runs the three live PromQL checks?: uv run devops prometheus query '<expr>'. The project records this command for a live PromQL query, and the command sends the expression to the configured Prometheus /api/v1/query endpoint. The item needs no new code. (best practice) [sources: docs/guidelines/kubernetes.md, docs/commands/prometheus.md, src/devops_cli/commands/prometheus.py, src/devops_cli/prometheus/client.py]
    • Chosen: devops prometheus query. The project records it for a live PromQL query, and it reads the Prometheus URL from the settings.
    • Rejected: promtool query instant. It adds a second tool, and it needs the server URL passed by hand.
    • Rejected: curl to /api/v1/query with jq. It adds a jq filter for each query and bypasses the URL handling of the command.
    • Rejected: Grafana Explore panel. It shows the series but saves no output that a person can cite.
  • Which repositories must hold a devops_cli_project_items series, and why 7?: The 7 repositories of the setting service.repos. The repo label is the casefolded owner/name of each repository. The Service collected the metrics of 7 repositories on 2026-11-12. [sources: CONTEXT.md, docs/TELEMETRY.md:211, openspec/changes/archive/2026-11-12-4757-emit-traffic-per-repository-on-a/proposal.md]
  • Does count by (repo) print one row for each repository?: Yes. count by (repo) gives one result series for each distinct value of the repo label, so 7 repositories give 7 rows. The value of each row is the number of item series of that repository. [sources: openspec/changes/archive/2026-11-11-4690-key-the-project-gauges-by-repository/proposal.md]
  • Where does the devops_cli_project_stars gauge get its value?: From stargazers_count of the repository payload of the GitHub API. _fetch_repo_metadata reads the field and returns it to the metrics row. [sources: src/devops_cli/github/metrics.py:916, src/devops_cli/github/metrics.py:932, src/devops_cli/roadmap/stores/github_store.py:500, docs/TELEMETRY.md:219]
  • How does the stars check avoid a false failure when a star arrives between the last snapshot and the API read?: Read the gauge and the API value in the same step. When they differ, repeat both reads after the next metrics round, which is when the Service sends its next snapshot. A gauge keeps its last value between rounds. (best practice) [sources: src/devops_cli/github/metrics.py:932]
    • Chosen: Repeat both reads after the next metrics round. The gauge is a snapshot that the metrics row sends each round, so the next round is the first read that can hold a star that arrived after the last snapshot.
    • Rejected: Strict equality on one read. A star that arrives between the last snapshot and the API read fails a correct gauge.
    • Rejected: Accept a tolerance of a few stars. It hides a gauge that stopped updating.
  • Do the unit tests of the repository cover these live checks?: No. The tests fake the GitHub output, including the stargazers_count payload, and assert the emitted series. No test reads live Prometheus or the GitHub API, so the proof of this item is the live query. [sources: tests/github/test_github_metrics.py]
  • Which command reads stargazers_count from GitHub?: uv run devops gh api repos/dan-petty/devops-cli --jq .stargazers_count. The repository rule requires devops gh and never bare gh. [sources: AGENTS.md, docs/commands/gh.md]

Fit

Fits in one pull request.

Suspected block

The rollout of the change of #4690 to the cluster and the 24 hours of live Prometheus data that follow it.

Dependencies

None.

Watched files

A commit on the default branch that changes one of these files starts the next refine round.

  • src/devops_cli/github/metrics.py

Activity

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

    @devops-cli-service
    ContributorAuthor

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

    • Type: type/test. The test prefix of the title gives the type.
    • Scope: scope/telemetry. The (telemetry) scope of the title gives the scope.
    • Priority: P3-Low. The check waits on the rollout and 24 hours of data and blocks no code change.
    • Value: Medium. It proves that each repository has its own series after the fix merges.
    • Effort: Low. Run three PromQL queries and record the values in a comment.
    • Related: fix(telemetry): key the project gauges by repository #4690, which asks for a different change. Both concern the per-repository project gauges; #4690 adds the repo label, and this candidate checks the live result after the rollout.
  3. added
    priority/p3-low
    on Nov 11, 2026
  4. devops-cli-service commented on Nov 19, 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

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

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block and Watched files 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

  6. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block and Watched files 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/p3-lowscope/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