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

Support post requests in the frontend queryrange handler. #2023

Merged
merged 2 commits into from
May 1, 2020

Conversation

cyriltovena
Copy link
Contributor

Signed-off-by: Cyril Tovena [email protected]

I also took the opportunity to refactor a bit the code so that it's easier to write test and check which roundtripper is called based on a query.

I think ultimately we need to move r.ParseForm in the loghttp.Parse.... functions, because it's in multiple places:

  • querier middleware
  • frontend codec
  • frontend rountripper.

Fixes #2020

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

I'd also like to have ParseForm done in one place (loghttp sounds good).

params.Set("query", expr.String())
req.URL.RawQuery = params.Encode()
// force the form and query to be parsed again.
req.Form = nil
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit scared of setting this to nil here. I'm afraid it exposes us to issues extending this in the future -- it's easy to think the form would be parsed already. That being said, I think we should merge this. It's just something we should think about improving.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I don't have a solution yet for that. The problem is that ParseForm does nothing if it's already populated and we need to update the querystring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you remove this a test will fail.

@cyriltovena cyriltovena merged commit 4fd670d into grafana:master May 1, 2020
gouthamve pushed a commit that referenced this pull request May 4, 2020
@JnMik
Copy link

JnMik commented May 7, 2020

Very nice so we will be able to do Loki alerting with this in 6.7.4 right ?
with prometheus-loki datasource
thanks mate !

@cyriltovena
Copy link
Contributor Author

Yes not sure when grafana change to post but this fixes alerts issue.

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

Successfully merging this pull request may close these issues.

Loki Grafana Alerts are not working via Prometheus datasource
3 participants