fix(alerts): stop slow-query backup misrouting
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m43s
CD Pipeline / build-and-deploy (push) Successful in 8m55s
CD Pipeline / post-deploy-checks (push) Successful in 1m50s
Agent Market Watch / market-watch (push) Failing after 36s
E2E Health Check / e2e-health (push) Successful in 54s
AI 技術雷達監控 / ai-technology-watch (push) Successful in 52s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 1s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 21s

This commit is contained in:
ogt
2026-07-11 20:29:08 +08:00
parent c3e67291a4
commit b18a6c039e
5 changed files with 152 additions and 17 deletions

View File

@@ -285,6 +285,17 @@ _CATALOG: tuple[dict[str, Any], ...] = (
"cron",
"crontab",
],
"activation_keywords": [
"momo",
"momopostgresbackupfailed",
"backup",
"momo pg_backup",
"momo postgres backup",
"pg_backup",
"momo-pg-backup",
"cron",
"crontab",
],
"supports_check_mode": True,
"auto_apply_enabled": True,
"approval_required": False,
@@ -313,6 +324,16 @@ _CATALOG: tuple[dict[str, Any], ...] = (
"openwebui",
"docker-registry",
],
"activation_keywords": [
"dockercontainerunhealthy",
"signoz",
"minio",
"litellm",
"n8n",
"open-webui",
"openwebui",
"docker-registry",
],
"supports_check_mode": True,
"auto_apply_enabled": True,
"approval_required": False,
@@ -618,6 +639,11 @@ def _catalog_hints(incident: dict[str, Any] | None, drift: dict[str, Any] | None
unmatched: list[str] = []
for item in _CATALOG:
matched = [keyword for keyword in item["keywords"] if keyword in haystack]
activation_keywords = item.get("activation_keywords") or []
matched_activation_keywords = [
keyword for keyword in activation_keywords if keyword in haystack
]
semantic_match = not activation_keywords or bool(matched_activation_keywords)
public_item = {
key: value
for key, value in item.items()
@@ -635,11 +661,13 @@ def _catalog_hints(incident: dict[str, Any] | None, drift: dict[str, Any] | None
"no_write_only",
}
}
if matched:
if matched and semantic_match:
candidates.append({
**public_item,
"match_score": len(matched),
"matched_keywords": matched,
"semantic_match": True,
"matched_activation_keywords": matched_activation_keywords,
})
else:
unmatched.append(item["catalog_id"])
@@ -792,6 +820,10 @@ def build_ansible_decision_audit_payload(
"risk_level": row["risk_level"],
"match_score": row["match_score"],
"matched_keywords": row["matched_keywords"],
"semantic_match": row["semantic_match"],
"matched_activation_keywords": row[
"matched_activation_keywords"
],
}
for row in candidates[:5]
],