mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Don't update metrics on context cancellation
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
This commit is contained in:
parent
1af81dc5c9
commit
6696b7a5f0
|
@ -15,6 +15,7 @@ package remote
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"math"
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -1311,6 +1312,11 @@ func (s *shards) sendSamplesWithBackoff(ctx context.Context, samples []prompb.Ti
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sendWriteRequestWithBackoff(ctx, s.qm.cfg, s.qm.logger, attemptStore, onRetry)
|
err = sendWriteRequestWithBackoff(ctx, s.qm.cfg, s.qm.logger, attemptStore, onRetry)
|
||||||
|
if errors.Is(err, context.Canceled) {
|
||||||
|
// When there is resharding, we cancel the context for this queue, which means the data is not sent.
|
||||||
|
// So we exit early to not update the metrics.
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
s.qm.metrics.sentBytesTotal.Add(float64(reqSize))
|
s.qm.metrics.sentBytesTotal.Add(float64(reqSize))
|
||||||
s.qm.metrics.highestSentTimestamp.Set(float64(highest / 1000))
|
s.qm.metrics.highestSentTimestamp.Set(float64(highest / 1000))
|
||||||
|
|
Loading…
Reference in a new issue