Skip to content

Commit e132101

Browse files
committed
Add more info to disk metrics
1 parent c01ea4f commit e132101

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pkg/systemstatsmonitor/disk_collector.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func NewDiskCollectorOrDie(diskConfig *ssmtypes.DiskStatsConfig) *diskCollector
145145
"Disk bytes used, in Bytes",
146146
"Byte",
147147
metrics.LastValue,
148-
[]string{deviceNameLabel, stateLabel})
148+
[]string{deviceNameLabel, fstypeLabel, mountOptionLabel, stateLabel})
149149
if err != nil {
150150
glog.Fatalf("Error initializing metric for %q: %v", metrics.DiskBytesUsedID, err)
151151
}
@@ -276,8 +276,10 @@ func (dc *diskCollector) collect() {
276276
continue
277277
}
278278
deviceName := strings.TrimPrefix(partition.Device, "/dev/")
279-
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, stateLabel: "free"}, int64(usageStat.Free))
280-
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, stateLabel: "used"}, int64(usageStat.Used))
279+
fstype := partition.Fstype
280+
opttypes := partition.Opts
281+
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, fstypeLabel: fstype, mountOptionLabel: opttypes, stateLabel: "free"}, int64(usageStat.Free))
282+
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, fstypeLabel: fstype, mountOptionLabel: opttypes, stateLabel: "used"}, int64(usageStat.Used))
281283
}
282284

283285
}

pkg/systemstatsmonitor/labels.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ const directionLabel = "direction"
2424

2525
// stateLabel labels the state of disk/memory/cpu usage, e.g.: "free", "used".
2626
const stateLabel = "state"
27+
28+
// fstypeLabel labels the fst type of the disk, e.g.: "ext4", "ext2", "vfat"
29+
const fstypeLabel = "fstype"
30+
31+
// mountPointLabel labels the mountpoint of the monitored disk device
32+
const mountOptionLabel = "mountoption"

0 commit comments

Comments
 (0)