Document which listenerMetrics example labels are not exposed by default #4633
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
KR-Ravindra
Problem
charts/gha-runner-scale-set/values.yaml(and thelistener.metricsblock incharts/gha-runner-scale-set-experimental/values.yaml) ship a commented-outlistenerMetricsexample 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_nameandjob_workflow_targetto both counters and both histograms, while the listener's built-indefaultMetricshas 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 onlyenterprise,organization,repository,job_name,event_name(+job_result).job_workflow_labels on top of the defaults while the surrounding comment calls it the defaults.job_workflow_refwas 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 addedjob_workflow_name/job_workflow_targetto 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.
job_workflow_ref,job_workflow_nameandjob_workflow_targetwith 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).cmd/ghalistener/metrics/chart_values_test.go: uncomments the example block from both values files and asserts that (a) the metric names equaldefaultMetrics, (b) each example label list equals the full label set the exporter populates for that metric (startedJobLabels,completedJobLabels,scaleSetLabels), (c) the labels beyonddefaultMetricsare 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.job_workflow_namefrom one example fails the test on both the "labels" and "labels not exposed by default" assertions.helm linton both charts: clean.helm templatewith default values for both charts: rendered output is byte-identical tomaster(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 threejob_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
This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.