mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Only reduce the number of shards when caught up.
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
This commit is contained in:
parent
9e24e1f9e8
commit
7f3aca62c4
|
@ -526,7 +526,8 @@ func (t *QueueManager) calculateDesiredShards() int {
|
|||
samplesPendingRate = samplesInRate*samplesKeptRatio - samplesOutRate
|
||||
highestSent = t.highestSentTimestampMetric.Get()
|
||||
highestRecv = highestTimestamp.Get()
|
||||
samplesPending = (highestRecv - highestSent) * samplesInRate * samplesKeptRatio
|
||||
delay = highestRecv - highestSent
|
||||
samplesPending = delay * samplesInRate * samplesKeptRatio
|
||||
)
|
||||
|
||||
if samplesOutRate <= 0 {
|
||||
|
@ -577,6 +578,12 @@ func (t *QueueManager) calculateDesiredShards() int {
|
|||
}
|
||||
|
||||
numShards := int(math.Ceil(desiredShards))
|
||||
// Do not downshard if we are more than ten seconds back.
|
||||
if numShards < t.numShards && delay > 10.0 {
|
||||
level.Debug(t.logger).Log("msg", "Not downsharding due to being too far behind")
|
||||
return t.numShards
|
||||
}
|
||||
|
||||
if numShards > t.cfg.MaxShards {
|
||||
numShards = t.cfg.MaxShards
|
||||
} else if numShards < t.cfg.MinShards {
|
||||
|
|
Loading…
Reference in a new issue