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:
Chris Marchbanks 2020-04-15 09:03:28 -06:00 committed by GitHub
parent 59d01913b1
commit 5ab6b043c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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