Skip to content

Commit b11d0e5

Browse files
committed
Filter out metrics with no value
Signed-off-by: Trey Dockendorf <[email protected]>
1 parent c345074 commit b11d0e5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/gpu_collector.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,24 @@ func (c *DCGMCollector) GetMetrics() ([][]Metric, error) {
6969
}
7070

7171
func ToMetric(values []dcgm.FieldValue_v1, c []Counter, d dcgm.Device) []Metric {
72-
metrics := make([]Metric, len(values))
72+
var metrics []Metric
7373

7474
for i, val := range values {
75-
metrics[i] = Metric{
75+
v := ToString(val)
76+
// Filter out counters with no value
77+
if v == "9223372036854775794" {
78+
continue
79+
}
80+
m := Metric{
7681
Name: c[i].FieldName,
77-
Value: ToString(val),
82+
Value: v,
7883

7984
GPU: fmt.Sprintf("%d", d.GPU),
8085
GPUUUID: d.UUID,
8186

8287
Attributes: map[string]string{},
8388
}
89+
metrics = append(metrics, m)
8490
}
8591

8692
return metrics

0 commit comments

Comments
 (0)