Record the exact value of desired shards in metric

It is possible that desired shards is always a bit higher than the
number of shards (less than 30%) and by exporting desired shards as the
raw number it will be easy to tell if a Prometheus is in that situation.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
This commit is contained in:
Chris Marchbanks 2019-11-26 06:26:03 -07:00
parent 0e684ca205
commit 6f34e35b3e
No known key found for this signature in database
GPG key ID: B7FD940BC86A8E7A

View file

@ -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 {