fix: 自定义指标数据计算小于0就强制为0
This commit is contained in:
@@ -183,11 +183,14 @@ func (s *KPI) saveKPIDataC(k oam.KPI, index int64) error {
|
||||
item["err"] = err.Error()
|
||||
} else {
|
||||
if v.Unit == "%" {
|
||||
resultInt64 := parse.Number(result)
|
||||
if resultInt64 > 100 {
|
||||
resultV, ok := result.(float64)
|
||||
if !ok {
|
||||
resultV = 0
|
||||
}
|
||||
if resultV > 100 {
|
||||
result = 100
|
||||
}
|
||||
if resultInt64 < 0 {
|
||||
if resultV < 0 {
|
||||
result = 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user