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

Rule: add ability to send POST requests #2577

Closed
GiedriusS opened this issue May 8, 2020 · 13 comments · Fixed by #3378
Closed

Rule: add ability to send POST requests #2577

GiedriusS opened this issue May 8, 2020 · 13 comments · Fixed by #3378

Comments

@GiedriusS
Copy link
Member

Feature request description

Thanos Rule currently sends everything with GET requests. We should add an option to send the requests as POST. Accordingly, the logs should be improved to also log the POST (form) parameters.

Rationale

The alerting / recording rules' expressions might be very long and not fit into the URI.

@yashrsharma44
Copy link
Contributor

If no one is taking this issue, I am having a try 😄

@yashrsharma44
Copy link
Contributor

Hey @GiedriusS !
I was trying to wrap my head around the use case of this feature, so can you elaborate on what are the requirements and acceptance criteria for this issue?

Also can you elaborate more on this?

The alerting / recording rules' expressions might be very long and not fit into the URI.

@GiedriusS
Copy link
Member Author

Hey @GiedriusS !
I was trying to wrap my head around the use case of this feature, so can you elaborate on what are the requirements and acceptance criteria for this issue?

Also can you elaborate more on this?

The alerting / recording rules' expressions might be very long and not fit into the URI.

There's no need for formal acceptance criteria - it's not work for us. At least for the majority of us.

Different implementations of HTTP browsers/servers have different limits on URL lengths. For example: https://technomanor.wordpress.com/2012/04/03/maximum-url-size/. How it stands right now, Thanos Rule encode everything into the URL when sending a request:

req, err := http.NewRequest("GET", u.String(), nil)

The recording or alerting rule might be too long and then it will get truncated when sending a request. That's why support for encoding request parameters via POST on /api/v1/query (and others) has been added. So:

  • A new parameter needs to appear that controls whether GET or POST is used. We could theoretically convert everyone to use GET but very old versions do not support POST;
  • The documentation needs to have verbiage about this;
  • The tests need to be improved to test out this case.

@stale
Copy link

stale bot commented Jun 10, 2020

Hello 👋 Looks like there was no activity on this issue for last 30 days.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity for next week, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Jun 10, 2020
@GiedriusS
Copy link
Member Author

Still very valid & help welcome!

@stale stale bot removed the stale label Jun 11, 2020
@jlr52
Copy link

jlr52 commented Jun 13, 2020

@GiedriusS

Hi I would love to contribute on this.

Does the ask only apply to promclient.go or does it apply to all queries in the repo that have post supported in https://github.com/thanos-io/thanos/blob/0aa297bd00816ed5efe5d6dea117cb7059a3d7b1/pkg/query/api/v1.go like the following

	r.Get("/query", instr("query", api.query))
	r.Post("/query", instr("query", api.query))
	r.Get("/query_range", instr("query_range", api.queryRange))
	r.Post("/query_range", instr("query_range", api.queryRange))
	r.Get("/series", instr("series", api.series))
	r.Post("/series", instr("series", api.series))
	r.Get("/labels", instr("label_names", api.labelNames))
	r.Post("/labels", instr("label_names", api.labelNames))

@bwplotka
Copy link
Member

bwplotka commented Jun 15, 2020 via email

@stale
Copy link

stale bot commented Jul 15, 2020

Hello 👋 Looks like there was no activity on this issue for last 30 days.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity for next week, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Jul 15, 2020
@GiedriusS
Copy link
Member Author

We plan on using Thanos Ruler more at $WORK so we might just implement this not too long from now if no one else wants to take a stab at this.

@stale stale bot removed the stale label Jul 15, 2020
@stale
Copy link

stale bot commented Aug 14, 2020

Hello 👋 Looks like there was no activity on this issue for last 30 days.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity for next week, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Aug 14, 2020
@GiedriusS
Copy link
Member Author

Still valid.

@stale stale bot removed the stale label Aug 14, 2020
@stale
Copy link

stale bot commented Sep 13, 2020

Hello 👋 Looks like there was no activity on this issue for last 30 days.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity for next week, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Sep 13, 2020
@GiedriusS GiedriusS removed the stale label Sep 14, 2020
@mritunjaysharma394
Copy link
Contributor

Hello everyone! If this issue is free to take, I would love to learn and work on this issue 😄

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

Successfully merging a pull request may close this issue.

5 participants