Merge pull request #6378 from prometheus/accurate-desired-shards-metric
Change desired shards metric to report raw calculated value
This commit is contained in:
commit
5000c05378
|
@ -500,7 +500,7 @@ func (t *QueueManager) updateShardsLoop() {
|
||||||
// to stay close to shardUpdateDuration.
|
// to stay close to shardUpdateDuration.
|
||||||
select {
|
select {
|
||||||
case t.reshardChan <- desiredShards:
|
case t.reshardChan <- desiredShards:
|
||||||
level.Info(t.logger).Log("msg", "Remote storage resharding", "from", t.numShards, "to", numShards)
|
level.Info(t.logger).Log("msg", "Remote storage resharding", "from", t.numShards, "to", desiredShards)
|
||||||
t.numShards = desiredShards
|
t.numShards = desiredShards
|
||||||
default:
|
default:
|
||||||
level.Info(t.logger).Log("msg", "Currently resharding, skipping.")
|
level.Info(t.logger).Log("msg", "Currently resharding, skipping.")
|
||||||
|
@ -565,6 +565,7 @@ func (t *QueueManager) calculateDesiredShards() int {
|
||||||
timePerSample = samplesOutDuration / samplesOutRate
|
timePerSample = samplesOutDuration / samplesOutRate
|
||||||
desiredShards = timePerSample * (samplesInRate + t.integralAccumulator)
|
desiredShards = timePerSample * (samplesInRate + t.integralAccumulator)
|
||||||
)
|
)
|
||||||
|
t.desiredNumShards.Set(desiredShards)
|
||||||
level.Debug(t.logger).Log("msg", "QueueManager.calculateDesiredShards",
|
level.Debug(t.logger).Log("msg", "QueueManager.calculateDesiredShards",
|
||||||
"samplesInRate", samplesInRate,
|
"samplesInRate", samplesInRate,
|
||||||
"samplesOutRate", samplesOutRate,
|
"samplesOutRate", samplesOutRate,
|
||||||
|
@ -591,7 +592,6 @@ func (t *QueueManager) calculateDesiredShards() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
numShards := int(math.Ceil(desiredShards))
|
numShards := int(math.Ceil(desiredShards))
|
||||||
t.desiredNumShards.Set(float64(numShards))
|
|
||||||
if numShards > t.cfg.MaxShards {
|
if numShards > t.cfg.MaxShards {
|
||||||
numShards = t.cfg.MaxShards
|
numShards = t.cfg.MaxShards
|
||||||
} else if numShards < t.cfg.MinShards {
|
} else if numShards < t.cfg.MinShards {
|
||||||
|
|
Loading…
Reference in New Issue