-
Notifications
You must be signed in to change notification settings - Fork 8.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
[RAM][Maintenance Window] Maintenance window scoped query task manager changes #172252
[RAM][Maintenance Window] Maintenance window scoped query task manager changes #172252
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
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.
Did an initial code review and a bare bones verification and I think the approach makes sense overall given the constraints we have to work with. Left a few nits
x-pack/plugins/alerting/server/alerts_client/lib/get_summarized_alerts_query.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/server/task_runner/execution_handler.ts
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
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.
Code is looking good! Left a bunch of nits and then one comment about handling possible unhandled promise rejection.
To verify, I created a maintenance window that applied to stack rules with kibana.alert.name: "test"
. Then I created an ES query rule with name "test" and with some logging, see it generate a new alert and the appropriate maintenance window ID gets set for the new alert in memory. However, when I check the alert document, I see "kibana.alert.maintenance_window_ids": null,
, so it looks like the update by query is not working as expected?
}); | ||
}); | ||
|
||
describe('updateAlertsMaintenanceWindowIdByScopedQuery', () => { |
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.
can we add a test for behavior when ES throws an error on the update by query?
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 added a test to the inner function since we never await on updateAlertsMaintenanceWindowIdByScopedQuery
so it's a bit hard to test the reject case.
@elasticmachine merge upstream |
I had a small bug in the |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
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. Verified that MW with scoped query is correctly applied to new alerts that match the query and not applied to new alerts that don't match the query.
Summary
Resolves: #164255
This is part 3/3 of the maintenance window scoped query PR. This change contains only the task manager changes and has no dependency on other PRs. To test the changes in this PR, I recommend using this branch #172117 which has all of the frontend changes and the changes in this PR.
This PR adds support for maintenance window scoped query in the task manager. To do this, we need to perform a fetch on the new persisted alerts with the scoped query as filters. We then must save these alerts again with the update maintenance window IDs.
Checklist