Skip to content

fix(monitoring): show one repository at a time in Project Velocity #4712

Closed

Description

@dan-petty

Problem or Motivation

project-metrics.json has no template variable, and no query filters job or repo, so the 7 repositories and the workstation snapshot go into one sum or max. 8 time series panels (4, 5, 7, 8, 11, 13, 14, 24) read last_over_time(x[$__range]) at a default range of 30 d, so old label sets stay. Per-release and per-workflow snapshots are drawn as time lines: panels 7 and 8 have 24 lines in 24 h and 234 in 30 d, panel 11 58 to 858, panel 13 231. Panel 10 gives 84.07 % with [24h] and 91.63 % with [7d] at one moment; the true rate of the last 50 devops-cli runs is 41/45 = 91.1 % (GitHub API). Panel 24 takes the max over all repositories (blocked 10.58 d from another repository). The traffic panels 16 to 20 show values 12 to 15 days old as '14 Days': the Service App has no Administration permission (src/devops_cli/github/metrics.py:750-764) and the last sample is from 2026-10-30.

Proposed Solution & Architectural Design

Add the variables job (default roadmap-service, so a rename by #4517 or #4562 changes one place) and repo (label_values(devops_cli_project_items{job='$job'}, repo), default the devops-cli repository). Every query selects job='$job' and repo='$repo'. Time series panels read snapshot gauges with last_over_time(x{...}[1h]): the Service writes each repository every 909 to 919 s on average with gaps up to 62 min, so [30m] gives 390 min with no data in 6 d and [1h] gives 5 min. Stat panels use instant queries with [1h]. Panels 7 and 8 become one bar chart (instant, format table, x = release, commits and pull requests). Panel 11 becomes a horizontal stacked bar chart, instant, with 'Grouping to matrix' (workflow by conclusion). Panel 13 becomes a bar chart stacked by state, limited to the releases that the commits gauge holds. Panel 10 becomes the instant stat 'CI pass rate, last 50 runs', percentunit, thresholds 0.8 and 0.95. Panel 14: title 'Items by state', [1h]. Panel 24: max by (state, plan) with the legend '{{state}} (waits for owner: {{plan}})'. Traffic panels 16, 17, 19 and 20: last_over_time([1h]) with the filters, so old data shows 'No data' until #4757 is live. Owner decision 3 keeps the traffic row. Panels 3, 4 and 5 keep the current interval metric with the filters: panel 3 a stat with [1h], panel 4 stats of the quantiles 0.5 and 0.95, panel 5 a bar chart from an instant query with the release on the x axis. Owner decision 1 moves panels 2, 3, 4, 5, 7, 8, 10, 11, 13 and 18 to the GitHub data source in #4747, which keeps the panel shapes of this item.

Scope: queries, panel types, units, legends and defaults only. Keep the default Grafana colors. The project design study owns colors and type.

Target Subsystem

Kubernetes & Minikube Automation (Grafana dashboards and telemetry).

Existing Tool Considered

Built-in Grafana template variables, panel types and the 'Grouping to matrix' transformation. No new code.

Acceptance Criteria

  • Harness cases (tests/fixtures/dashboard_queries/project-metrics.yaml) with two repositories and two jobs: each changed panel returns only the selected repository and job; panel 10 returns 41/45 for a fixture of 41 successes and 4 failures; panels 7, 8 and 13 return at most 10 releases; panel 11 returns one row for each workflow.
  • Every target of project-metrics.json selects job and repo through the variables, and no time series target holds $__range.
  • Live at the default range: panel 10 is within 2 points of the pass rate of the last 50 devops-cli runs from the GitHub API, and panel 18 equals stargazers_count.

Files

  • k8s/monitoring/dashboards/project-metrics.json
  • tests/fixtures/dashboard_queries/project-metrics.yaml
  • tests/prometheus/test_k8s_monitoring_dashboards.py

Dependencies

#4680, #4690, #4701.

Related

#4517 and #4562 can rename the job; the job variable keeps that change in one place.

Source: #4675

Alternatives check of 2026-11-14: in-use.
The repository already uses this tool.
Tool: grafana/grafana (https://github.com/grafana/grafana), AGPL-3.0, last activity 2026-11-14, maintained.

Proposed design

Problem statement

Add job and repo variables to the project metrics dashboard and filter every query, so one repository is shown at a time. The dashboard currently mixes seven repositories and a workstation snapshot, keeps old label sets over the default 30-day range, draws one line per release or workflow, and shows 12- to 15-day-old traffic as 14 Days. The work needs #4680, #4690 and #4701 first; no part is deferred.

Acceptance criteria

Requirement: Dashboard selects one job and one repository

The project metrics dashboard SHALL define single-value template variables job and repo, and each Prometheus target SHALL filter on both variables.

Scenario: Default selection filters every target

  • WHEN A test loads k8s/devops/dashboards/project-metrics.json with the default values
  • THEN The job default is roadmap-service, the repo default is dan-petty/devops-cli, and every Prometheus expr contains job="$job" and repo="$repo".

Requirement: Snapshot gauges use a one-hour window

Each snapshot gauge target SHALL use last_over_time(...[1h]) with the job="$job" and repo="$repo" filters.

Scenario: A sample older than one hour is not shown

  • WHEN The fixture holds a snapshot gauge sample older than one hour and no newer sample
  • THEN The query returns no sample for that series.

Requirement: No target uses the dashboard range

No Prometheus target in the dashboard SHALL contain $__range.

Scenario: Static scan finds no range window

  • WHEN A test scans every expr in k8s/devops/dashboards/project-metrics.json
  • THEN No expr contains $__range.

Requirement: Release commits and pull requests share one bar chart

Panels 7 and 8 SHALL become one instant bar chart with table format, the release on the x axis, and a column for commits and pull requests.

Scenario: Two releases give two rows

  • WHEN The fixture has two releases with commits and pull requests
  • THEN The panel returns two rows, each with a release, a commit count and a pull request count.

Requirement: Release panels show at most ten releases

The release bar chart and panel 13 SHALL show at most 10 releases.

Scenario: Eleven releases return ten bars

  • WHEN The fixture has 11 releases
  • THEN The panel returns 10 releases.

Requirement: Workflow conclusions use a matrix

Panel 11 SHALL become a horizontal stacked bar chart that uses Grouping to matrix to show each workflow by conclusion from an instant query.

Scenario: Each workflow gives one row

  • WHEN The fixture has two workflows with passed and failed runs
  • THEN The panel returns one row for each workflow.

Requirement: Release state bars use the releases in the commits gauge

Panel 13 SHALL show an instant bar chart stacked by state and SHALL include only the releases that the commits gauge holds.

Scenario: A release absent from the commits gauge has no bar

  • WHEN The fixture has a release in the state gauge that the commits gauge does not hold
  • THEN Panel 13 returns no bar for that release.

Requirement: CI pass rate is an instant percentage

Panel 10 SHALL show the CI pass rate of recent runs as an instant percentunit stat with thresholds at 0.8 and 0.95, and at the default selection it MUST be within 2 percentage points of the GitHub API pass rate of the last 50 devops-cli runs.

Scenario: 41 successes and 4 failures give 91.1 percent

  • WHEN The fixture has 41 successful runs and 4 failed runs
  • THEN Panel 10 returns 0.9111, uses percentunit, and is within 2 points of 91.1 percent.

Requirement: Owner wait uses the maximum by state and plan

Panel 24 SHALL use max by (state, plan) and the legend {{state}} (waits for owner: {{plan}}).

Scenario: The larger wait of two repositories is shown

  • WHEN The fixture has waits of 2 days and 10 days for one state and plan
  • THEN Panel 24 returns 10 days with the legend that names the state and plan.

Requirement: Traffic panels hide stale samples

Traffic panels 16, 17, 19 and 20 SHALL use last_over_time(...[1h]) with the job and repo filters.

Scenario: A sample older than one hour shows no data

  • WHEN The only traffic sample is older than one hour
  • THEN The panel returns no data.

Requirement: Command latency panels keep the interval metric

Panels 3, 4 and 5 SHALL keep the current interval metric, filter on job and repo, and use a stat with [1h] for panel 3, stats of the 0.5 and 0.95 quantiles for panel 4, and an instant bar chart with the release on the x axis for panel 5.

Scenario: Two repositories return only the selected values

  • WHEN The fixture has latency samples for two repositories and two jobs
  • THEN Each latency panel returns values for only the selected repository and job.

Requirement: Item state panel shows recent items

Panel 14 SHALL use the title Items by state and read the item gauge with last_over_time(...[1h]).

Scenario: An old item sample is excluded

  • WHEN The only item sample is older than one hour
  • THEN Panel 14 returns no data.

Requirement: Repository stars match the GitHub answer

Panel 18 MUST equal the repository stargazers_count at the default selection.

Scenario: A recorded stargazers count is shown

  • WHEN A recorded GitHub answer gives 1234 stars
  • THEN Panel 18 shows 1234.

Existing Tool Considered

Grafana (grafana/grafana, AGPL-3.0, maintained, in use) covers the need with dashboard template variables (label_values), instant and range PromQL, last_over_time, stat and bar-chart panels, and the Grouping to matrix transformation. It lacks the Service App's Administration permission for live traffic (#4757), the move of panels to the GitHub data source (#4747), and the project design study's color and type choices. No new code is needed.

Key questions

  • Which file holds the project metrics dashboard?: k8s/devops/dashboards/project-metrics.json holds it. The path in the issue, k8s/monitoring/dashboards/project-metrics.json, is not the product dashboard. [sources: tests/prometheus/test_k8s_monitoring_dashboards.py, tests/fixtures/dashboard_queries/project-metrics.yaml, k8s/devops/dashboards/project-metrics.json]
  • How does the dashboard select one job and one repository?: Use single-value template variables job and repo. The job variable uses label_values(devops_cli_project_items, job) and defaults to roadmap-service. The repo variable uses label_values(devops_cli_project_items{job="$job"}, repo) and defaults to dan-petty/devops-cli. Every Prometheus target uses exact matchers job="$job" and repo="$repo". (best practice) [sources: tests/prometheus/test_k8s_monitoring_dashboards.py, k8s/devops/dashboards/project-metrics.json]
    • Chosen: Template variables with exact matchers. Grafana filters every panel from one selection, and the existing dashboard test expects a repo variable.
    • Rejected: Repeat each panel by repository. It multiplies panels and keeps no single repository view.
    • Rejected: One dashboard for each repository. It duplicates the dashboard and its maintenance.
  • Which window should snapshot gauges use?: Use last_over_time(<metric>{job="$job",repo="$repo"}[1h]) for snapshot gauges and instant queries for stat panels. [1h] covers the 62-minute gap between Service writes and leaves 5 minutes without data in 6 days. (best practice) [sources: tests/fixtures/dashboard_queries/project-metrics.yaml]
    • Rejected: Keep $__range. The default 30-day range keeps old label sets and makes the stat change with the range.
    • Rejected: Use [30m]. The Service gap reaches 62 minutes, so 6 days have 390 minutes with no data.
    • Chosen: Use [1h]. It covers the largest gap and leaves only 5 minutes without data in 6 days.
  • How should per-release and per-workflow snapshots be drawn?: Use instant charts: one bar chart for commits and pull requests by release, a horizontal stacked bar chart with Grouping to matrix for workflows by conclusion, and a state-stacked bar chart for releases in the commits gauge. (best practice) [sources: k8s/devops/dashboards/project-metrics.json]
    • Rejected: Keep time series lines. Panels 7 and 8 have 24 to 234 lines, panel 11 has 58 to 858, and panel 13 has 231.
    • Chosen: Use instant bar charts and a matrix. One row or bar for each release or workflow shows the snapshot without a line for each label set.
    • Rejected: Use tables. Tables are less compact for the release and workflow comparison that the panels need.
  • How should panel 10 calculate the CI pass rate?: Use an instant stat over the most recent completed runs, titled CI pass rate, last 50 runs, with unit percentunit and thresholds at 0.8 and 0.95. The last 45 completed devops-cli runs give 41 successes and 4 failures, or 41/45 = 91.1 %. (best practice) [sources: k8s/devops/dashboards/project-metrics.json]
    • Rejected: Use [24h]. It gives 84.07 % at one moment and does not match the GitHub answer.
    • Rejected: Use [7d]. It gives 91.63 % and still changes with the range.
    • Chosen: Use an instant query over recent runs. It gives 41/45 = 91.1 % and matches the GitHub API answer.
  • How should panel 24 report owner waits?: Use max by (state, plan) and the legend {{state}} (waits for owner: {{plan}}). The panel then shows the longest wait for each state and plan, not the maximum over all repositories. (best practice) [sources: k8s/devops/dashboards/project-metrics.json]
    • Rejected: Take max over all repositories. It shows 10.58 days from another repository.
    • Chosen: Take max by (state, plan). It keeps the longest wait for each state and plan and names the plan in the legend.
    • Rejected: Take sum by (state, plan). It adds waits from different repositories and reports a time that no item has.
  • Should the traffic row stay, and what should stale traffic samples show?: Keep the traffic row. Panels 16, 17, 19 and 20 use last_over_time(...[1h]) with the job and repo filters, so a sample older than one hour shows No data until fix(telemetry): emit traffic per repository on a schedule #4757 gives the Service App the Administration permission. (best practice) [sources: src/devops_cli/github/metrics.py, tests/prometheus/test_k8s_monitoring_dashboards.py]
  • Does this item move panels to the GitHub data source?: No. Issue feat(monitoring): read project facts with the GitHub data source #4747 moves panels 2, 3, 4, 5, 7, 8, 10, 11, 13 and 18 to the GitHub data source and keeps the panel shapes that this item sets. This item changes the Prometheus queries, panel types, units, legends and defaults. (best practice) [sources: k8s/devops/dashboards/project-metrics.json]
  • Where do the offline checks live?: tests/fixtures/dashboard_queries/project-metrics.yaml holds the PromQL cases, and tests/prometheus/test_k8s_monitoring_dashboards.py and tests/prometheus/test_dashboard_queries.py check the dashboard JSON and the cases. [sources: tests/fixtures/dashboard_queries/project-metrics.yaml, tests/prometheus/test_k8s_monitoring_dashboards.py, tests/prometheus/test_dashboard_queries.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4680, #4690, #4701

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/bug
    scope/monitoring
    status/new
    value/medium
    effort/medium
    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/bug. The fix prefix of the title gives the type.
    • Scope: scope/monitoring. The (monitoring) scope of the title gives the scope.
    • Priority: P2-Medium. The dashboard is usable but misleading; it does not block delivery or cause data loss.
    • Value: Medium. Users get correct per-repository metrics instead of a misleading aggregate of seven repositories.
    • Effort: Medium. The change touches every panel query, adds two variables, changes several panel types, and requires new test fixtures.
    • Related: fix(telemetry): the project velocity dashboard reads the latest snapshot of each gauge, and the project gauges drop the _total suffix #974, which asks for a different change. Both items modify project-metrics.json and address last_over_time time ranges, but #974 fixed panels showing no data while this candidate adds filtering variables and changes panel types.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches point to Grafana, whose built-in dashboard template variables (label_values), panel types (stat, bar chart, stacked bars), instant/range PromQL queries and the "Grouping to matrix" transformation provide exactly the mechanisms the issue proposes; no new library or code is needed. The issue itself already names these Grafana built-ins as the tool considered, so Grafana is in use.

    The repository already uses this tool.

    Tool: grafana/grafana (https://github.com/grafana/grafana)

    • License: AGPL-3.0
    • Last activity: 2026-11-14
    • Maintained: yes

    Covers:

    • Dashboard template variables with label_values queries, so job and repo can filter every target
    • Instant and range PromQL queries, including last_over_time with a chosen range
    • Panel types used by the fix: stat with thresholds and percentunit, bar chart, stacked and horizontal bar chart, table format
    • The "Grouping to matrix" transformation for the workflow-by-conclusion panel
    • Units, legends, defaults and data-source selection inside the dashboard JSON

    Lacks:

    Tools considered:

    Searches run:

    • Grafana grouping to matrix transformation stacked bar chart instant query, results: 5
    • Grafana dashboard template variable label_values filter panels by job and repo, results: 5
    • Grafana transformations documentation "Grouping to matrix", results: 5
    • grafana.com docs dashboard variables label_values query variable, results: 5
    • grafana prometheus template variable label_values dashboard filter, results: 5
    • grafana dashboards as code jsonnet grafonnet, results: 5
    • Grafana open source dashboards prometheus last_over_time instant query stat panel, results: 5

    Sources:

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

  6. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

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

  8. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 18, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 18, 2026
  10. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 23:12 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/monitoringsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions