-
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
[Monitoring] Enable out of the box alerts modal #101565
[Monitoring] Enable out of the box alerts modal #101565
Conversation
@elasticmachine merge upstream |
merge conflict between base and head |
@estermv One additional test case I would also suggest adding to the list it to make sure the flow is working correctly when monitoring is not enabled on the cluster and/or there is no monitoring data. The functionality differs on Cloud (ESS) and self-managed so we probably should try out on both. |
@ravikesarwani good point! Just added them and I'll also test them locally before opening the PR.
In which ways it differs? I'm not familiar with it. |
I haven't tried it out recently but recollect functionality around the following lines: |
@elasticmachine merge upstream |
Then this is for the messaging for when the user doesn't have monitoring enabled yet, it is not affected by the changes in this PR. |
@elasticmachine merge upstream |
Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui) |
|
||
export function enableAlertsModalProvider($http, $window, $injector) { | ||
function shouldShowAlertsModal(alerts) { | ||
const modalHasBeenShown = $window.sessionStorage.getItem('ALERTS_MODAL_HAS_BEEN_SHOWN'); |
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.
@estermv Is it on purpose that you use sessionStorage
here instead of localStorage
as you do later on for decisionMade?
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.
Yes, it's to easily manage the Remind me later
option. The modal will appear again to the user in the next page session. This gives a nice "remind me later" feeling on when to show the modal again. (We can always add a specific timer later if we see this don't work)
When the user selects Yes
or No
we don't want the modal to appear again, so I use the localStorage as "permanent" storage. (Of course, there are some edge cases, like the user cleaning the localStorage or using a different browser, but we left this out from the scope of this PR)
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! Good Job! Thank you for including the checklist for the test scenarios, it was very helpful.
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 looks good overall. I have a few UX observations / questions...
-
Once a user selects "Yes" from the modal and creates the rules they are then able to go to the "Alerts and rules" dropdown and "Create default rules". That makes it seem like the default rules were never created. Instead, could the language say "Re-create default rules"?
-
If a user click "Create default rules" from the "Alerts and rules" dropdown they don't receive any type of confirmation until there is a toast notification, which doesn't happen right away. Instead could the default rules modal pop up again and require them to select "Yes" so it's clear they have taken an action?
-
Can we add the "Manage rules" link that goes to
app/management/insightsAndAlerting/triggersActions/rules
to the "Alerts and rules" dropdown (same functionality the other Observability apps):
- Several toast notifications continue to pop up even if only one alert was created. Is that intended? For example, if I select "Yes" for the default rules to be created and then enter setup mode, only 1 alert shows even though I've received several toast notifications saying a new alert was created.
@katefarrar thanks a lot for your review!
Should it say always "Re-create default rules"? If the user answers "No" in the modal, do we want to show "Create ..."? If we want both and change it base on the user answer, it's more complicated, since the dropdown appears on every page, I'm not sure if we can know from all pages if the user has alerts created, we could create a separate issue to investigate this.
The modal is not prepared to be opened from the dropdown, if we want this it should be implemented as a separate issue.
It was not clear what should be in this dropdown (there was a bit of discussion in the original issue regarding this). If I remember correctly, the major problem with your suggestion was that users can't edit the stack monitoring alerts from there, they can only delete them. We have a meeting later to discuss the changes of this PR, I'll bring this there and add it in case we have an agreement.
Not sure what you mean by this. Toast notifications appear each time you select to create alerts and this is intended since it's similar as it worked before. With the auto-creation of alerts, the toast notification appeared each time the user visits the stack monitoring page although nothing was happening if the user already had alerts created. So, for the first version, we thought that we could keep it the same. |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* Remove api call to create alerts * Add enable alerts modal * Update modal title * Add simple alerts dropdown * change alerts modal design * refactor alerts modal provider * Add alerts dropdown * Show toast after alert creation and add error handling * Do not show alerts modal if alerts already exist * Fix stack monitoring test * Fix more stack monitoring tests and types * Fix tests after merge * Attempt to fix stack monitoring tests * remove console.log * Change text * Remove commented comment * Update docs for stack monitoring alerts * Fix docs Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
) * [Monitoring] Enable out of the box alerts modal (#101565) * Remove api call to create alerts * Add enable alerts modal * Update modal title * Add simple alerts dropdown * change alerts modal design * refactor alerts modal provider * Add alerts dropdown * Show toast after alert creation and add error handling * Do not show alerts modal if alerts already exist * Fix stack monitoring test * Fix more stack monitoring tests and types * Fix tests after merge * Attempt to fix stack monitoring tests * remove console.log * Change text * Remove commented comment * Update docs for stack monitoring alerts * Fix docs Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> * Removed strangely re-appearing test This test was removed a long time ago in this commit: 5feb376 -- we are not sure why it reappeared. Co-authored-by: Ester Martí Vilaseca <ester.martivilaseca@elastic.co> Co-authored-by: Jason Rhodes <jason.rhodes@elastic.co>
Summary
Closes #100133. This PR includes the following changes:
Test cases
When monitoring is disabled
When there is no monitoring data
When the user has existing rules
When the user doesn't have existing rules
When the user doesn't have existing rules and selects "Yes" on the rules modal
When the user doesn't have existing rules and selects "No" on the rules modal
When the user doesn't have existing rules and selects "Remind me later" or closes the modal with the
X
button:When the user selects "Create default rules" from the dropdown in the navigation bar
Technical notes
Alerts are created by the
api/monitoring/v1/alerts/enable
endpoint. The backend didn't change, so the behavior of creating alerts should be the same as before.There are a lot of test files modified. This is because the alerts modal appears on the cluster overview page that is the entry point of them and clicks happen on the modal overlay until it's closed. I tried to find a generic way to close it (or never open it), but I couldn't. I'll open a separate issue to look deeper into it.
Checklist
Delete any items that are not applicable to this PR.