Skip to content

Commit

Permalink
Metrics for IO errors on Mac. (#1636)
Browse files Browse the repository at this point in the history
* Metrics for IO errors and retries on Mac.

Signed-off-by: Tom Wilkie <[email protected]>
  • Loading branch information
tomwilkie authored Mar 21, 2020
1 parent 48bb6f6 commit 6496c24
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* [CHANGE]
* [FEATURE]
* [ENHANCEMENT] Add model_name and stepping to node_cpu_info metric #1617
* [ENHANCEMENT] Add metrics for IO errors and retires on Darwin. #1636
* [BUGFIX]

## 1.0.0-rc.0 / 2020-02-20
Expand Down
56 changes: 56 additions & 0 deletions collector/diskstats_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968
github.com/golang/protobuf v1.3.3 // indirect
github.com/hodgesds/perf-utils v0.0.8
github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3
github.com/lufia/iostat v1.1.0
github.com/mattn/go-xmlrpc v0.0.3
github.com/mdlayher/genetlink v1.0.0 // indirect
github.com/mdlayher/netlink v1.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3 h1:XGhvld9vIpj929Gri5ybjukYZeyZwKkFkqgATqBQiOs=
github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3/go.mod h1:lRgtFVamD7L7GaXOSwBiuXMwU3Aicfn5h66LVs4u2SA=
github.com/lufia/iostat v1.1.0 h1:Z1wa4Hhxwi8uSKfgRsFc5RLtt3SuFPIOgkiPGkUtHDY=
github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
Expand Down
3 changes: 3 additions & 0 deletions vendor/github.com/lufia/iostat/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/lufia/iostat/iostat.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/lufia/iostat/iostat_darwin.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/lufia/iostat/iostat_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/lufia/iostat/iostat_darwin.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/timestamp
# github.com/hodgesds/perf-utils v0.0.8
github.com/hodgesds/perf-utils
# github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3
# github.com/lufia/iostat v1.1.0
github.com/lufia/iostat
# github.com/mattn/go-xmlrpc v0.0.3
github.com/mattn/go-xmlrpc
Expand Down

0 comments on commit 6496c24

Please sign in to comment.