-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix delayed status API updates in alerting and task_manager #101778
Conversation
4f67d14
to
07e00a7
Compare
// Wait for status to become green | ||
let status; | ||
const start = Date.now(); | ||
do { | ||
const resp = await supertest.get('/api/status'); | ||
status = resp.status; | ||
// Stop polling once status stabilizes OR once 40s has passed | ||
} while (status !== 200 && Date.now() - start < 40_000); | ||
|
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.
This kind of logic is going to be more and more necessary in some tests. We should either:
- Create a centralized helper service for this like
kibana.waitForAvailable()
; OR - Change how
@kbn/test
waits for Kibana to start. Currently it waits for a log message that the the server is ready. We could either add logic for polling the API or add a log message for when Kibana actually turns to available ("green") for the first time.
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.
We could either add logic for polling the API or add a log message for when Kibana actually turns to available ("green") for the first time.
IIRC @pgayvallet has encountered this problem before. do you remember if there were any problems with switching to this logic?
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.
We could either add logic for polling the API or add a log message for when Kibana actually turns to available ("green") for the first time
This is what I tried in #92568. Got reverted because it added a very significant time to the FTR CI tests. But maybe now that this PR fixes these delays, it would be better?
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.
I'll explore this as a follow up and see how much it increases test time. I want to keep this PR clean enough to backport to 7.13.3
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.
Opened a new PR for this along with an additional 5s improvement on the initial available
: #102108
Pinging @elastic/kibana-core (Team:Core) |
b2f624b
to
aeb03ad
Compare
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
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! Thanks for fixing!
…#102083) Co-authored-by: Josh Dover <[email protected]>
…#102084) Co-authored-by: Josh Dover <[email protected]>
Summary
Minimal fix for #101049 (for safe backporting)
Holistic fix will be added by finishing #77965
The Alerting plugin's status Observable had two issues:
setup
lifecycleThis PR fixes the alerting and task_manager status Observables to be registered during setup and ensures that there is an initial status emitted (
unavailable
) while also making sure the first health check isn't delayed by 5 minutes.Release note
An issue was resolved where Kibana's status API was reporting as
503 Service Unavailable
due to a slow status check in Kibana Alerting.Checklist
Delete any items that are not applicable to this PR.
For maintainers