提交 de99077b 编写于 作者: U Ulric Qin

code refactor: remove unused field(TagsLst) of MetricPoint

上级 e288a3d3
......@@ -110,17 +110,19 @@ func enrich(point *vos.MetricPoint) {
}
}
var tagsLst []string
// 根据tagsmap生成tagslst,sort
count := len(point.TagsMap)
if count == 0 {
point.TagsLst = []string{}
tagsLst = []string{}
} else {
lst := make([]string, 0, count)
for k, v := range point.TagsMap {
lst = append(lst, k+"="+v)
}
sort.Strings(lst)
point.TagsLst = lst
tagsLst = lst
}
// ident metric tagslst 生成 pk
......@@ -131,8 +133,8 @@ func enrich(point *vos.MetricPoint) {
ret.WriteString(point.Ident)
ret.WriteString(point.Metric)
for i := 0; i < len(point.TagsLst); i++ {
ret.WriteString(point.TagsLst[i])
for i := 0; i < len(tagsLst); i++ {
ret.WriteString(tagsLst[i])
}
point.PK = str.MD5(ret.String())
......
......@@ -21,7 +21,6 @@ type MetricPoint struct {
Alias string `json:"alias"` // 资源名称,跟资源无关的监控数据,该字段为空
Metric string `json:"metric"` // 监控指标名称
TagsMap map[string]string `json:"tags"` // 监控数据标签
TagsLst []string `json:"-"` // 内部字段,用于对TagsMap排序
Time int64 `json:"time"` // 时间戳,单位是秒
ValueUntyped interface{} `json:"value"` // 监控数据数值,可以是int float string,但最终要能转换为float64
Value float64 `json:"-"` // 内部字段,最终转换之后的float64数值
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册