-
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
[Security Solution] Support snoozing in rules table #153083
[Security Solution] Support snoozing in rules table #153083
Conversation
2a349de
to
d362caf
Compare
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
ce1474a
to
c7df0cd
Compare
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.
Hey @maximpn, thanks for working on this feature. I've done some local testing, and overall it looks fine, but there are a bunch of issues and bugs we need to fix.
Please review the issues below and let me know when they're fixed or if you'd like to chat about any of these. I'm going to review the diff later.
On page load, we do 2 calls to /internal/alerting/rules/_find
. The first one returns empty results, the second call returns results as expected. What is the reason for this and can we call the endpoint just once?
Why does /internal/alerting/rules/_find
return an array of actions
?
When you click the Refresh button in the table, we only call /api/detection_engine/rules/_find
(we refresh the rules) but not /internal/alerting/rules/_find
(we don't refresh the snooze info). We need to do both to make sure the data we show in the table is up-to-date.
Not sure I see consistency in making /internal/alerting/rules/_find
calls:
- After clicking Load Elastic prebuilt rules - YES
- After deleting 2 prebuilt rules and clicking Install 2 prebuilt rules - NO
- After selecting filters on the page - sometimes YES and sometimes NO
- After changing current page - sometimes YES and sometimes NO
- After changing page size - sometimes YES and sometimes NO
(YES mean we do call the /internal/alerting/rules/_find
endpoint, NO means we don't make this call)
Given a rule with no actions. It is snoozed automatically on our side. When you edit this rule and add an action, and return to the Rules table, it continues to be shown as snoozed, although it just got unsnoozed on the BE side. You need to refresh the page to refresh its snooze info.
Same vice versa. Given a rule with some actions and frequency. It is unsnoozed automatically on our side. When you edit this rule and reset its frequency to Perform no actions, and return to the Rules table, it continues to be shown as unsnoozed, although it just got snoozed on the BE side. You need to refresh the page to refresh its snooze info.
There's an issue with z-index when you click remove all schedules.
c931a62
to
4f60502
Compare
@banderror thank you for thorough testing 🙏 You managed to find some real problems related to cache invalidation and some problems are just side effects so let me break it down
It was caused by using two
Rule snooze settings refetching upon clicking refresh button was missing and it has been fixed.
It works as intended while cache invalidation after deleting 2 prebuilt rules and clicking Install 2 prebuilt rules was missed and it has been fixed. Default caching policy is applied to rules snooze settings data which 5 minutes and the same for the other data we fetch via React Query (besides rules as you can see here #153529). The other cases with
Cache invalidation upon rule actions saving was missing and it has been fixed.
The problem is caused by fixing z-index issues related to the timeline, literally by this line of code. I've been working on resolving this issue. It can take some time and can be optionally addressed in a separate PR to avoid inflating the diff here. UPDATE: There is a PR to address z-index issues which solves the current problem as well (see the screenshot below). I'll keep an eye on it. |
05a15a8
to
466fa71
Compare
@elasticmachine merge upstream |
…leSnoozeBadge component
efeaa9d
to
2c0b34b
Compare
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @maximpn |
Addresses: #147735
Summary
The PR adds an ability to set rule snoozing in the rules management table.
Screen recording:
Screen.Recording.2023-03-31.at.10.20.09.mov
Checklist