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

Ruler doesn't track internal errors vs user errors correctly #4333

Closed
pstibrany opened this issue Jul 1, 2021 · 0 comments · Fixed by #4335
Closed

Ruler doesn't track internal errors vs user errors correctly #4333

pstibrany opened this issue Jul 1, 2021 · 0 comments · Fixed by #4335

Comments

@pstibrany
Copy link
Contributor

pstibrany commented Jul 1, 2021

Recent PR #4281 has introduced new metrics for tracking errors from ruler. Idea was that these failure metrics will only be incremented for queries that would normally result in 500 errors.

However this doesn't quite work. There is a class of errors that querier would return 422 for, but ruler still treats as internal errors. Examples include a rule that ends with multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) errors, or a rule like label_replace(metric, "foo", "$1", "service", "[") with invalid regex "[".

Why do these return 422, but ruler doesn't recognize them as user-errors? Ruler uses querier.TranslateToPromqlAPIError to translate errors to PromQL errors. This function was designed to be used by querier, for returning errors from storage.Queryable implementation that match errors expected by Prometheus API library.

However in case of above mentioned class of errors, they don't "go" through the storage layer, but are generated by PromQL engine itself. As such, these errors are internal, but Prometheus API layer can translate them to proper status codes. Unfortunately Cortex ruler doesn't use Prometheus API library to run the queries, and cannot currently do type assertions on these internal Prometheus errors.

(By Prometheus API library/layer I mean github.com/prometheus/prometheus/web/api/v1 package that implements HTTP API in Prometheus.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant