Skip to content

Commit

Permalink
Removing the labels fstype and options as the disk_bytes_used metric …
Browse files Browse the repository at this point in the history
…should report only size
  • Loading branch information
vteratipally committed Oct 3, 2020
1 parent f42281e commit 5fdfb1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion pkg/systemstatsmonitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ 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`).

Expand Down
8 changes: 3 additions & 5 deletions pkg/systemstatsmonitor/disk_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func NewDiskCollectorOrDie(diskConfig *ssmtypes.DiskStatsConfig) *diskCollector
"Disk bytes used, in Bytes",
"Byte",
metrics.LastValue,
[]string{deviceNameLabel, fsTypeLabel, mountOptionLabel, stateLabel})
[]string{deviceNameLabel, stateLabel})
if err != nil {
glog.Fatalf("Error initializing metric for %q: %v", metrics.DiskBytesUsedID, err)
}
Expand Down Expand Up @@ -276,10 +276,8 @@ func (dc *diskCollector) collect() {
continue
}
deviceName := strings.TrimPrefix(partition.Device, "/dev/")
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))
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))
}

}
Expand Down

0 comments on commit 5fdfb1d

Please sign in to comment.