mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 20:36:21 +01:00
Explicitly check for the rc 3 in call to getloadavg(). Reorder logic.
This commit is contained in:
parent
af358ec800
commit
b73af72853
@ -32,8 +32,8 @@ import "C"
|
||||
func getLoad() ([]float64, error) {
|
||||
var loadavg [3]C.double
|
||||
samples := C.getloadavg(&loadavg[0], 3)
|
||||
if samples > 0 {
|
||||
return []float64{float64(loadavg[0]), float64(loadavg[1]), float64(loadavg[2])}, nil
|
||||
if samples != 3 {
|
||||
return nil, errors.New("failed to get load average")
|
||||
}
|
||||
return nil, errors.New("failed to get load average")
|
||||
return []float64{float64(loadavg[0]), float64(loadavg[1]), float64(loadavg[2])}, nil
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ import "C"
|
||||
func getLoad() ([]float64, error) {
|
||||
var loadavg [3]C.double
|
||||
samples := C.getloadavg(&loadavg[0], 3)
|
||||
if samples > 0 {
|
||||
return []float64{float64(loadavg[0]), float64(loadavg[1]), float64(loadavg[2])}, nil
|
||||
if samples != 3 {
|
||||
return nil, errors.New("failed to get load average")
|
||||
}
|
||||
return nil, errors.New("failed to get load average")
|
||||
return []float64{float64(loadavg[0]), float64(loadavg[1]), float64(loadavg[2])}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user