Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queriers: Ignore context canceled #2440

Merged
merged 3 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
* [ENHANCEMENT] Add support for IPv6 [#1555](https://github.com/grafana/tempo/pull/1555) (@zalegrala)
* [ENHANCEMENT] Add span filtering to spanmetrics processor [#2274](https://github.com/grafana/tempo/pull/2274) (@zalegrala)
* [BUGFIX] tempodb integer divide by zero error [#2167](https://github.com/grafana/tempo/issues/2167) (@kroksys)
* [CHANGE] **Breaking Change** Rename s3.insecure_skip_verify [#???](https://github.com/grafana/tempo/pull/???) (@zalegrala)
* [CHANGE] **Breaking Change** Rename s3.insecure_skip_verify [#2407](https://github.com/grafana/tempo/pull/2407) (@zalegrala)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. 🐑

```yaml
storage:
trace:
s3:
insecure_skip_verify: true // renamed to tls_insecure_skip_verify

```
* [CHANGE] Ignore context canceled errors in the queriers [#2440](https://github.com/grafana/tempo/pull/2440) (@joe-elliott)

## v2.1.1 / 2023-04-28
* [BUGFIX] Fix issue where Tempo sometimes flips booleans from false->true at storage time. [#2400](https://github.com/grafana/tempo/issues/2400) (@joe-elliott)
Expand Down
23 changes: 16 additions & 7 deletions modules/querier/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package querier

import (
"context"
"errors"
"fmt"
"net/http"
"time"
Expand Down Expand Up @@ -60,7 +61,7 @@ func (q *Querier) TraceByIDHandler(w http.ResponseWriter, r *http.Request) {
QueryMode: queryMode,
}, timeStart, timeEnd)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}

Expand Down Expand Up @@ -121,7 +122,7 @@ func (q *Querier) SearchHandler(w http.ResponseWriter, r *http.Request) {

resp, err = q.SearchRecent(ctx, req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}
} else {
Expand All @@ -135,7 +136,7 @@ func (q *Querier) SearchHandler(w http.ResponseWriter, r *http.Request) {

resp, err = q.SearchBlock(ctx, req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}
}
Expand Down Expand Up @@ -165,7 +166,7 @@ func (q *Querier) SearchTagsHandler(w http.ResponseWriter, r *http.Request) {

resp, err := q.SearchTags(ctx, req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}

Expand Down Expand Up @@ -194,7 +195,7 @@ func (q *Querier) SearchTagsV2Handler(w http.ResponseWriter, r *http.Request) {

resp, err := q.SearchTagsV2(ctx, req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}

Expand Down Expand Up @@ -223,7 +224,7 @@ func (q *Querier) SearchTagValuesHandler(w http.ResponseWriter, r *http.Request)

resp, err := q.SearchTagValues(ctx, req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}

Expand Down Expand Up @@ -252,7 +253,7 @@ func (q *Querier) SearchTagValuesV2Handler(w http.ResponseWriter, r *http.Reques

resp, err := q.SearchTagValuesV2(ctx, req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
handleError(w, err)
return
}

Expand All @@ -264,3 +265,11 @@ func (q *Querier) SearchTagValuesV2Handler(w http.ResponseWriter, r *http.Reques
}
w.Header().Set(api.HeaderContentType, api.HeaderAcceptJSON)
}

func handleError(w http.ResponseWriter, err error) {
if errors.Is(err, context.Canceled) {
// ignore this error. we regularly cancel context once queries are complete
return
}
http.Error(w, err.Error(), http.StatusInternalServerError)
}