Fix false alert when alert duration less than metric step

This commit is contained in:
710leo 2020-05-21 23:56:17 +08:00
parent 9015460c02
commit 2c45f9585d
2 changed files with 8 additions and 2 deletions

View File

@ -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":

View File

@ -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