指标图表可以设置忽略空值和其他对象值

This commit is contained in:
GoEdgeLab
2021-07-26 16:44:29 +08:00
parent 7c9afcd130
commit 844ece8e95
7 changed files with 224 additions and 75 deletions

View File

@@ -1 +1,17 @@
package models
import "encoding/json"
func (this *MetricChart) DecodeIgnoredKeys() []string {
if len(this.IgnoredKeys) == 0 {
return []string{}
}
var result = []string{}
err := json.Unmarshal([]byte(this.IgnoredKeys), &result)
if err != nil {
// 这里忽略错误
return result
}
return result
}