Always update lastSendTimestamp after a request (#7122)
If the server is returning non-recoverable errors, such as if we are trying to push samples that are too old, remote write will never reshard. Non-recoverable errors should be treated the same as success for the purpose of resharding, just as we do with sample rates and durations. Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
This commit is contained in:
parent
59d01913b1
commit
5ab6b043c1
|
@ -845,6 +845,7 @@ func (s *shards) sendSamples(ctx context.Context, samples []prompb.TimeSeries, b
|
|||
// should be maintained irrespective of success or failure.
|
||||
s.qm.samplesOut.incr(int64(len(samples)))
|
||||
s.qm.samplesOutDuration.incr(int64(time.Since(begin)))
|
||||
atomic.StoreInt64(&s.qm.lastSendTimestamp, time.Now().Unix())
|
||||
}
|
||||
|
||||
// sendSamples to the remote storage with backoff for recoverable errors.
|
||||
|
@ -873,7 +874,6 @@ func (s *shards) sendSamplesWithBackoff(ctx context.Context, samples []prompb.Ti
|
|||
s.qm.succeededSamplesTotal.Add(float64(len(samples)))
|
||||
s.qm.bytesSent.Add(float64(len(req)))
|
||||
s.qm.highestSentTimestampMetric.Set(float64(highest / 1000))
|
||||
atomic.StoreInt64(&s.qm.lastSendTimestamp, time.Now().Unix())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue