aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Wilkie <tomwilkie@users.noreply.github.com>2020-03-22 01:35:38 +0530
committerGitHub <noreply@github.com>2020-03-21 21:05:38 +0100
commit6496c24d6105e79d97f042c0afaf2a9deafce25f (patch)
tree8c79862e65c267bc54ff7e96c1b23793c4ababac
parent48bb6f670c6b8e1755312d19ab03686f8d555916 (diff)
downloadprometheus_node_collector-6496c24d6105e79d97f042c0afaf2a9deafce25f.tar.bz2
prometheus_node_collector-6496c24d6105e79d97f042c0afaf2a9deafce25f.tar.xz
prometheus_node_collector-6496c24d6105e79d97f042c0afaf2a9deafce25f.zip
Metrics for IO errors on Mac. (#1636)
* Metrics for IO errors and retries on Mac. Signed-off-by: Tom Wilkie <tom@grafana.com>
-rw-r--r--CHANGELOG.md1
-rw-r--r--collector/diskstats_darwin.go56
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--vendor/github.com/lufia/iostat/go.mod3
-rw-r--r--vendor/github.com/lufia/iostat/iostat.go4
-rw-r--r--vendor/github.com/lufia/iostat/iostat_darwin.c4
-rw-r--r--vendor/github.com/lufia/iostat/iostat_darwin.go4
-rw-r--r--vendor/github.com/lufia/iostat/iostat_darwin.h4
-rw-r--r--vendor/modules.txt2
10 files changed, 80 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d7c2d2..8a68611 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
3* [CHANGE] 3* [CHANGE]
4* [FEATURE] 4* [FEATURE]
5* [ENHANCEMENT] Add model_name and stepping to node_cpu_info metric #1617 5* [ENHANCEMENT] Add model_name and stepping to node_cpu_info metric #1617
6* [ENHANCEMENT] Add metrics for IO errors and retires on Darwin. #1636
6* [BUGFIX] 7* [BUGFIX]
7 8
8## 1.0.0-rc.0 / 2020-02-20 9## 1.0.0-rc.0 / 2020-02-20
diff --git a/collector/diskstats_darwin.go b/collector/diskstats_darwin.go
index 8b11812..89622a3 100644
--- a/collector/diskstats_darwin.go
+++ b/collector/diskstats_darwin.go
@@ -125,6 +125,62 @@ func NewDiskstatsCollector(logger log.Logger) (Collector, error) {
125 return float64(stat.BytesWritten) 125 return float64(stat.BytesWritten)
126 }, 126 },
127 }, 127 },
128 {
129 typedDesc: typedDesc{
130 desc: prometheus.NewDesc(
131 prometheus.BuildFQName(namespace, diskSubsystem, "read_errors_total"),
132 "The total number of read errors.",
133 diskLabelNames,
134 nil,
135 ),
136 valueType: prometheus.CounterValue,
137 },
138 value: func(stat *iostat.DriveStats) float64 {
139 return float64(stat.ReadErrors)
140 },
141 },
142 {
143 typedDesc: typedDesc{
144 desc: prometheus.NewDesc(
145 prometheus.BuildFQName(namespace, diskSubsystem, "write_errors_total"),
146 "The total number of write errors.",
147 diskLabelNames,
148 nil,
149 ),
150 valueType: prometheus.CounterValue,
151 },
152 value: func(stat *iostat.DriveStats) float64 {
153 return float64(stat.WriteErrors)
154 },
155 },
156 {
157 typedDesc: typedDesc{
158 desc: prometheus.NewDesc(
159 prometheus.BuildFQName(namespace, diskSubsystem, "read_retries_total"),
160 "The total number of read retries.",
161 diskLabelNames,
162 nil,
163 ),
164 valueType: prometheus.CounterValue,
165 },
166 value: func(stat *iostat.DriveStats) float64 {
167 return float64(stat.ReadRetries)
168 },
169 },
170 {
171 typedDesc: typedDesc{
172 desc: prometheus.NewDesc(
173 prometheus.BuildFQName(namespace, diskSubsystem, "write_retries_total"),
174 "The total number of write retries.",
175 diskLabelNames,
176 nil,
177 ),
178 valueType: prometheus.CounterValue,
179 },
180 value: func(stat *iostat.DriveStats) float64 {
181 return float64(stat.WriteRetries)
182 },
183 },
128 }, 184 },
129 logger: logger, 185 logger: logger,
130 }, nil 186 }, nil
diff --git a/go.mod b/go.mod
index f67a6b2..c84801a 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ require (
9 github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 9 github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968
10 github.com/golang/protobuf v1.3.3 // indirect 10 github.com/golang/protobuf v1.3.3 // indirect
11 github.com/hodgesds/perf-utils v0.0.8 11 github.com/hodgesds/perf-utils v0.0.8
12 github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3 12 github.com/lufia/iostat v1.1.0
13 github.com/mattn/go-xmlrpc v0.0.3 13 github.com/mattn/go-xmlrpc v0.0.3
14 github.com/mdlayher/genetlink v1.0.0 // indirect 14 github.com/mdlayher/genetlink v1.0.0 // indirect
15 github.com/mdlayher/netlink v1.1.0 // indirect 15 github.com/mdlayher/netlink v1.1.0 // indirect
diff --git a/go.sum b/go.sum
index b5b43a0..1b43a8b 100644
--- a/go.sum
+++ b/go.sum
@@ -174,8 +174,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
174github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 174github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
175github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= 175github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
176github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= 176github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
177github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3 h1:XGhvld9vIpj929Gri5ybjukYZeyZwKkFkqgATqBQiOs= 177github.com/lufia/iostat v1.1.0 h1:Z1wa4Hhxwi8uSKfgRsFc5RLtt3SuFPIOgkiPGkUtHDY=
178github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3/go.mod h1:lRgtFVamD7L7GaXOSwBiuXMwU3Aicfn5h66LVs4u2SA= 178github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg=
179github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= 179github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
180github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 180github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
181github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 181github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
diff --git a/vendor/github.com/lufia/iostat/go.mod b/vendor/github.com/lufia/iostat/go.mod
new file mode 100644
index 0000000..35d0e84
--- /dev/null
+++ b/vendor/github.com/lufia/iostat/go.mod
@@ -0,0 +1,3 @@
1module github.com/lufia/iostat
2
3go 1.14
diff --git a/vendor/github.com/lufia/iostat/iostat.go b/vendor/github.com/lufia/iostat/iostat.go
index ada2dad..794b51e 100644
--- a/vendor/github.com/lufia/iostat/iostat.go
+++ b/vendor/github.com/lufia/iostat/iostat.go
@@ -17,6 +17,10 @@ type DriveStats struct {
17 TotalWriteTime time.Duration 17 TotalWriteTime time.Duration
18 ReadLatency time.Duration 18 ReadLatency time.Duration
19 WriteLatency time.Duration 19 WriteLatency time.Duration
20 ReadErrors int64
21 WriteErrors int64
22 ReadRetries int64
23 WriteRetries int64
20} 24}
21 25
22// CPUStats represents CPU statistics. 26// CPUStats represents CPU statistics.
diff --git a/vendor/github.com/lufia/iostat/iostat_darwin.c b/vendor/github.com/lufia/iostat/iostat_darwin.c
index 4f696c9..dfe77a8 100644
--- a/vendor/github.com/lufia/iostat/iostat_darwin.c
+++ b/vendor/github.com/lufia/iostat/iostat_darwin.c
@@ -95,6 +95,10 @@ static struct {
95 {kIOBlockStorageDriverStatisticsTotalWriteTimeKey, offsetof(DriveStats, writetime)}, 95 {kIOBlockStorageDriverStatisticsTotalWriteTimeKey, offsetof(DriveStats, writetime)},
96 {kIOBlockStorageDriverStatisticsLatentReadTimeKey, offsetof(DriveStats, readlat)}, 96 {kIOBlockStorageDriverStatisticsLatentReadTimeKey, offsetof(DriveStats, readlat)},
97 {kIOBlockStorageDriverStatisticsLatentWriteTimeKey, offsetof(DriveStats, writelat)}, 97 {kIOBlockStorageDriverStatisticsLatentWriteTimeKey, offsetof(DriveStats, writelat)},
98 {kIOBlockStorageDriverStatisticsReadErrorsKey, offsetof(DriveStats, readerrs)},
99 {kIOBlockStorageDriverStatisticsWriteErrorsKey, offsetof(DriveStats, writeerrs)},
100 {kIOBlockStorageDriverStatisticsReadRetriesKey, offsetof(DriveStats, readretries)},
101 {kIOBlockStorageDriverStatisticsWriteRetriesKey, offsetof(DriveStats, writeretries)},
98}; 102};
99 103
100static int 104static int
diff --git a/vendor/github.com/lufia/iostat/iostat_darwin.go b/vendor/github.com/lufia/iostat/iostat_darwin.go
index 16e2cfd..93f9334 100644
--- a/vendor/github.com/lufia/iostat/iostat_darwin.go
+++ b/vendor/github.com/lufia/iostat/iostat_darwin.go
@@ -32,6 +32,10 @@ func ReadDriveStats() ([]*DriveStats, error) {
32 TotalWriteTime: time.Duration(buf[i].writetime), 32 TotalWriteTime: time.Duration(buf[i].writetime),
33 ReadLatency: time.Duration(buf[i].readlat), 33 ReadLatency: time.Duration(buf[i].readlat),
34 WriteLatency: time.Duration(buf[i].writelat), 34 WriteLatency: time.Duration(buf[i].writelat),
35 ReadErrors: int64(buf[i].readerrs),
36 WriteErrors: int64(buf[i].writeerrs),
37 ReadRetries: int64(buf[i].readretries),
38 WriteRetries: int64(buf[i].writeretries),
35 } 39 }
36 } 40 }
37 return stats, nil 41 return stats, nil
diff --git a/vendor/github.com/lufia/iostat/iostat_darwin.h b/vendor/github.com/lufia/iostat/iostat_darwin.h
index f559db8..baece0a 100644
--- a/vendor/github.com/lufia/iostat/iostat_darwin.h
+++ b/vendor/github.com/lufia/iostat/iostat_darwin.h
@@ -19,6 +19,10 @@ struct DriveStats {
19 int64_t writetime; 19 int64_t writetime;
20 int64_t readlat; 20 int64_t readlat;
21 int64_t writelat; 21 int64_t writelat;
22 int64_t readerrs;
23 int64_t writeerrs;
24 int64_t readretries;
25 int64_t writeretries;
22}; 26};
23 27
24struct CPUStats { 28struct CPUStats {
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 033b85a..546605c 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -30,7 +30,7 @@ github.com/golang/protobuf/ptypes/duration
30github.com/golang/protobuf/ptypes/timestamp 30github.com/golang/protobuf/ptypes/timestamp
31# github.com/hodgesds/perf-utils v0.0.8 31# github.com/hodgesds/perf-utils v0.0.8
32github.com/hodgesds/perf-utils 32github.com/hodgesds/perf-utils
33# github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3 33# github.com/lufia/iostat v1.1.0
34github.com/lufia/iostat 34github.com/lufia/iostat
35# github.com/mattn/go-xmlrpc v0.0.3 35# github.com/mattn/go-xmlrpc v0.0.3
36github.com/mattn/go-xmlrpc 36github.com/mattn/go-xmlrpc