← Back to Pull requests

STOR-3222: Promtool unit tests for Storage Path Alerting #775

Closed
unknown closed this pull request without merging on Nov 26, 2026 12:00 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 14:42 UTC
Author

Refactor volume path health rules into reusable topology recordings and use them in definition of Alerts. Added promtool unit tests.

Running the unit tests

Install the pinned promtool and run all fixtures:

make verify-prometheus-rules

This uses go install -mod=mod github.com/prometheus/prometheus/cmd/promtool@v0.316.0 with a repository-local GOBIN (_output/tools/bin). Go caches module downloads and compilation results. Go and network access are required; no container runtime is needed. These tests also run through make verify (the required CI verify job) and make check. The vendor-mode override applies only to tool installation, not to the operator build.

To use an existing binary without installation, invoke the script directly:

PROMTOOL=/absolute/path/to/promtool ./hack/test-prometheus-rules.sh

Prefix either command with PROMTOOL_DEBUG=1 for detailed evaluation output.

Recording-rule scope and cardinality

The metadata recordings are kept separate from device joins so normalization, deduplication, and matching keys remain explicit. The bound-claim recording intentionally covers all distinct nonempty volume names reported by Bound PVCs, including non-CSI volumes; the downstream PV-context join restricts its use to CSI PVs. This scope is unchanged by the review follow-up.

At each evaluation, for C distinct (persistentvolume, driver, volume_handle) CSI tuples and B distinct volume names reported by Bound PVCs, the three metadata recordings contribute at most 2C + B series. They are not gated on exporter mappings or path-health data, so their cardinality cost also applies on platforms without multipath/NVMe health data. Device topology recordings add series for matching node/device mappings. These recording names and label sets are query-visible interfaces.

STOR-3188 missing-mapping semantics: path alerts do not latch. Once an exporter mapping is absent from query results, its device recordings and path alerts clear even if the volume remains unreachable. Disappearance follows staleness/lookback behavior rather than necessarily happening immediately on detachment; returning mappings restart alert timers.

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

Summary by CodeRabbit

New Features
Storage alerts now include relevant volume and claim context when available, while continuing to report volumes without a matching claim.
Added make verify-prometheus-rules to validate Prometheus rules and run alert scenarios; it is also included in make verify.
Bug Fixes
Improved alert context for multipath and NVMe devices, including handling of missing or stale mappings and health metrics.
Documentation
* Added guidance on alert behavior and running and extending the Prometheus rule tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 373 lines (+279 / -94) across 4 files Reviewer: rvagner78 Review duration: 22877m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 373 lines diff across 4 files
0.43
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.354
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #775"
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: 42.8% (MEDIUM) · Higher = larger blast radius
42.8%
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: 16.9% · Safe to merge
16.9%