Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ccfos/nightingale
Browse files Browse the repository at this point in the history
  • Loading branch information
UlricQin committed Jul 26, 2022
2 parents 293680a + 0500535 commit 3970578
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/engine/mute.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// 如果传入了clock这个可选参数,就表示使用这个clock表示的时间,否则就从event的字段中取TriggerTime
func isMuted(event *models.AlertCurEvent, clock ...int64) bool {
func IsMuted(event *models.AlertCurEvent, clock ...int64) bool {
mutes, has := memsto.AlertMuteCache.Gets(event.GroupId)
if !has || len(mutes) == 0 {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/server/engine/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (r RuleEval) judge(vectors []conv.Vector) {
}

// isMuted only need TriggerTime RuleName and TagsMap
if isMuted(event) {
if IsMuted(event) {
logger.Infof("event_muted: rule_id=%d %s", r.rule.Id, vectors[i].Key)
continue
}
Expand Down
7 changes: 7 additions & 0 deletions src/server/router/router_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ func pushEventToQueue(c *gin.Context) {
event.TagsMap[arr[0]] = arr[1]
}

// isMuted only need TriggerTime RuleName and TagsMap
if engine.IsMuted(event) {
logger.Infof("event_muted: rule_id=%d %s", event.RuleId, event.Hash)
ginx.NewRender(c).Message(nil)
return
}

if err := event.ParseRuleNote(); err != nil {
event.RuleNote = fmt.Sprintf("failed to parse rule note: %v", err)
}
Expand Down

0 comments on commit 3970578

Please sign in to comment.