-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Support wait_for_status and timeout query params on root endpoint #18377
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
base: main
Are you sure you want to change the base?
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
|
This pull request does not have a backport label. Could you fix it @estolfo? 🙏
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, the origial requirement is to have a non-200 status code if the status is not met.
|
|
71ecbbd to
aec5543
Compare
|
Note: I tested with Elasticsearch and found that some assumptions about its behavior were incorrect:
|
|
Update: changed behavior to require a valid timeout with a valid status. This differs from Elasticsearch's behavior; Elasticsearch will wait until the network request timeout for the status if no timeout query param is provided. |
Co-authored-by: Rye Biesemeyer <[email protected]>
Co-authored-by: Rye Biesemeyer <[email protected]>
💚 Build Succeeded
History
|
robbavey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I have a left a couple of nits/questions in the openapi spec, but I don't think they warrant another review round if you agree/disagree.
A rebase should resolve the build failure
| required: false | ||
| schema: | ||
| type: string | ||
| description: Period to wait for the status to reach the requested target status. If the target status is not reached before the timeout expires, the request returns status code 503. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Nit)
I know the original ES docs don't have it, but specifying the unit here might be a useful clarification
| id: "58df6f7c-eb5c-5d42-bc20-c7b22779aa12" | ||
| name: "" | ||
| ephermeral_id: "59df6f6c-eb5c-4d42-bc20-c7b44779aa12" | ||
| snapshot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still need to be done?
This PR adds support for two query params on the root api:
wait_for_statusandtimeout.They mirror what the same query params do on the elasticsearch cluster health status endpoint.
wait_for_status: One of green, yellow or red.timeoutis required along with a status. Will wait (until the timeout provided) until the status of the service changes to the one provided or better, i.e. green > yellow > red.timeout: Period to wait for the status to reach the requested target status. If the target status is not reached before the timeout expires, the request returns http status 408.The status of the service will be checked with an exponential backoff until the timeout is reached.
Short description of the behavior:
green,yellow,red] - return error response and http status 400Open Questions/ToDo:
Right now, the implementation doesn't wait for a status that is "better, i.e. green > yellow > red", as the Elasticsearch implementation does. Do we want to adjust our implementation to also have this behavior or is that overkill?The implementation will do the same as Elasticsearch-- it will wait for a status that matches the target or "better".If the timeout is expired on the Elasticsearch cluster health endpoint before the target status is reached (or a better one), the request fails and returns an error. This implementation currently just returns as normal. Do we want to have the same behavior as Elasticsearch?The request will return 503 if the request times out and the target status is not reached, as does ElasticsearchWhat examples should be used for "host" and "name" in the openapi documentation? The guidelines suggestUpdate: usedapi.example.combut that doesn't seem to fit the example of calling logstash's root api.logstash-pipelines,logstash-pipelines.example.comConfirm that the status code 503 should be used when the request times out. Define message based on what elasticsearch returns.Update: testing showed that status code 408 is returned when the request times out.Resolves #17457