mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 12:16:26 +00:00
Ignore first collected disk stats to prevent metric distortion
This commit is contained in:
@@ -109,12 +109,16 @@ func (dc *diskCollector) collect() {
|
||||
|
||||
for deviceName, ioCountersStat := range ioCountersStats {
|
||||
// Calculate average IO queue length since last measurement.
|
||||
lastIOTime := dc.historyIOTime[deviceName]
|
||||
lastIOTime, historyExist := dc.historyIOTime[deviceName]
|
||||
lastWeightedIO := dc.historyWeightedIO[deviceName]
|
||||
|
||||
dc.historyIOTime[deviceName] = ioCountersStat.IoTime
|
||||
dc.historyWeightedIO[deviceName] = ioCountersStat.WeightedIO
|
||||
|
||||
if !historyExist {
|
||||
// Ignore first collected stats.
|
||||
return
|
||||
}
|
||||
avgQueueLen := float64(0.0)
|
||||
if lastIOTime != ioCountersStat.IoTime {
|
||||
avgQueueLen = float64(ioCountersStat.WeightedIO-lastWeightedIO) / float64(ioCountersStat.IoTime-lastIOTime)
|
||||
|
||||
Reference in New Issue
Block a user