mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 08:40:42 +00:00
Handle edge cases in seat demand stats
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>
This commit is contained in:
parent
55c86d6ad9
commit
b0e249f657
@ -263,9 +263,15 @@ type seatDemandStats struct {
|
||||
}
|
||||
|
||||
func (stats *seatDemandStats) update(obs fq.IntegratorResults) {
|
||||
stats.highWatermark = obs.Max
|
||||
if obs.Duration <= 0 {
|
||||
return
|
||||
}
|
||||
if math.IsNaN(obs.Deviation) {
|
||||
obs.Deviation = 0
|
||||
}
|
||||
stats.avg = obs.Average
|
||||
stats.stdDev = obs.Deviation
|
||||
stats.highWatermark = obs.Max
|
||||
envelope := obs.Average + obs.Deviation
|
||||
stats.smoothed = math.Max(envelope, seatDemandSmoothingCoefficient*stats.smoothed+(1-seatDemandSmoothingCoefficient)*envelope)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user