mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	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:
		
							parent
							
								
									48bb6f670c
								
							
						
					
					
						commit
						6496c24d61
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -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=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								vendor/github.com/lufia/iostat/go.mod
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/lufia/iostat/go.mod
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
module github.com/lufia/iostat
 | 
			
		||||
 | 
			
		||||
go 1.14
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -17,6 +17,10 @@ type DriveStats struct {
 | 
			
		|||
	TotalWriteTime time.Duration
 | 
			
		||||
	ReadLatency    time.Duration
 | 
			
		||||
	WriteLatency   time.Duration
 | 
			
		||||
	ReadErrors     int64
 | 
			
		||||
	WriteErrors    int64
 | 
			
		||||
	ReadRetries    int64
 | 
			
		||||
	WriteRetries   int64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CPUStats represents CPU statistics.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat_darwin.c
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat_darwin.c
									
									
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -95,6 +95,10 @@ static struct {
 | 
			
		|||
	{kIOBlockStorageDriverStatisticsTotalWriteTimeKey, offsetof(DriveStats, writetime)},
 | 
			
		||||
	{kIOBlockStorageDriverStatisticsLatentReadTimeKey, offsetof(DriveStats, readlat)},
 | 
			
		||||
	{kIOBlockStorageDriverStatisticsLatentWriteTimeKey, offsetof(DriveStats, writelat)},
 | 
			
		||||
	{kIOBlockStorageDriverStatisticsReadErrorsKey, offsetof(DriveStats, readerrs)},
 | 
			
		||||
	{kIOBlockStorageDriverStatisticsWriteErrorsKey, offsetof(DriveStats, writeerrs)},
 | 
			
		||||
	{kIOBlockStorageDriverStatisticsReadRetriesKey, offsetof(DriveStats, readretries)},
 | 
			
		||||
	{kIOBlockStorageDriverStatisticsWriteRetriesKey, offsetof(DriveStats, writeretries)},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -32,6 +32,10 @@ func ReadDriveStats() ([]*DriveStats, error) {
 | 
			
		|||
			TotalWriteTime: time.Duration(buf[i].writetime),
 | 
			
		||||
			ReadLatency:    time.Duration(buf[i].readlat),
 | 
			
		||||
			WriteLatency:   time.Duration(buf[i].writelat),
 | 
			
		||||
			ReadErrors:     int64(buf[i].readerrs),
 | 
			
		||||
			WriteErrors:    int64(buf[i].writeerrs),
 | 
			
		||||
			ReadRetries:    int64(buf[i].readretries),
 | 
			
		||||
			WriteRetries:   int64(buf[i].writeretries),
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return stats, nil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat_darwin.h
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/lufia/iostat/iostat_darwin.h
									
									
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -19,6 +19,10 @@ struct DriveStats {
 | 
			
		|||
	int64_t writetime;
 | 
			
		||||
	int64_t readlat;
 | 
			
		||||
	int64_t writelat;
 | 
			
		||||
	int64_t readerrs;
 | 
			
		||||
	int64_t writeerrs;
 | 
			
		||||
	int64_t readretries;
 | 
			
		||||
	int64_t writeretries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct CPUStats {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue