event.Cluster use target.Cluster instead of rule.Cluster (#1108)
This commit is contained in:
parent
48d24c79d6
commit
6c2c945bd9
|
@ -298,10 +298,12 @@ func (r RuleEval) judge(vectors []conv.Vector) {
|
||||||
// handle target note
|
// handle target note
|
||||||
targetIdent, has := vectors[i].Labels["ident"]
|
targetIdent, has := vectors[i].Labels["ident"]
|
||||||
targetNote := ""
|
targetNote := ""
|
||||||
|
targetCluster := ""
|
||||||
if has {
|
if has {
|
||||||
target, exists := memsto.TargetCache.Get(string(targetIdent))
|
target, exists := memsto.TargetCache.Get(string(targetIdent))
|
||||||
if exists {
|
if exists {
|
||||||
targetNote = target.Note
|
targetNote = target.Note
|
||||||
|
targetCluster = target.Cluster
|
||||||
|
|
||||||
// 对于包含ident的告警事件,check一下ident所属bg和rule所属bg是否相同
|
// 对于包含ident的告警事件,check一下ident所属bg和rule所属bg是否相同
|
||||||
// 如果告警规则选择了只在本BG生效,那其他BG的机器就不能因此规则产生告警
|
// 如果告警规则选择了只在本BG生效,那其他BG的机器就不能因此规则产生告警
|
||||||
|
@ -332,7 +334,7 @@ func (r RuleEval) judge(vectors []conv.Vector) {
|
||||||
tagsArr := labelMapToArr(tagsMap)
|
tagsArr := labelMapToArr(tagsMap)
|
||||||
sort.Strings(tagsArr)
|
sort.Strings(tagsArr)
|
||||||
|
|
||||||
event.Cluster = r.rule.Cluster
|
event.Cluster = targetCluster
|
||||||
event.Hash = hash
|
event.Hash = hash
|
||||||
event.RuleId = r.rule.Id
|
event.RuleId = r.rule.Id
|
||||||
event.RuleName = r.rule.Name
|
event.RuleName = r.rule.Name
|
||||||
|
|
Loading…
Reference in New Issue