feat: collect and report 1-min load average
This commit is contained in:
@@ -16,7 +16,9 @@ type Window struct {
|
||||
|
||||
uptime uint64
|
||||
|
||||
// DB metrics — populated only when a DB collector is registered.
|
||||
load float64
|
||||
|
||||
// DB metrics. populated only when a DB collector is registered.
|
||||
hasDB bool
|
||||
dbDriver uint8
|
||||
dbConnPctSum float64
|
||||
@@ -34,6 +36,7 @@ type Snapshot struct {
|
||||
MemAvg float64
|
||||
DiskAvg float64
|
||||
Uptime uint64
|
||||
Load float64
|
||||
|
||||
// nil when DB monitoring is not enabled.
|
||||
DBDriver *uint8
|
||||
@@ -66,6 +69,10 @@ func (w *Window) SetUptime(value uint64) {
|
||||
w.uptime = value
|
||||
}
|
||||
|
||||
func (w *Window) SetLoad(value float64) {
|
||||
w.load = value
|
||||
}
|
||||
|
||||
func (w *Window) AddDBConnPct(v float64) {
|
||||
w.dbConnPctSum += v
|
||||
w.dbConnPctCount++
|
||||
@@ -118,6 +125,7 @@ func (w *Window) Snapshot() Snapshot {
|
||||
MemAvg: memAvg,
|
||||
DiskAvg: diskAvg,
|
||||
Uptime: w.uptime,
|
||||
Load: w.load,
|
||||
}
|
||||
|
||||
if w.hasDB {
|
||||
|
||||
Reference in New Issue
Block a user