refactor(xmrig-guard): dedup deployment<->node join into one recording rule - #4416
refactor(xmrig-guard): dedup deployment<->node join into one recording rule#4416Tanguille wants to merge 1 commit into
Conversation
…g rule XmrigGuardEnforcementBypassed and XmrigGuardThermalPanic each ran their own label_replace encoding the "xmrig-<node>" Deployment naming convention; a rename required editing both in lockstep. Move it into a single xmrig_guard_deployment_node recording rule both alerts join through instead.
|
Warning Review limit reached
Next review available in: 11 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Aug 9, 2026 10:11a.m. | Review ↗ | |
| Shell | Aug 9, 2026 10:11a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
@@ spec.groups.guard.rules.rules @@
# monitoring.coreos.com/v1/PrometheusRule/web3/guard-rules
! - two list entries removed:
- - alert: XmrigGuardEnforcementBypassed
- annotations:
- summary: "{{ $labels.deployment }} is running while its node's thermal gate should be closed — the KEDA trip is not being enforced (operator down, HPA wedged, or manual scale)"
- expr: |
- kube_deployment_status_replicas{namespace="web3", deployment=~"xmrig-control-.+"} > 0
- unless on (deployment)
- label_replace(
- (xmrig_guard_safe == 1)
- and on (node) (count by (node) (xmrig_guard_safe) == 1)
- and on (node) (timestamp(xmrig_guard_safe) >= time() - 120),
- "deployment", "xmrig-$1", "node", "(.*)"
- )
- for: 10m
- labels:
- severity: critical
- - alert: XmrigGuardThermalPanic
- annotations:
- summary: "{{ $labels.node }} is above the 67C panic trip with a miner still running — the zero-dwell fast path did not shed it and the drive is near its 70C rating"
- expr: |
- max by (node) (xmrig_guard_nvme_temp_max_celsius) > 67
- and on (node)
- label_replace(
- kube_deployment_status_replicas{namespace="web3", deployment=~"xmrig-control-.+"} > 0,
- "node", "$1", "deployment", "xmrig-(.*)"
- )
- for: 2m
- labels:
- severity: critical
! + three list entries added:
+ - expr: "label_replace(xmrig_guard_rank, \"deployment\", \"xmrig-$1\", \"node\", \"(.*)\")"
+ record: xmrig_guard_deployment_node
+ - alert: XmrigGuardEnforcementBypassed
+ annotations:
+ summary: "{{ $labels.deployment }} is running while its node's thermal gate should be closed — the KEDA trip is not being enforced (operator down, HPA wedged, or manual scale)"
+ expr: |
+ kube_deployment_status_replicas{namespace="web3", deployment=~"xmrig-control-.+"} > 0
+ unless on (deployment)
+ (
+ xmrig_guard_deployment_node
+ and on (node)
+ (
+ (xmrig_guard_safe == 1)
+ and on (node) (count by (node) (xmrig_guard_safe) == 1)
+ and on (node) (timestamp(xmrig_guard_safe) >= time() - 120)
+ )
+ )
+ for: 10m
+ labels:
+ severity: critical
+ - alert: XmrigGuardThermalPanic
+ annotations:
+ summary: "{{ $labels.node }} is above the 67C panic trip with a miner still running — the zero-dwell fast path did not shed it and the drive is near its 70C rating"
+ expr: |
+ max by (node) (xmrig_guard_nvme_temp_max_celsius) > 67
+ and on (node)
+ (
+ xmrig_guard_deployment_node
+ and on (deployment)
+ (kube_deployment_status_replicas{namespace="web3", deployment=~"xmrig-control-.+"} > 0)
+ )
+ for: 2m
+ labels:
+ severity: critical
|
AI Automated ReviewAnalysis engine: omniroute@http://litellm.ai.svc.cluster.local/v1 (openai) Recommendation: Approve. The refactoring correctly deduplicates the deployment-to-node join logic into a single recording rule, reducing maintenance risk without altering alert semantics. Change Analysis
Standards Compliance
Tool Harness FindingsNo tool harness findings. Unknowns or Needs VerificationNone. The diff is self-contained and syntactically valid YAML/PromQL. |
|
Folded into #4394. |
Summary
XmrigGuardEnforcementBypassedandXmrigGuardThermalPaniceach independently re-implemented thexmrig-<node>Deployment-naming join via their ownlabel_replace; a rename needed both edited in lockstep (flagged by its own comment).xmrig_guard_deployment_noderecording rule as the single source for that join; both alerts consume it instead.Verified with
promtool check rules(6/6 rules parse) andkubectl kustomize.Test plan
promtool check ruleson the extracted rule groupkubectl kustomize kubernetes/apps/web3/monero/guard