fix(playbook): alert_names 完全匹配時 bypass 相似度門檻
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 12m58s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 12m58s
症狀: SentryDown/OllamaDown 告警觸發 incident,但 playbook 搜索 回傳 NO_MATCH,即使 alert_names 完全一致。 根本原因: Jaccard 加權計算中,affected_services 存的是 Prometheus instance IP (192.168.0.110:9000),而 Playbook 存的是服務名 (sentry), 導致 services 維度得 0,最終 0.35 < min_similarity=0.4。 修正: alert_names 有交集時直接通過,不受其他維度拉低分數影響。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -272,7 +272,11 @@ class PlaybookRepository:
|
||||
playbook.symptom_pattern,
|
||||
)
|
||||
|
||||
if similarity >= min_similarity:
|
||||
# alert_names 完全匹配時,保證通過(不因其他維度拉低分數)
|
||||
alert_exact_match = bool(
|
||||
set(symptoms.alert_names) & set(playbook.symptom_pattern.alert_names)
|
||||
)
|
||||
if alert_exact_match or similarity >= min_similarity:
|
||||
results.append((playbook, similarity))
|
||||
|
||||
# 3. 排序並返回 Top K
|
||||
|
||||
Reference in New Issue
Block a user