Metrics for IO errors on Mac. (#1636)

* Metrics for IO errors and retries on Mac.

Signed-off-by: Tom Wilkie <tom@grafana.com>
This commit is contained in:
Tom Wilkie 2020-03-22 01:35:38 +05:30 committed by GitHub
commit 6496c24d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 80 additions and 4 deletions

View file

@ -125,6 +125,62 @@ func NewDiskstatsCollector(logger log.Logger) (Collector, error) {
return float64(stat.BytesWritten)
},
},
{
typedDesc: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, diskSubsystem, "read_errors_total"),
"The total number of read errors.",
diskLabelNames,
nil,
),
valueType: prometheus.CounterValue,
},
value: func(stat *iostat.DriveStats) float64 {
return float64(stat.ReadErrors)
},
},
{
typedDesc: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, diskSubsystem, "write_errors_total"),
"The total number of write errors.",
diskLabelNames,
nil,
),
valueType: prometheus.CounterValue,
},
value: func(stat *iostat.DriveStats) float64 {
return float64(stat.WriteErrors)
},
},
{
typedDesc: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, diskSubsystem, "read_retries_total"),
"The total number of read retries.",
diskLabelNames,
nil,
),
valueType: prometheus.CounterValue,
},
value: func(stat *iostat.DriveStats) float64 {
return float64(stat.ReadRetries)
},
},
{
typedDesc: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, diskSubsystem, "write_retries_total"),
"The total number of write retries.",
diskLabelNames,
nil,
),
valueType: prometheus.CounterValue,
},
value: func(stat *iostat.DriveStats) float64 {
return float64(stat.WriteRetries)
},
},
},
logger: logger,
}, nil