mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
Update the runShard method and change len(pendingSamples) to n=len(pendingSamples) (#5708)
Signed-off-by: xigang <wangxigang2014@gmail.com>
This commit is contained in:
parent
fc3b772342
commit
445bcd1251
|
@ -680,9 +680,9 @@ func (s *shards) runShard(ctx context.Context, i int, queue chan prompb.TimeSeri
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
if len(pendingSamples) > 0 {
|
|
||||||
level.Debug(s.qm.logger).Log("msg", "runShard timer ticked, sending samples", "samples", len(pendingSamples), "shard", shardNum)
|
|
||||||
n := len(pendingSamples)
|
n := len(pendingSamples)
|
||||||
|
if n > 0 {
|
||||||
|
level.Debug(s.qm.logger).Log("msg", "runShard timer ticked, sending samples", "samples", n, "shard", shardNum)
|
||||||
s.sendSamples(ctx, pendingSamples, &buf)
|
s.sendSamples(ctx, pendingSamples, &buf)
|
||||||
pendingSamples = pendingSamples[:0]
|
pendingSamples = pendingSamples[:0]
|
||||||
s.qm.pendingSamplesMetric.Sub(float64(n))
|
s.qm.pendingSamplesMetric.Sub(float64(n))
|
||||||
|
|
Loading…
Reference in a new issue