fix(alerts): 内置规则排除 Loki 自身日志,消除自我污染误报
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s

Loki 会把执行过的查询语句记成自身 info 日志,查询文本包含规则关键字时
告警会'命中自己'(如 StackOverflowError 规则匹配到告警引擎自己的查询记录),
造成持续误报——全命名空间类内置规则一律加 app!="loki";存量规则启动时自动升级;
顺带清理旧版遗留的重复规则「应用错误过多(error > 1000)」(与现模板重复且阈值会误报);
前端新建/模板默认查询同步;红线测试锁死
This commit is contained in:
opsx committed 2026-10-29 13:46:46 +08:00
1 parent abe28964a1
commit b8d08ef6d1
3 files changed
+40 -10

No files matched your search

@@ -24,7 +24,7 @@ interface RuleForm {
}
const DEFAULTS: RuleForm = {
name: '', sourceId: '', channelIds: [], query: '{namespace=~".+"} |= "error"',
name: '', sourceId: '', channelIds: [], query: '{namespace=~".+", app!="loki"} |= "error"',
windowMin: '15', threshold: '0', cooldownMin: '60', enabled: true,
}
@@ -45,7 +45,7 @@ const TEMPLATES: AlertTemplate[] = [
},
{
key: 'allNsError',
query: '{namespace=~".+"} |~ "(?i)error"',
query: '{namespace=~".+", app!="loki"} |~ "(?i)error"',
windowMin: 15, threshold: 1000, cooldownMin: 60,
},
{
@@ -60,7 +60,7 @@ const TEMPLATES: AlertTemplate[] = [
},
{
key: 'fatal',
query: '{namespace=~".+"} |= "FATAL"',
query: '{namespace=~".+", app!="loki"} |= "FATAL"',
windowMin: 5, threshold: 0, cooldownMin: 15,
},
]