← Back to Pull requests

VPA: Document all component metrics and test recommender metrics #9825

Open
unknown opened this pull request with 302 lines diff across 3 files
View on GitHub
unknown unknown commented on Jun 16, 2026 10:20 UTC
Author

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Adds a single Prometheus metrics reference for the VPA Admission Controller, Recommender, and Updater in docs/metrics.md, organized into three component sections and linked from the VPA README.

A shared Go generator reads the registered metric definitions and common helpers to produce metric names, types, labels, and descriptions from the Prometheus Help fields. hack/update-metrics.sh regenerates all three tables, and hack/verify-metrics.sh detects stale documentation without modifying it. The generator supports both direct collector registration and the Updater's collector slice, and fails on unsupported definitions instead of silently omitting metrics. The reference covers VPA metrics; metrics provided by dependencies are excluded.

Also adds unit coverage for Recommender metric behavior: recording recommendation latency in seconds, reporting aggregate container state counts, and classifying Metrics Server responses by error status and client name. Generator tests cover all three components, definition and registration changes, deterministic output, stale-document detection, and failures without modifying the document.

Which issue(s) this PR fixes:

Fixes #8128

Special notes for your reviewer:

NONE

Does this PR introduce a user-facing change?

``release-note
NONE


#### Validation:

Run from `vertical-pod-autoscaler`:

text
go test -race ./hack/tools/metrics ./pkg/utils/metrics/recommender ./pkg/recommender/routines ./pkg/recommender/input/metrics ./pkg/recommender/input/history
go vet ./hack/tools/metrics ./pkg/utils/metrics/recommender ./pkg/recommender/routines ./pkg/recommender/input/metrics ./pkg/recommender/input/history
bash hack/verify-metrics.sh
bash hack/verify-toc.sh
``

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

Documentation
Added a metrics guide describing metrics exposed by the Admission Controller, Recommender, and Updater, including their types, labels, and descriptions.
Added a link to the guide in the README contents.
Chores
* Added commands to generate and verify the metrics documentation, with checks that identify outdated tables and prevent stale documentation from passing verification.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 302 lines (+226 / -76) across 3 files Reviewer: mattsu2020 Review duration: 241365m
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 302 lines diff across 3 files
0.47
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
44%
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
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.342
Real PR Conversation Timeline
1 comments
"Review active on #9825"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 44.7% 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: 47.1% (MEDIUM) · Higher = larger blast radius
47.1%
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: 44.7% · Lower = rushed or shallow review
44.7%
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: 26.1% · Safe to merge
26.1%