From f93125ba10548ae54319e379a21ae5047912237e Mon Sep 17 00:00:00 2001 From: Siavash Safi Date: Tue, 23 Jun 2015 22:43:03 +0430 Subject: [PATCH] loadavg: Remove unnecessary global variable. --- collector/loadavg.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/collector/loadavg.go b/collector/loadavg.go index 6be49616..6ecb7edb 100644 --- a/collector/loadavg.go +++ b/collector/loadavg.go @@ -13,15 +13,12 @@ import ( // #include import "C" -var loadavg [1]C.double - type loadavgCollector struct { metric prometheus.Gauge } func init() { Factories["loadavg"] = NewLoadavgCollector - loadavg[0] = 0 } // load1 stat. @@ -47,6 +44,7 @@ func (c *loadavgCollector) Update(ch chan<- prometheus.Metric) (err error) { } func getLoad1() (float64, error) { + var loadavg [1]C.double samples := C.getloadavg(&loadavg[0], 1) if samples > 0 { return float64(loadavg[0]), nil