fix(governance): collapse km slo fallback series
All checks were successful
Code Review / ai-code-review (push) Successful in 11s
Deploy Alert Rules / Deploy Prometheus Alert Rules (push) Successful in 22s
CD Pipeline / tests (push) Successful in 1m6s
CD Pipeline / build-and-deploy (push) Successful in 5m17s
CD Pipeline / post-deploy-checks (push) Successful in 1m38s

This commit is contained in:
Your Name
2026-05-14 19:37:15 +08:00
parent d2a4a17969
commit 21dcfbd991
4 changed files with 4 additions and 4 deletions

View File

@@ -409,7 +409,7 @@ class GovernanceAgent:
"autonomy_rate": "sli:autonomy_rate:5m", "autonomy_rate": "sli:autonomy_rate:5m",
"decision_accuracy": "sli:decision_accuracy:5m", "decision_accuracy": "sli:decision_accuracy:5m",
"confidence_calibration": "sli:confidence_calibration:1h", "confidence_calibration": "sli:confidence_calibration:1h",
"km_growth_rate": "max(knowledge_entries_created_24h) or sli:km_growth_rate:24h", "km_growth_rate": "max(knowledge_entries_created_24h) or max(sli:km_growth_rate:24h)",
} }
# 硬紅線:低於此值必須告警(非軟性警告) # 硬紅線:低於此值必須告警(非軟性警告)
hard_red_lines: dict[str, float] = { hard_red_lines: dict[str, float] = {

View File

@@ -695,6 +695,6 @@ class TestCheckSloCompliance:
with patch("httpx.AsyncClient", return_value=client): with patch("httpx.AsyncClient", return_value=client):
result = await agent.check_slo_compliance() result = await agent.check_slo_compliance()
assert "max(knowledge_entries_created_24h) or sli:km_growth_rate:24h" in client.queries assert "max(knowledge_entries_created_24h) or max(sli:km_growth_rate:24h)" in client.queries
assert result["km_growth_rate"]["status"] == "ok" assert result["km_growth_rate"]["status"] == "ok"
assert result["km_growth_rate"]["value"] == 25 assert result["km_growth_rate"]["value"] == 25

View File

@@ -112,7 +112,7 @@ sum(rate(approval_records_high_confidence_total[1h]))
```promql ```promql
max(knowledge_entries_created_24h) max(knowledge_entries_created_24h)
or or
increase(knowledge_entries_total[24h]) max(increase(knowledge_entries_total[24h]))
``` ```
**Recording rule**: `sli:km_growth_rate:24h` **Recording rule**: `sli:km_growth_rate:24h`

View File

@@ -50,7 +50,7 @@ groups:
expr: | expr: |
max(knowledge_entries_created_24h) max(knowledge_entries_created_24h)
or or
increase(knowledge_entries_total[24h]) max(increase(knowledge_entries_total[24h]))
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Error Budget Recording Rules輔助 Grafana 顯示) # Error Budget Recording Rules輔助 Grafana 顯示)