Skip to content

Commit b525af5

Browse files
authored
queryrange: retry: do not retry if context is canceled (#4562)
* query-frontend: do not log error if context is canceled Example whenever the user cancels a query that is being executed: ``` {"caller":"retry.go:73","err":"context canceled","level":"error","msg":"error processing request","org_id":"anonymous","try":0,"ts":"2021-11-23T13:35:09.275914072Z"} ``` It doesn't mean anything bad so let's stop the spam. Signed-off-by: Giedrius Statkevičius <[email protected]>
1 parent 6bc9f14 commit b525af5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [CHANGE] Changed default for `-ingester.min-ready-duration` from 1 minute to 15 seconds. #4539
66
* [ENHANCEMENT] Query federation: improve performance in MergeQueryable by memoizing labels. #4502
77
* [ENHANCEMENT] Added new ring related config `-ingester.readiness-check-ring-health` when enabled the readiness probe will succeed only after all instances are ACTIVE and healthy in the ring, this is enabled by default. #4539
8+
* [CHANGE] query-frontend: Do not print anything in the logs of `query-frontend` if a in-progress query has been canceled (context canceled). #4562
89
* [ENHANCEMENT] Added new ring related config `-distributor.excluded-zones` when set this will exclude the comma-separated zones from the ring, default is "". #4539
910
* [ENHANCEMENT] Upgraded Docker base images to `alpine:3.14`. #4514
1011
* [ENHANCEMENT] Updated Prometheus to latest. Includes changes from prometheus#9239, adding 15 new functions. Multiple TSDB bugfixes prometheus#9438 & prometheus#9381. #4524

pkg/querier/queryrange/retry.go

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package queryrange
22

33
import (
44
"context"
5+
"errors"
56

67
"github.com/go-kit/log"
78
"github.com/go-kit/log/level"
@@ -66,6 +67,10 @@ func (r retry) Do(ctx context.Context, req Request) (Response, error) {
6667
return resp, nil
6768
}
6869

70+
if errors.Is(err, context.Canceled) {
71+
return nil, err
72+
}
73+
6974
// Retry if we get a HTTP 500 or a non-HTTP error.
7075
httpResp, ok := httpgrpc.HTTPResponseFromError(err)
7176
if !ok || httpResp.Code/100 == 5 {

0 commit comments

Comments
 (0)