mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
add if check for number of scheduled pods to be greater than 0
This commit is contained in:
parent
55f255208a
commit
359116f525
@ -256,13 +256,16 @@ func (tc *throughputCollector) run(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scheduled := len(podsScheduled)
|
scheduled := len(podsScheduled)
|
||||||
|
// Only do sampling if number of scheduled pods is greater than zero
|
||||||
|
if scheduled > 0 {
|
||||||
samplingRatioSeconds := float64(throughputSampleFrequency) / float64(time.Second)
|
samplingRatioSeconds := float64(throughputSampleFrequency) / float64(time.Second)
|
||||||
throughput := float64(scheduled-lastScheduledCount) / samplingRatioSeconds
|
throughput := float64(scheduled-lastScheduledCount) / samplingRatioSeconds
|
||||||
tc.schedulingThroughputs = append(tc.schedulingThroughputs, throughput)
|
tc.schedulingThroughputs = append(tc.schedulingThroughputs, throughput)
|
||||||
lastScheduledCount = scheduled
|
lastScheduledCount = scheduled
|
||||||
|
|
||||||
klog.Infof("%d pods scheduled", lastScheduledCount)
|
klog.Infof("%d pods scheduled", lastScheduledCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user