Skip to content

Commit 1550882

Browse files
committed
avoid duplicating the disk bytes used metrics based on fstype and mountopts
1 parent 35bfe69 commit 1550882

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/systemstatsmonitor/disk_collector.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,16 @@ func (dc *diskCollector) collect() {
269269
if dc.mBytesUsed == nil {
270270
return
271271
}
272+
273+
// to make sure that the rows are not duplicated
274+
// we display only the only one row even if there are
275+
// mutiple rows for the same disk.
276+
seen := make(map[string]bool)
272277
for _, partition := range partitions {
278+
if seen[partition.Device] {
279+
continue
280+
}
281+
seen[partition.Device] = true
273282
usageStat, err := disk.Usage(partition.Mountpoint)
274283
if err != nil {
275284
glog.Errorf("Failed to retrieve disk usage for %q: %v", partition.Mountpoint, err)

0 commit comments

Comments
 (0)