← Back to Pull requests

Document which listenerMetrics example labels are not exposed by default #4633

Closed
unknown closed this pull request without merging on Sep 21, 2026 10:43 UTC
View on GitHub
unknown unknown commented on Sep 08, 2026 21:07 UTC
Author

Problem

charts/gha-runner-scale-set/values.yaml (and the listener.metrics block in charts/gha-runner-scale-set-experimental/values.yaml) ship a commented-out listenerMetrics example introduced as the defaults ("Default buckets are provided here for documentation purposes") and tell users to uncomment it when they want custom histogram buckets.

The example is not the default configuration. It adds job_workflow_ref, job_workflow_name and job_workflow_target to both counters and both histograms, while the listener's built-in defaultMetrics has none of them. Anyone who uncomments the block to tune buckets silently starts exporting per-ref/per-PR labels on histograms with 45 buckets, which multiplies the series count on busy repositories by orders of magnitude. Nothing in the file mentions the cardinality cost of those labels.

Root cause

  • cmd/ghalistener/metrics/metrics.go:162-281 (defaultMetrics): counters and histograms carry only enterprise, organization, repository, job_name, event_name (+ job_result).

  • The values example lists the three job_workflow_ labels on top of the defaults while the surrounding comment calls it the defaults.
  • job_workflow_ref was dropped from the defaults in #3671 because of cardinality (#3670, #3153) and re-added in #4054 as an opt-in label plus this example; #4240 then added job_workflow_name/job_workflow_target to the example only.

    Fix

    Values comments plus a test; no template or Go behaviour changes. Per the review, the example keeps every metric and every label the listener can export, and documents which labels are not part of the defaults instead of removing them.

  • In both charts, mark job_workflow_ref, job_workflow_name and job_workflow_target with a # not exposed by default: comment inside each label list, and rewrite the header: the example lists every metric and label, it is not identical to the built-in defaults, remove the marked labels to keep the default label set, and the two ref-based labels create a new series per branch/pull request per job (times the bucket count on histograms).

  • Add cmd/ghalistener/metrics/chart_values_test.go: uncomments the example block from both values files and asserts that (a) the metric names equal defaultMetrics, (b) each example label list equals the full label set the exporter populates for that metric (startedJobLabels, completedJobLabels, scaleSetLabels), (c) the labels beyond defaultMetrics are exactly the three documented opt-in labels (none for gauges), and (d) the buckets equal the defaults. A new exporter label that is not added to the example, or a change to the defaults that is not reflected in the comment, fails the test.
  • How tested

  • go test ./cmd/ghalistener/metrics/, go vet, gofmt -l: pass/clean.

  • Negative check: removing job_workflow_name from one example fails the test on both the "labels" and "labels not exposed by default" assertions.

  • helm lint on both charts: clean.

  • helm template with default values for both charts: rendered output is byte-identical to master (the block is commented out; the chart diff is comment-only).

  • helm template -f <uncommented example> on the main chart: renders both counters with 8/9 labels including the three job_workflow_ labels, 8 gauges, and both histograms with 45 buckets, so the in-list # not exposed by default: comment parses as a YAML comment.
  • Links

  • Issue: https://github.com/actions/actions-runner-controller/issues/4625

  • Related history: #3671, #4054, #4240

  • Related open PRs touching the same comment block: #4525 (label sources), #4606 (new labels)
  • This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.

    Diff: 468 lines (+351 / -117) across 5 files Reviewer: KR-Ravindra Review duration: 18095m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 468 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.368
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4633"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.6% (MEDIUM) · Higher = larger blast radius
    45.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18% · Safe to merge
    18%