Call to validate_query in custom metrics form is not retried
(Summarize the bug encountered concisely)
The API call to validate a query entered in the Custom Metric form (Settings > Integrations > Prometheus > New Metric) is not retried if
202 Accepted is returned.
202 Accepted causes an error message to be displayed:
There was an error trying to validate your query
WORKAROUND: Delete one key in the query and type that key in again. This will call the validate_query API again.
Steps to reproduce
(How one can reproduce the issue - this is very important)
- Open an existing project or create a new one.
- Go to Settings > Integrations > Prometheus > New Metric.
- Keep the network tab in the developer console open.
- Enter a value in the Query text box.
- If the call to
202, the call is not retried.
You can force the controller to return
202 in order to be able to reliably reproduce this issue: https://gitlab.com/gitlab-org/gitlab-ee/blob/c8804c890ad213be6de9c3b285c30e02d228bb5d/ee/app/controllers/ee/projects/prometheus/metrics_controller.rb#L22
What is the current bug behavior?
GitLab is not validating queries consistently and sometimes shows an error for valid queries.
What is the expected correct behavior?
GitLab should validate queries consistently and only show errors if queries are invalid.
Relevant logs and/or screenshots