Skip to content

Commit

Permalink
Filter out metrics with no value
Browse files Browse the repository at this point in the history
Signed-off-by: Trey Dockendorf <[email protected]>
  • Loading branch information
treydock committed Jul 10, 2020
1 parent c345074 commit b11d0e5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/gpu_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,24 @@ func (c *DCGMCollector) GetMetrics() ([][]Metric, error) {
}

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

for i, val := range values {
metrics[i] = Metric{
v := ToString(val)
// Filter out counters with no value
if v == "9223372036854775794" {
continue
}
m := Metric{
Name: c[i].FieldName,
Value: ToString(val),
Value: v,

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

Attributes: map[string]string{},
}
metrics = append(metrics, m)
}

return metrics
Expand Down

0 comments on commit b11d0e5

Please sign in to comment.