Skip to content

Commit

Permalink
Fix false alert when alert duration less than metric step
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo committed May 21, 2020
1 parent 9015460 commit 2c45f95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/modules/judge/judge/judge.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ func judgeItemWithStrategy(stra *model.Stra, historyData []*dataobj.HistoryData,
logger.Errorf("wrong step:%+v", firstItem)
return
}
straParam = append(straParam, stra.AlertDur/int(firstItem.Step))

limit := stra.AlertDur / int(firstItem.Step)
if limit <= 0 {
limit = 1
}

straParam = append(straParam, limit)

switch straFunc {
case "happen":
Expand Down
2 changes: 1 addition & 1 deletion src/modules/judge/rpc/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (j *Judge) Send(items []*dataobj.JudgeItem, resp *dataobj.SimpleRpcResponse
logger.Debug("recv-->", item)
stats.Counter.Set("push.in", 1)

judge.ToJudge(cache.HistoryBigMap[pk[0:2]], pk, item, now)
go judge.ToJudge(cache.HistoryBigMap[pk[0:2]], pk, item, now)
}

return nil
Expand Down

0 comments on commit 2c45f95

Please sign in to comment.