Skip to content

Commit

Permalink
fix(host): No tag when tag's value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
rainzm committed Apr 22, 2020
1 parent 087a2a1 commit 72716b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/hostman/hostmetrics/hostmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ func (s *SGuestMonitorCollector) toTelegrafReportData(data *jsonutils.JSONDict)
for metrics, stat := range report.(*jsonutils.JSONDict).Value() {
tags := map[string]string{
"vm_id": guestId, "vm_name": vmName, "vm_ip": vmIp,
"is_vm": "true", "platform": "kvm", "vm_scaling_group_id": scalingGroupId,
"is_vm": "true", "platform": "kvm",
}
if len(scalingGroupId) > 0 {
tags["vm_scaling_group_id"] = scalingGroupId
}
if val, ok := stat.(*jsonutils.JSONDict); ok {
line := s.addTelegrafLine(metrics, tags, val)
Expand Down

0 comments on commit 72716b8

Please sign in to comment.