feat: add tier variable to DORA dashboard #432

Merged
ldraney merged 1 commit from 427-grafana-tier-variable into main 2026-06-14 01:32:22 +00:00
Owner

Summary

Add a tier dropdown variable to the DORA Grafana dashboard so overview panels aggregate only production repos by default. Supports three selections: Tier 1 (Production), Tier 1+2 (All Tracked), and All.

Closes #427

Changes

  • terraform/dashboards/dora-dashboard.json -- added tier custom variable with value:label pairs (tier-1, tier-[12], .*)
  • Updated all 15 metric expressions (4 overview stats, 5 per-repo detail panels, 4 trend panels, 2 lead time quantiles) to include tier=~"$tier" filter
  • Updated repo variable query to filter by tier=~"$tier" so the repo dropdown only shows repos matching the selected tier
  • Default selection is Tier 1 (Production)

Test Plan

  • Verify tier dropdown appears in Grafana after tofu apply
  • Verify default selection is Tier 1 (Production)
  • Verify overview stat panels filter correctly when switching tiers
  • Verify per-repo detail panels filter correctly
  • Verify trend panels filter correctly
  • Verify repo dropdown updates to show only repos for the selected tier
  • Verify existing $repo variable still works independently
  • Dashboard JSON validated (python3 json.tool passes)
  • Forgejo issue: #427
  • Depends on exporter tier labels (dora-metrics-exporter PR #3, merged)
  • Compatible with PR #396 (color thresholds + trend panels)
## Summary Add a tier dropdown variable to the DORA Grafana dashboard so overview panels aggregate only production repos by default. Supports three selections: Tier 1 (Production), Tier 1+2 (All Tracked), and All. Closes #427 ## Changes - `terraform/dashboards/dora-dashboard.json` -- added `tier` custom variable with value:label pairs (tier-1, tier-[12], .*) - Updated all 15 metric expressions (4 overview stats, 5 per-repo detail panels, 4 trend panels, 2 lead time quantiles) to include `tier=~"$tier"` filter - Updated `repo` variable query to filter by `tier=~"$tier"` so the repo dropdown only shows repos matching the selected tier - Default selection is Tier 1 (Production) ## Test Plan - [ ] Verify tier dropdown appears in Grafana after `tofu apply` - [ ] Verify default selection is Tier 1 (Production) - [ ] Verify overview stat panels filter correctly when switching tiers - [ ] Verify per-repo detail panels filter correctly - [ ] Verify trend panels filter correctly - [ ] Verify repo dropdown updates to show only repos for the selected tier - [ ] Verify existing `$repo` variable still works independently - [ ] Dashboard JSON validated (python3 json.tool passes) ## Related - Forgejo issue: #427 - Depends on exporter tier labels (dora-metrics-exporter PR #3, merged) - Compatible with PR #396 (color thresholds + trend panels)
feat: add tier variable to DORA Grafana dashboard
All checks were successful
ci/woodpecker/push/terraform Pipeline was successful
ci/woodpecker/pr/terraform Pipeline was successful
ci/woodpecker/pull_request_closed/terraform Pipeline was successful
0ae580edfa
Add a custom tier dropdown variable with three options:
- Tier 1 (Production) -- default
- Tier 1+2 (All Tracked)
- All

All 15 metric expressions across overview stats, per-repo detail
panels, and trend panels now filter by tier=~"$tier". The repo
variable query also respects the tier filter so the repo dropdown
only shows repos matching the selected tier.

Closes #427

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
Owner

PR #432 Review

DOMAIN REVIEW

Tech stack: Grafana dashboard JSON provisioned via Terraform. Domain checklist: Terraform/Grafana infrastructure.

Tier variable definition -- Correctly implemented as a custom type variable with three options:

  • tier-1 : Tier 1 (Production) -- default, selected:true
  • tier-[12] : Tier 1+2 (All Tracked)
  • .* : All

The regex values are well-chosen: tier-1 is an exact match for production, tier-[12] is a character class matching tier-1 and tier-2, and .* matches everything including repos without a tier label (correct "All" behavior).

Metric expression coverage -- All 15 metric selector modifications verified across 13 target entries (some expressions contain multiple selectors, e.g., CFR panels):

Category Panels Tier filter applied
Overview stats 4 panels (DF, LT p50, CFR, MTTR) Yes (5 metric refs)
Per-repo detail 4 panels (DF, LT p50+p95, CFR, MTTR) Yes (7 metric refs)
Trend panels 4 panels (DF 7d/30d, LT 7d/30d) Yes (4 metric refs)

No metric expressions are missing the tier=~"$tier" filter. Zero omissions.

Repo variable scoping -- The repo variable definition correctly updated from:

label_values(dora_pr_merges_total, repo)

to:

label_values(dora_pr_merges_total{tier=~"$tier"}, repo)

This creates proper cascading behavior: changing the tier dropdown filters the repo dropdown to show only repos in that tier.

Panel ID collisions -- All 18 panel IDs verified unique and sequential (1-18). No collisions.

PR #396 compatibility -- Color thresholds (stepped mode on stat panels, threshold-based coloring on gauge) and trend panels (timeseries with classic palette) are fully preserved. The tier filter is additive to the metric selectors and does not modify any fieldConfig, thresholds, or visualization settings.

BLOCKERS

None.

NITS

  1. The repo variable refresh is set to 2 (on time range change). Consider whether 1 (on dashboard load) would be more appropriate, since tier selection is independent of time range. However, 2 is actually fine here because it ensures the repo list stays fresh -- not a change request, just a note.

  2. PR body says "15 metric expressions" which is accurate for individual selector modifications, but could be clearer that this spans 13 target entries (some expressions have multiple selectors). Minor documentation precision point.

SOP COMPLIANCE

  • PR body has ## Summary, ## Changes, ## Test Plan, ## Related
  • Test plan includes concrete verification steps with checkboxes
  • No secrets, .env files, or credentials committed
  • No unnecessary file changes -- single file modified, all changes are on-topic
  • Commit scope is clean (1 file, +33/-15, all tier-variable related)
  • Related issues referenced (#427 closes, PR #396 compatibility noted)

PROCESS OBSERVATIONS

  • Deployment frequency impact: Positive. Adding tier filtering to the DORA dashboard directly enables better signal-to-noise ratio for tracking deployment frequency across different repo tiers.
  • Change failure risk: Low. This is a dashboard-only change (no application logic, no state mutations). The .* fallback for "All" ensures backward compatibility -- existing dashboard links without a tier parameter will show all data.
  • Documentation: PR body is thorough. The dependency chain (dora-metrics-exporter PR #3 for tier labels) is documented. Test plan covers all panel categories.

VERDICT: APPROVED

## PR #432 Review ### DOMAIN REVIEW **Tech stack**: Grafana dashboard JSON provisioned via Terraform. Domain checklist: Terraform/Grafana infrastructure. **Tier variable definition** -- Correctly implemented as a `custom` type variable with three options: - `tier-1` : Tier 1 (Production) -- **default, selected:true** - `tier-[12]` : Tier 1+2 (All Tracked) - `.*` : All The regex values are well-chosen: `tier-1` is an exact match for production, `tier-[12]` is a character class matching tier-1 and tier-2, and `.*` matches everything including repos without a tier label (correct "All" behavior). **Metric expression coverage** -- All 15 metric selector modifications verified across 13 target entries (some expressions contain multiple selectors, e.g., CFR panels): | Category | Panels | Tier filter applied | |----------|--------|-------------------| | Overview stats | 4 panels (DF, LT p50, CFR, MTTR) | Yes (5 metric refs) | | Per-repo detail | 4 panels (DF, LT p50+p95, CFR, MTTR) | Yes (7 metric refs) | | Trend panels | 4 panels (DF 7d/30d, LT 7d/30d) | Yes (4 metric refs) | No metric expressions are missing the `tier=~"$tier"` filter. Zero omissions. **Repo variable scoping** -- The `repo` variable definition correctly updated from: ``` label_values(dora_pr_merges_total, repo) ``` to: ``` label_values(dora_pr_merges_total{tier=~"$tier"}, repo) ``` This creates proper cascading behavior: changing the tier dropdown filters the repo dropdown to show only repos in that tier. **Panel ID collisions** -- All 18 panel IDs verified unique and sequential (1-18). No collisions. **PR #396 compatibility** -- Color thresholds (stepped mode on stat panels, threshold-based coloring on gauge) and trend panels (timeseries with classic palette) are fully preserved. The tier filter is additive to the metric selectors and does not modify any fieldConfig, thresholds, or visualization settings. ### BLOCKERS None. ### NITS 1. The `repo` variable `refresh` is set to `2` (on time range change). Consider whether `1` (on dashboard load) would be more appropriate, since tier selection is independent of time range. However, `2` is actually fine here because it ensures the repo list stays fresh -- not a change request, just a note. 2. PR body says "15 metric expressions" which is accurate for individual selector modifications, but could be clearer that this spans 13 target entries (some expressions have multiple selectors). Minor documentation precision point. ### SOP COMPLIANCE - [x] PR body has ## Summary, ## Changes, ## Test Plan, ## Related - [x] Test plan includes concrete verification steps with checkboxes - [x] No secrets, .env files, or credentials committed - [x] No unnecessary file changes -- single file modified, all changes are on-topic - [x] Commit scope is clean (1 file, +33/-15, all tier-variable related) - [x] Related issues referenced (#427 closes, PR #396 compatibility noted) ### PROCESS OBSERVATIONS - **Deployment frequency impact**: Positive. Adding tier filtering to the DORA dashboard directly enables better signal-to-noise ratio for tracking deployment frequency across different repo tiers. - **Change failure risk**: Low. This is a dashboard-only change (no application logic, no state mutations). The `.*` fallback for "All" ensures backward compatibility -- existing dashboard links without a tier parameter will show all data. - **Documentation**: PR body is thorough. The dependency chain (dora-metrics-exporter PR #3 for tier labels) is documented. Test plan covers all panel categories. ### VERDICT: APPROVED
ldraney deleted branch 427-grafana-tier-variable 2026-06-14 01:32:22 +00:00
Author
Owner

PR #432 Review (Post-Merge)

DOMAIN REVIEW

Tech stack: Grafana dashboard JSON managed via Terraform. Domain checks: Grafana JSON structure, Prometheus query correctness, Terraform state safety.

Tier variable definition -- Correctly defined as type: "custom" with three options:

  • tier-1 (Tier 1 Production) -- default, selected: true
  • tier-[12] (Tier 1+2 All Tracked)
  • .* (All)

All three regex patterns are valid for Prometheus =~ matching. Default is Tier 1 as intended.

Variable ordering -- The tier variable is inserted before the repo variable in templating.list. This is correct because repo now depends on $tier via label_values(dora_pr_merges_total{tier=~"$tier"}, repo). Grafana evaluates variables in list order, so this dependency is properly satisfied.

Metric query coverage -- All 15 target expressions across 4 categories are updated with tier=~"$tier":

  • 4 overview stat panels (DF, LT p50, CFR, MTTR) -- confirmed
  • 5 per-repo detail panels (DF, LT p50+p95, CFR, MTTR) -- confirmed; the CFR detail expression correctly applies the tier filter to all 3 metric references within the single expression (failure numerator, success denominator, failure denominator)
  • 4 trend panels (DF 7d, DF 30d, LT 7d, LT 30d) -- confirmed
  • 2 lead time quantile expressions in overview -- confirmed (covered in the 4 overview count)

Repo variable scoped to tier -- Both the definition field and the query.query field are updated to label_values(dora_pr_merges_total{tier=~"$tier"}, repo). The refresh: 2 setting (on dashboard load) ensures the repo dropdown re-evaluates when tier changes.

Panel ID collisions -- No panel IDs are added or modified in this diff. Only expr fields and the templating.list array are touched. No collision risk.

Grafana JSON validity -- The tier variable object includes all required fields (current, hide, includeAll, label, multi, name, options, query, queryValue, refresh, skipUrlSync, type). Structure is consistent with the existing datasource and repo variable definitions.

Terraform state safety -- This modifies a dashboard JSON file, not Terraform state resources. The dashboard will be re-provisioned on next tofu apply. No state-breaking changes.

BLOCKERS

None.

NITS

  1. Repo variable refresh timing -- refresh: 2 (on dashboard load) means the repo dropdown will not dynamically update when the tier dropdown is changed mid-session. Grafana supports refresh: 1 (on time range change) but not "on variable change" natively. Users will need to reload the dashboard after changing the tier to see the repo list update. This is a Grafana limitation, not a code bug, but worth noting for user documentation.

  2. PR body claims 15 expressions but counts overlap -- The body says "4 overview stats, 5 per-repo detail panels, 4 trend panels, 2 lead time quantiles" which sums to 15, but the 2 lead time quantiles are part of the 4 overview stats. The actual count is 13 distinct target objects modified across the diff (with the per-repo CFR having 3 filter insertions in 1 expression). Minor documentation imprecision.

SOP COMPLIANCE

  • PR body follows template (Summary, Changes, Test Plan, Related)
  • Closes #427 present
  • No secrets committed
  • No unnecessary file changes -- single file, tightly scoped
  • Commit message is descriptive (feat: add tier variable to DORA dashboard)
  • Changes match declared scope -- no scope creep
  • Related Notes section does not reference a plan slug (acceptable for a single-file config change)

PROCESS OBSERVATIONS

  • Clean, focused PR: 1 file, +33/-15 lines, all changes directly serve the stated goal.
  • Dependency on dora-metrics-exporter PR #3 (merged) is correctly documented.
  • Compatibility with PR #396 (color thresholds + trend panels) is noted.
  • Test plan is thorough with 8 manual verification checkboxes covering all panel categories.
  • This unblocks tier-based DORA reporting, which is foundational for distinguishing production vs. development repo metrics.

VERDICT: APPROVED

## PR #432 Review (Post-Merge) ### DOMAIN REVIEW **Tech stack:** Grafana dashboard JSON managed via Terraform. Domain checks: Grafana JSON structure, Prometheus query correctness, Terraform state safety. **Tier variable definition** -- Correctly defined as `type: "custom"` with three options: - `tier-1` (Tier 1 Production) -- default, `selected: true` - `tier-[12]` (Tier 1+2 All Tracked) - `.*` (All) All three regex patterns are valid for Prometheus `=~` matching. Default is Tier 1 as intended. **Variable ordering** -- The `tier` variable is inserted *before* the `repo` variable in `templating.list`. This is correct because `repo` now depends on `$tier` via `label_values(dora_pr_merges_total{tier=~"$tier"}, repo)`. Grafana evaluates variables in list order, so this dependency is properly satisfied. **Metric query coverage** -- All 15 target expressions across 4 categories are updated with `tier=~"$tier"`: - 4 overview stat panels (DF, LT p50, CFR, MTTR) -- confirmed - 5 per-repo detail panels (DF, LT p50+p95, CFR, MTTR) -- confirmed; the CFR detail expression correctly applies the tier filter to all 3 metric references within the single expression (failure numerator, success denominator, failure denominator) - 4 trend panels (DF 7d, DF 30d, LT 7d, LT 30d) -- confirmed - 2 lead time quantile expressions in overview -- confirmed (covered in the 4 overview count) **Repo variable scoped to tier** -- Both the `definition` field and the `query.query` field are updated to `label_values(dora_pr_merges_total{tier=~"$tier"}, repo)`. The `refresh: 2` setting (on dashboard load) ensures the repo dropdown re-evaluates when tier changes. **Panel ID collisions** -- No panel IDs are added or modified in this diff. Only `expr` fields and the `templating.list` array are touched. No collision risk. **Grafana JSON validity** -- The tier variable object includes all required fields (`current`, `hide`, `includeAll`, `label`, `multi`, `name`, `options`, `query`, `queryValue`, `refresh`, `skipUrlSync`, `type`). Structure is consistent with the existing datasource and repo variable definitions. **Terraform state safety** -- This modifies a dashboard JSON file, not Terraform state resources. The dashboard will be re-provisioned on next `tofu apply`. No state-breaking changes. ### BLOCKERS None. ### NITS 1. **Repo variable refresh timing** -- `refresh: 2` (on dashboard load) means the repo dropdown will not dynamically update when the tier dropdown is changed mid-session. Grafana supports `refresh: 1` (on time range change) but not "on variable change" natively. Users will need to reload the dashboard after changing the tier to see the repo list update. This is a Grafana limitation, not a code bug, but worth noting for user documentation. 2. **PR body claims 15 expressions but counts overlap** -- The body says "4 overview stats, 5 per-repo detail panels, 4 trend panels, 2 lead time quantiles" which sums to 15, but the 2 lead time quantiles are part of the 4 overview stats. The actual count is 13 distinct target objects modified across the diff (with the per-repo CFR having 3 filter insertions in 1 expression). Minor documentation imprecision. ### SOP COMPLIANCE - [x] PR body follows template (Summary, Changes, Test Plan, Related) - [x] `Closes #427` present - [x] No secrets committed - [x] No unnecessary file changes -- single file, tightly scoped - [x] Commit message is descriptive (`feat: add tier variable to DORA dashboard`) - [x] Changes match declared scope -- no scope creep - [ ] Related Notes section does not reference a plan slug (acceptable for a single-file config change) ### PROCESS OBSERVATIONS - Clean, focused PR: 1 file, +33/-15 lines, all changes directly serve the stated goal. - Dependency on `dora-metrics-exporter PR #3` (merged) is correctly documented. - Compatibility with PR #396 (color thresholds + trend panels) is noted. - Test plan is thorough with 8 manual verification checkboxes covering all panel categories. - This unblocks tier-based DORA reporting, which is foundational for distinguishing production vs. development repo metrics. ### VERDICT: APPROVED
Sign in to join this conversation.
No description provided.