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

This commit is contained in:
David Zhao
2022-04-24 23:25:33 -07:00
committed by GitHub
parent b9ee0b5800
commit 4e5863496c

View File

@@ -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
}