-
Notifications
You must be signed in to change notification settings - Fork 812
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
Translate errors to PromQL errors by wrapping queryable. #2941
Conversation
Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a CHANGELOG
entry, please? This should fix incorrect error status codes propagated back from the querier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick test injecting return httpgrpc.Errorf(http.StatusRequestEntityTooLarge, "mocked error")
in v2QueryStream()
and then I run ./development/tsdb-blocks-storage-s3/compose-up.sh
.
I've got a 500 response both when querying the querier and query-frontend. The response content is:
{"status":"error","errorType":"internal","error":"expanding series: rpc error: code = Code(413) desc = mocked error"}
All unknown errors are translated to promql.ErrStorage already at API level of the querier. Signed-off-by: Peter Štibraný <[email protected]>
Signed-off-by: Peter Štibraný <[email protected]>
Thanks Marco, I've fixed the problem -- it was caused by distributor_queryable.go wrapping all errors coming from ingester into I've removed This change of default is a potentionally breaking change for other places which didn't use I think user-errors reported by queryables should use some explicit errors and we will add them to |
Signed-off-by: Peter Štibraný <[email protected]>
"github.com/cortexproject/cortex/pkg/util" | ||
) | ||
|
||
func TestApiStatusCodes(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be worth adding a test for context.DeadlineExceeded
(we agreed to return 500).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did few manual tests and LGTM! Good job 👏
Signed-off-by: Peter Štibraný <[email protected]>
What this PR does: This is a refinement of PR #2571, which however only translated errors coming from the store, and ignored errors from ingesters. By registrering error-translation layer at API creation time, it will cover all possible error paths.
This PR also changes errors reported by various queryables to default to 500 instead of previous 422.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]