fix(reboot): expose active blocker alert metrics
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 58s
CD Pipeline / build-and-deploy (push) Has started running
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-02 22:24:51 +08:00
parent 8d7a6faaf1
commit 068c18e2f0
9 changed files with 140 additions and 8 deletions

View File

@@ -60,3 +60,21 @@ def test_backup_aggregate_alert_excludes_old_wrapper_noise() -> None:
assert 'awoooi_backup_last_run_failed_count{host="110",exported_job!="backup_all"}' in expr
assert 'exported_job="backup_all"} > 0' not in expr
def test_reboot_slo_alerts_project_named_blockers_to_telegram() -> None:
alerts = load_alerts()
blocker = alerts["RebootAutoRecoveryActiveBlocker"]
metric_missing = alerts["RebootAutoRecoveryActiveBlockerMetricMissing"]
assert "awoooi_reboot_auto_recovery_slo_active_blocker" in str(blocker["expr"])
assert blocker["labels"]["notification_type"] == "TYPE-3"
assert "$labels.blocker" in blocker["annotations"]["summary"]
assert "$labels.blocker" in blocker["annotations"]["description"]
assert "Windows99" in blocker["annotations"]["runbook"]
assert "backup-status" in blocker["annotations"]["runbook"]
assert "禁止 reboot" in blocker["annotations"]["runbook"]
assert "awoooi_reboot_auto_recovery_slo_blocker_count" in str(metric_missing["expr"])
assert "awoooi_reboot_auto_recovery_slo_active_blocker" in str(metric_missing["expr"])
assert metric_missing["labels"]["notification_type"] == "TYPE-1"