-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error querying Prometheus: bad_data: cannot parse "" to a valid timestamp #801
Comments
It's is actually recommended to use POST for the query and query-range endpoints because it avoids complications with length restrictions of the URL. (PromQL queries can become quite long.) Maybe Trickster or Thanos don't support POST requests for those endpoints? But even then, the HTTP client should transparently fallback to GET. Perhaps something doesn't work as intended with the fallback. My understanding is limited here. This was implemented back in #557 by @jacksontj . Or perhaps @lilic @bwplotka or @joe-elliott would have an idea? |
Also guessing that error is returned by Trickster based on the text, but it would be nice to confirm. |
Status-code is 400 |
OK, that explains it then. Thanks @joe-elliott for the catch. @kayrosik I recommend to file an issue with Trickster to either support POST (as it is recommended anyway) or return a 405 so that the client will properly retry. |
When discussing #801, I remembered #794. While dealing with the latter, I read the HTTP RFC, stumbling upon the following: When a request method is received that is unrecognized or not implemented by an origin server, the origin server SHOULD respond with the 501 (Not Implemented) status code. When a request method is received that is known by an origin server but not allowed for the target resource, the origin server SHOULD respond with the 405 (Method Not Allowed) status code. Concluding from that, it is possible that a server desiring a fallback to GET will send a status code of 501. It is even preferred if that server does not offer any resource to be used with the POST method. Therefore, I think we should fallback to GET on a 501, too. Signed-off-by: beorn7 <beorn@grafana.com>
When discussing prometheus#801, I remembered prometheus#794. While dealing with the latter, I read the HTTP RFC, stumbling upon the following: When a request method is received that is unrecognized or not implemented by an origin server, the origin server SHOULD respond with the 501 (Not Implemented) status code. When a request method is received that is known by an origin server but not allowed for the target resource, the origin server SHOULD respond with the 405 (Method Not Allowed) status code. Concluding from that, it is possible that a server desiring a fallback to GET will send a status code of 501. It is even preferred if that server does not offer any resource to be used with the POST method. Therefore, I think we should fallback to GET on a 501, too. Signed-off-by: beorn7 <beorn@grafana.com>
This is part of my function QueryRange:
I use trickster + prometheus(Thanos).
When I try to call the function, I get:
Error querying Prometheus: bad_data: cannot parse "" to a valid timestamp
And I can't understand why it can be (
I change DoGetFallback function (always HTTP-Get):
And it works! The problem is POST-request.
The text was updated successfully, but these errors were encountered: