Skip to content

feat(telemetry): Add alternatives coverage metrics and alert #2950

Closed

Description

@dan-petty

What happened

Nothing showed that the check ran and searched almost never. The owner saw it in the Firecrawl usage.

What should happen

  • Gauges: open items with no check (by repository), the age of the oldest check, and a counter of searches per check (a histogram by verdict).
  • One alert: no Firecrawl search for 3 days while items with no check exist, with the repository in the message.
  • A panel in the Roadmap dashboard.
  • The instruments are declared and sent through the existing metrics path.

Evidence (2026-10-31)

Tracker: #2908 (one issue workflow). Owner request of 2026-10-31: confirm that all issues are vetted for open alternatives.

Acceptance criteria

  • The instruments are declared and covered by the invariant that every metric is a declared instrument.
  • The alert rule has a promtool unit test.
  • uv run devops ci passes.

Proposed design

Problem statement

The alternatives check ran 34 times over 14 days but performed only about 4 web searches, returning not-applicable every time. No metric, alert, or dashboard panel showed this to the owner. The owner found the problem only by checking Firecrawl usage directly. This issue adds the missing telemetry so the owner sees the check's coverage and search activity at a glance.

Acceptance criteria

Requirement: Instruments declared and invariant-covered

Every new metric instrument SHALL be declared in the metrics module and covered by the invariant that every metric is a declared instrument.

Scenario: Invariant test passes with new instruments

  • WHEN The new gauge and histogram instruments are added to the metrics module
  • THEN The invariant test that checks every metric is a declared instrument passes without modification

Requirement: Alert rule validated by promtool

The new alert rule SHALL have a promtool unit test that validates its expression.

Scenario: promtool check rules passes

  • WHEN The alert rule for no Firecrawl search in 3 days is added to prometheus-values.yaml
  • THEN A promtool unit test runs promtool check rules on the file and exits with code 0

Requirement: CI passes

The full CI suite SHALL pass after the change.

Scenario: uv run devops ci exits zero

  • WHEN The pull request with the new instruments, alert rule, and dashboard panel is pushed
  • THEN uv run devops ci completes with exit code 0

Requirement: Gauge for unchecked items

A gauge SHALL report the count of open items with no alternatives check, labelled by repository.

Scenario: Gauge reflects unchecked items

  • WHEN A repository has 10 open items and 4 have a check
  • THEN The gauge value for that repository is 6

Requirement: Gauge for oldest check age

A gauge SHALL report the age in seconds of the oldest alternatives check, labelled by repository.

Scenario: Gauge reflects oldest check age

  • WHEN The oldest check for a repository was written 72 hours ago
  • THEN The gauge value for that repository is 259200

Requirement: Histogram for searches per check

A histogram SHALL record the number of Firecrawl searches performed per check, labelled by verdict.

Scenario: Histogram records search count

  • WHEN A check for an item performs 3 Firecrawl searches and returns verdict none
  • THEN The histogram bucket for verdict none records a value of 3

Requirement: Alert for no searches with unchecked items

An alert SHALL fire when no Firecrawl search occurs for 3 days while at least one open item has no check, and the alert message SHALL include the repository name.

Scenario: Alert fires on 3-day silence with unchecked items

  • WHEN No Firecrawl search occurs for 72 hours and a repository has 2 unchecked items
  • THEN The alert is in the firing state and its annotation names the repository

Requirement: Dashboard panel

A panel SHALL appear in the Roadmap dashboard that shows the unchecked-items gauge, the oldest-check-age gauge, and the searches-per-check histogram.

Scenario: Panel renders in Roadmap dashboard

  • WHEN The Grafana dashboard JSON is loaded with the new panel definition
  • THEN The panel queries the three new instruments and renders their values

Existing Tool Considered

No check has run. The existing Prometheus and Grafana stack covers the need. Prometheus collects the metrics and evaluates alert rules. Grafana renders the dashboard panel. promtool validates the alert rule. The project already sends metrics through this path (docs/TELEMETRY.md, k8s/monitoring/prometheus-values.yaml). The new work is standard instrument declarations and one alert rule, not a new metrics system.

Key questions

  • What is the existing metrics path that new instruments must use?: The project declares instruments in a Python metrics module and sends them through the existing Prometheus client. docs/TELEMETRY.md lists the current instruments. k8s/monitoring/prometheus-values.yaml holds the alert rules. The new instruments join this same path. [sources: docs/TELEMETRY.md, k8s/monitoring/prometheus-values.yaml, k8s/README.md:609]
  • Which metric types cover the three gauges and the histogram?: Two Prometheus gauges (unchecked items by repository, oldest check age by repository) and one Prometheus histogram (searches per check by verdict). These are standard Prometheus instrument types. The project already uses counters and gauges in the same module. (best practice) [sources: docs/TELEMETRY.md:81, docs/TELEMETRY.md:83]
    • Chosen: Gauge + Histogram (standard Prometheus types). The project already uses counters and gauges. A gauge fits a point-in-time count or age. A histogram fits a distribution of search counts per check. Both are native Prometheus types.
    • Rejected: Counter for all three. A counter only increases. It cannot express the current count of unchecked items or the age of the oldest check. Rejected.
    • Rejected: Summary instead of histogram. A summary computes quantiles client-side and is not aggregatable across replicas. A histogram is aggregatable and is the standard choice for per-check distributions. Rejected.
  • What is the alert expression for no Firecrawl search in 3 days while unchecked items exist?: The expression is: increase(devops_cli_firecrawl_searches_total[3d]) == 0 AND devops_cli_roadmap_alternatives_unchecked_items > 0. The alert annotation includes the repository label from the unchecked-items gauge. This follows the pattern of existing alert rules in prometheus-values.yaml. (best practice) [sources: k8s/monitoring/prometheus-values.yaml:846]
    • Chosen: increase() == 0 AND gauge > 0. Directly expresses the condition: no searches in 3 days AND unchecked items exist. The repository label comes from the gauge. Matches the existing alert style in prometheus-values.yaml.
    • Rejected: absent() on the search counter. absent() fires when a series is missing, not when its increase is zero. A counter that exists but does not increase is the real condition. Rejected.
  • Where is the Roadmap dashboard that receives the new panel?: The Roadmap dashboard is a Grafana dashboard in the k8s/monitoring/ directory. The new panel is added to its JSON definition alongside existing panels. [sources: k8s/monitoring/prometheus-values.yaml]
  • Does this change depend on issue fix(roadmap): the alternatives check must search before any verdict for items that can have an open alternative #2946 (the alternatives check must search before returning not-applicable)?: No. The telemetry in this issue monitors the check's behavior. It works whether or not the check searches. fix(roadmap): the alternatives check must search before any verdict for items that can have an open alternative #2946 changes the check's logic. This issue adds observability. They are independent. (best practice) [sources: openspec/changes/2946-the-alternatives-check-must-search-before/proposal.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/telemetry
    status/new
    value/medium
    effort/medium
    on Oct 31, 2026
  2. dan-petty commented on Oct 31, 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/telemetry. The (telemetry) scope of the title gives the scope.
    • Priority: P2-Medium. Observability of an existing feature; important for operations but not a blocking defect.
    • Value: Medium. Operators gain visibility into check health, but the check logic itself needs separate fixes first.
    • Effort: Medium. Declares instruments, writes an alert rule with a promtool test, and adds a dashboard panel.
    • Related: feat(roadmap): the first pass of the alternatives check runs 20 items a day #2947, which asks for a different change. Both concern operational visibility of the alternatives check, but 2947 raises the daily throughput while the candidate adds metrics and an alert.
  3. added
    priority/p2-medium
    on Oct 31, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 1, 2026
  5. devops-cli-service commented on Nov 1, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Staged: branch feat/2950-alternatives-coverage-gauge-searches-per-check, draft pull request #3173. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Declare the three alternatives instruments: 12768 tokens
    2. Record the coverage gauges and the searches histogram: 13386 tokens
    3. Add the alert rule and its promtool unit test: 7672 tokens
    4. Add the alternatives panel to the Roadmap dashboard: 13473 tokens
    5. Document the instruments and the alert: 16487 tokens

    The plan run made 7 model request(s), and used 316533 input tokens and 8761 output tokens. The tool calls, in order:

    1. list_files({"directory":"src/devops_cli/telemetry"})
    2. list_files({"directory":"k8s/monitoring"})
    3. read_file({"path":"src/devops_cli/telemetry/instruments.py"})
    4. search_code({"text":"roadmap_alternatives_total"})
    5. search_code({"text":"ALTERNATIVES_TOTAL"})
    6. search_code({"text":"promtool"})
    7. list_files({"directory":"tests/telemetry"})
    8. list_files({"directory":"tests/roadmap"})
    9. list_files({"directory":"tests/prometheus"})
    10. list_files({"directory":"src/devops_cli/roadmap"})
    11. list_files({"directory":"tests/fixtures/prometheus_rules"})
    12. file_symbols({"path":"src/devops_cli/roadmap/alternatives.py"})
    13. file_symbols({"path":"src/devops_cli/telemetry/instruments.py"})
  7. added 2 commits that reference this issue on Nov 2, 2026
  8. 1 remaining item

  9. added
    status/planned
    on Nov 2, 2026
  10. changed the title [-]feat(telemetry): alternatives coverage gauge, searches per check and an alert for no searches[/-] [+]feat(telemetry): Add alternatives coverage metrics and alert[/+] on Nov 6, 2026
  11. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 76 characters, and the limit is 60. The type and the scope stay.

  12. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 6, 2026
  13. removed
    status/in-review
    owner/agent
    on Nov 7, 2026
  14. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-07 00:45 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/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions