Merge pull request #452 from vteratipally/add_fstypes

Add more info to disk metrics
This commit is contained in:
Kubernetes Prow Robot
2020-08-07 13:37:57 -07:00
committed by GitHub
3 changed files with 12 additions and 3 deletions
+1
View File
@@ -40,6 +40,7 @@ Below metrics are collected from `disk` component:
* `disk_operation_bytes_count`: # of Bytes used for reads/writes on this device
* `disk_operation_time`: [# of milliseconds spent reading/writing][iostat doc]
* `disk_bytes_used`: Disk usage in Bytes. The usage state is reported under the `state` metric label (e.g. `used`, `free`). Summing values of all states yields the disk size.
FSType and MountOptions are also reported as additional information.
The name of the disk block device is reported in the `device_name` metric label (e.g. `sda`).
+5 -3
View File
@@ -145,7 +145,7 @@ func NewDiskCollectorOrDie(diskConfig *ssmtypes.DiskStatsConfig) *diskCollector
"Disk bytes used, in Bytes",
"Byte",
metrics.LastValue,
[]string{deviceNameLabel, stateLabel})
[]string{deviceNameLabel, fsTypeLabel, mountOptionLabel, stateLabel})
if err != nil {
glog.Fatalf("Error initializing metric for %q: %v", metrics.DiskBytesUsedID, err)
}
@@ -276,8 +276,10 @@ func (dc *diskCollector) collect() {
continue
}
deviceName := strings.TrimPrefix(partition.Device, "/dev/")
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, stateLabel: "free"}, int64(usageStat.Free))
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, stateLabel: "used"}, int64(usageStat.Used))
fstype := partition.Fstype
opttypes := partition.Opts
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, fsTypeLabel: fstype, mountOptionLabel: opttypes, stateLabel: "free"}, int64(usageStat.Free))
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, fsTypeLabel: fstype, mountOptionLabel: opttypes, stateLabel: "used"}, int64(usageStat.Used))
}
}
+6
View File
@@ -24,3 +24,9 @@ const directionLabel = "direction"
// stateLabel labels the state of disk/memory/cpu usage, e.g.: "free", "used".
const stateLabel = "state"
// fsTypeLabel labels the fst type of the disk, e.g.: "ext4", "ext2", "vfat"
const fsTypeLabel = "fstype"
// mountPointLabel labels the mountpoint of the monitored disk device
const mountOptionLabel = "mountoption"