Skip to content

Commit dd0c2ba

Browse files
committed
feat(sysadvisor): seperate cpu codename and is vm tag
1 parent e41ed7a commit dd0c2ba

File tree

1 file changed

+11
-9
lines changed
  • pkg/agent/sysadvisor/plugin/metric-emitter/syncer/node

1 file changed

+11
-9
lines changed

pkg/agent/sysadvisor/plugin/metric-emitter/syncer/node/node.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package node
1919
import (
2020
"context"
2121
"fmt"
22+
"strconv"
2223
"time"
2324

2425
v1 "k8s.io/api/core/v1"
@@ -185,23 +186,24 @@ func (n *MetricSyncerNode) generateMetricTag(ctx context.Context) (tags []metric
185186
cpuCodeName = ""
186187
}
187188

189+
tags = append(tags, metrics.MetricTag{
190+
Key: fmt.Sprintf("%s%s", data.CustomMetricLabelSelectorPrefixKey, "cpu_codename"),
191+
Val: cpuCodeName,
192+
})
193+
188194
// append vendor info
189-
vendor := ""
195+
isVM := ""
190196
isVMInterface := n.metaServer.MetricsFetcher.GetByStringIndex(consts.MetricInfoIsVM)
191-
isVM, ok := isVMInterface.(bool)
197+
isVMBool, ok := isVMInterface.(bool)
192198
if !ok {
193199
klog.Warningf("parse is vm %v failed", isVMInterface)
194200
} else {
195-
if isVM {
196-
vendor = "vm"
197-
} else {
198-
vendor = "bm"
199-
}
201+
isVM = strconv.FormatBool(isVMBool)
200202
}
201203

202204
tags = append(tags, metrics.MetricTag{
203-
Key: fmt.Sprintf("%s%s", data.CustomMetricLabelSelectorPrefixKey, "node_model"),
204-
Val: fmt.Sprintf("%s-%s", cpuCodeName, vendor),
205+
Key: fmt.Sprintf("%s%s", data.CustomMetricLabelSelectorPrefixKey, "is_vm"),
206+
Val: isVM,
205207
})
206208

207209
// append node numa bit mask

0 commit comments

Comments
 (0)