fix: 同比变化率告警函数

This commit is contained in:
710leo 2020-12-20 13:00:45 +08:00
parent 7b220da936
commit d355393074
1 changed files with 2 additions and 2 deletions

View File

@ -388,7 +388,7 @@ func (f CAvgRateAbsFunction) Compute(vs []*dataobj.HistoryData) (leftValue datao
}
value := sum / dataobj.JsonFloat(vsLen)
leftValue = dataobj.JsonFloat(math.Abs(float64(value)-float64(f.CompareValue)) / f.CompareValue)
leftValue = dataobj.JsonFloat(math.Abs((float64(value)-float64(f.CompareValue))/f.CompareValue)) * 100.00
isTriggered = checkIsTriggered(leftValue, f.Operator, f.RightValue)
return
@ -419,7 +419,7 @@ func (f CAvgRateFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.
}
value := sum / dataobj.JsonFloat(vsLen)
leftValue = (value - dataobj.JsonFloat(f.CompareValue)) / dataobj.JsonFloat(math.Abs(f.CompareValue))
leftValue = (value - dataobj.JsonFloat(f.CompareValue)) / dataobj.JsonFloat(math.Abs(f.CompareValue)) * 100.00
isTriggered = checkIsTriggered(leftValue, f.Operator, f.RightValue)
return