Set numCPUs correctly in non-linux environment (#653)

This commit is contained in:
David Zhao authored and GitHub committed 2022-04-24 23:25:33 -07:00
1 parent b9ee0b5800
commit 4e5863496c
1 file changed
+4
@@ -4,6 +4,8 @@
package prometheus
import (
"runtime"
"github.com/mackerelio/go-osstat/cpu"
)
@@ -22,5 +24,7 @@ func getCPUStats() (cpuLoad float32, numCPUs uint32, err error) {
lastCPUTotal = cpuInfo.Total
lastCPUIdle = cpuInfo.Idle
numCPUs = uint32(runtime.NumCPU())
return
}