Skip to content

feat(roadmap): count the claims of each repository #4579

Closed

Description

@dan-petty

Problem or Motivation

No metric counts the open roadmap items of each repository by Status and plan, or the claims by claimant kind. The pipeline dashboard (#3655) needs both. Prometheus cannot count GitHub labels by itself.

Proposed Solution & Architectural Design

  • In src/devops_cli/telemetry/instruments.py and src/devops_cli/github/metrics.py (beside _emit_item_ages, line 932): two gauges from the same snapshot, devops_cli_roadmap_items{repo, state, plan} and devops_cli_roadmap_claims{repo, claimant} (claimant kind: service, agent, human).
  • The label is claimant, not owner, because owner means the GitHub owner in the naming ADR.
  • A label set that the last snapshot sent and this one lacks gets 0 once, as _emit_item_counts does (github/metrics.py:906-916).
  • Related: feat(roadmap): Emit inbox gauges, add panel, show digest line #2968 (inbox gauges by category) uses the same snapshot path; keep the two gauge families apart.

Target Subsystem

SDLC, Git & PR Governance (roadmap metrics: src/devops_cli/github/metrics.py).

Existing Tool Considered

No tool counts GitHub labels without a GitHub read; the existing metrics snapshot reads them already. Cost: about 150,000 tokens and 2 hours to build, about 5,000 tokens a month to keep, about 20,000 tokens to fix.

Acceptance Criteria

  • Each snapshot sends the count for each pair of Status and plan, and 0 for each pair with no item.
  • A label set that the last snapshot sent and this one lacks gets 0 once.
  • The snapshot sends no extra GitHub request (a test counts requests).
  • No label holds an issue number, and no label is named owner.
  • The pipeline dashboard shows the open items and claims by repository.

Dependencies

Source: #4517

Proposed design

Problem statement

The roadmap sends no metric that counts its open items by Status and by the stage pull request flag. It also sends no metric that counts their claims by claimant kind. The pipeline dashboard (#3655) needs both counts for each repository. Prometheus cannot count GitHub labels alone, so the metrics row must send the counts from the snapshot that it already reads.

Acceptance criteria

Requirement: Gauge instruments

The telemetry module SHALL define devops_cli_roadmap_items and devops_cli_roadmap_claims as gauges with unit 1.

Scenario: Both gauges are registered

  • WHEN a test imports INSTRUMENTS from devops_cli.telemetry.instruments
  • THEN the tuple holds both names, each with kind GAUGE and unit 1.

Requirement: Items per Status and plan

A snapshot SHALL send one devops_cli_roadmap_items sample for each pair of Status and plan, with 0 for a pair that holds no open item.

Scenario: Every pair gets a sample

  • WHEN the store holds one open item with Status Ready and no stage pull request
  • THEN the snapshot sends 12 samples with labels repo, state and plan, the pair ready and false has 1, and each other pair has 0.

Requirement: Claims per claimant kind

A snapshot SHALL send one devops_cli_roadmap_claims sample for each claimant kind, with 0 for a kind that holds no open item.

Scenario: Each kind gets a sample

  • WHEN one open item holds owner/service and no item holds owner/agent or owner/human
  • THEN the snapshot sends claimant="service" with 1, and claimant="agent" and claimant="human" with 0.

Requirement: One read of the store

The snapshot MUST read the items of the store once and send no extra GitHub request for the two gauges.

Scenario: The request count is unchanged

  • WHEN the metrics row collects a report that holds the two gauges
  • THEN the GitHub requests that the fake client recorded equal those of a report without the two gauges.

Requirement: Label values

A series of the two gauges MUST hold no issue number and no label named owner.

Scenario: The label sets are checked

  • WHEN the snapshot sends the series of both gauges
  • THEN each label name is repo, state, plan or claimant, and no value is an issue number.

Requirement: A failed read sends nothing

A snapshot whose read of the items fails MUST send no sample of the two gauges.

Scenario: The store raises

  • WHEN the read of the items raises GitHubOperationError
  • THEN the snapshot sends neither gauge, and the report holds empty item and claim lists.

Existing Tool Considered

No alternatives check has run. The OpenTelemetry Python SDK covers the gauge export, and the repository already uses it in src/devops_cli/telemetry/instruments.py. The SDK cannot count GitHub labels, so the counts come from the store snapshot that collect_project_metrics_report already reads. The body writes the cost of the own code: about 150,000 tokens to build, about 5,000 tokens a month to keep and about 20,000 tokens to fix.

Key questions

  • Which library sends the two gauges?: The OpenTelemetry Python SDK, through an Instrument of kind GAUGE and emit(), as ROADMAP_ITEM_AGE does in src/devops_cli/telemetry/instruments.py. [sources: src/devops_cli/telemetry/instruments.py, src/devops_cli/github/metrics.py:932]
  • Which label names do the two gauges use?: The items gauge uses repo, state and plan, the label set that ROADMAP_AGE_LABELS already names. The claims gauge uses repo and claimant, because owner names the GitHub owner and the owner/* label family in this repository. (best practice) [sources: src/devops_cli/telemetry/instruments.py, .github/labels.yml:315, src/devops_cli/roadmap/claim.py]
    • Chosen: Reuse ROADMAP_AGE_LABELS and add claimant. A dashboard joins the count to the age series on the same labels, and claimant is not ambiguous.
    • Rejected: Name the claim label owner. owner means the GitHub owner, and owner/* is the label family of the claim itself.
  • Which values can state and claimant hold?: state holds the slug of each of the 6 values of CONST_ROADMAP_STATUS_VALUES. claimant holds one of the 3 Claimant members: service, agent and human. [sources: src/devops_cli/config/constants.py, src/devops_cli/roadmap/claim.py, src/devops_cli/github/metrics.py:932]
  • How does a pair or a kind that this snapshot lacks get 0?: The pairs and the kinds are a closed set, so each round sends 0 for every empty pair and every empty kind. The gauges need no memory of the series that the last snapshot sent. (best practice) [sources: src/devops_cli/github/metrics.py:906, openspec/changes/archive/2026-11-05-2919-stuck-item-age-metrics-and-one/design.md]
    • Chosen: Send 0 each round for the closed set. The 6 Status values, the 2 plan flags and the 3 claimant kinds are fixed, so a sample of 0 each round keeps no stale value.
    • Rejected: Reuse the _sent_item_series memory of _emit_item_counts. That memory serves PROJECT_ITEMS, whose release, type and priority labels form an open set.
  • Where does the snapshot compute the two counts?: In the block that the item_ages flag already guards, from one read of the items. get_item_age_metrics takes the open items as an optional argument, and a failed read sends no series. (best practice) [sources: src/devops_cli/github/metrics.py, src/devops_cli/github/metrics.py:932]
    • Chosen: Share one read of the items with the ages. One read keeps the request count the same and gives both gauge families the same snapshot.
    • Rejected: Read the items again for the counts. A second read can cost GitHub requests, and the acceptance criteria forbid an extra request.
    • Rejected: Add a new row or setting. The metrics row already reads the store, and the two gauges belong to the same snapshot.
  • Does this item build the pipeline dashboard panel?: No. This item sends the series, and feat(roadmap): a dashboard and alerts for the pipeline #3655 reads them in its panel. The dashboard panel is feat(roadmap): a dashboard and alerts for the pipeline #3655's work and no test of this repository can check it. (best practice) [sources: src/devops_cli/telemetry/instruments.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-13: in-use.
The repository already uses this tool.
Tool: open-telemetry/opentelemetry-python (https://github.com/open-telemetry/opentelemetry-python), Apache-2.0, last activity 2026-11-12, maintained.

Owner decision 2026-11-13

The approved pipeline split (tracker #5482) moves the item count to #5495: the gauge devops_cli_roadmap_items{repo, phase} comes from the pure phase(item) function. This item keeps only devops_cli_roadmap_claims{repo, claimant} and emits no second items gauge. The criteria and the requirements of the items gauge in this body do not apply.

  • Live proof: after the merge and the release, the Service emits the claims gauge as the App for 24 h. A comment gives the value for each claimant and a compare with the owner/* labels.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 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/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It feeds the pipeline dashboard (#3655) but does not block a release or fix a defect.
    • Value: Medium. It gives operators a per-repository view of open items and claims, which supports the dashboard.
    • Effort: Low. The body estimates about 2 hours to build two gauges beside existing code.
    • Related: feat(roadmap): metrics for the pipeline outcomes #3069, which asks for a different change. Both add roadmap metrics in src/devops_cli/github/metrics.py, but #3069 counts pipeline outcomes while this candidate counts open items and claims.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 818ac6f (see proposed design in issue body).

  7. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The need splits in two: exporting two labelled gauges, which the OpenTelemetry Python SDK already used by this repository provides, and counting the repository's own roadmap items and claims from a single GitHub snapshot, which no library can do. The searches turned up no tool that counts this repository's GitHub labels per Status, plan and claimant kind, so the SDK covers only the instrument/export part and the counts still need the project's own code.

    The repository already uses this tool.

    Tool: open-telemetry/opentelemetry-python (https://github.com/open-telemetry/opentelemetry-python)

    • License: Apache-2.0
    • Last activity: 2026-11-12
    • Maintained: yes

    Covers:

    • Gauge instruments with named labels and a unit, registered in one INSTRUMENTS tuple as ROADMAP_ITEM_AGE already is
    • Export of the emitted samples to the metrics pipeline that the pipeline dashboard reads
    • The same SDK path the repository already uses in src/devops_cli/telemetry/instruments.py, so no new dependency

    Lacks:

    • No ability to read or count GitHub labels; the counts must come from the project's own store snapshot
    • No notion of this repository's roadmap Status values, stage-plan flag or claimant kinds (service, agent, human)
    • No zero-filling of label sets that a snapshot lacks and no memory of the series the last snapshot sent
    • No guarantee that the snapshot sends no extra GitHub request; that is the project's snapshot code's job
    • No pipeline dashboard panel; that stays with feat(roadmap): a dashboard and alerts for the pipeline #3655

    Tools considered:

    Searches run:

    • OpenTelemetry Python SDK gauge instrument create_gauge, results: 5
    • Prometheus count GitHub issue labels metric exporter, results: 5
    • opentelemetry-python metrics SDK Gauge API documentation, results: 5
    • github issue label metrics exporter Prometheus gauge count labels, results: 5
    • github prometheus exporter issues by label count tool, results: 5

    Sources:

    Checked on 2026-11-13. A person decides what this means for the item. The check changes no label and closes no issue.

  8. changed the title [-]feat(roadmap): count open items and claims per repository[/-] [+]feat(roadmap): count the claims of each repository[/+] on Nov 13, 2026
  9. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 17, 2026
  10. removed
    status/in-review
    on Nov 17, 2026
  11. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-17 12:22 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/lowpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions