Resolves https://github.com/elastic/kibana/issues/162393
Adds a new feature flag
`xpack.observability.unsafe.alertDetails.observability.enabled` to
show/hide threshold alert details page until it is ready for GA.
Closes#158840
## Summary
This PR adds selecting a persisted data view and using it in the new
threshold rule.
|Flyout|Rule saved object|
|---|---|
||
## 🧪 How to test
- Create a threshold rule with a persisted data view
- Make sure the related feature flag is configured:
`xpack.observability.unsafe.thresholdRule.enabled: true`
- Check whether the triggered alert matches the expectation related to
that data view
- Check the rule saved object to ensure data is saved there correctly
## What is not covered in this PR
I will follow up on the following list in future PRs:
- [Temporary data view](https://github.com/elastic/kibana/issues/159774)
- [Initial loading](https://github.com/elastic/kibana/issues/159779)
- [Setting a timeField beside the
timestamp](https://github.com/elastic/kibana/issues/159777)
- [Error handling](https://github.com/elastic/kibana/issues/159776)
- [Testing](https://github.com/elastic/kibana/issues/159778)
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
### NOTE: This is a draft PR to MVP the new rule combination
(Threshold). More PRs to follow up
It fixes https://github.com/elastic/kibana/issues/158260 by providing
the _new_ **Threshold rule**
It fixes https://github.com/elastic/kibana/issues/159326
<img width="586" alt="Screenshot 2023-05-30 at 17 55 32"
src="0e485266-d93f-442e-81f4-77aa673ed497">
## ✅ Done
- [x] Clone the Metric threshold and update the imports
- [x] The rule is listed in the rule creation flyout with its params and
preview charts
- [x] Working Rule registry
- [x] Working Rule executor
- [x] Working feature id in the rule registry
- [x] Working alerts table and alert summary
- [x] Use DataView instead of the Metrics indices under settings
- [x] Update the i18n keys
- [x] Fix/Update failing checks/tests. Green CI ✅
- [x] Hide it behind a feature flag
`xpack.observability.unsafe.thresholdRule.enabled`
## 🏗️ To be done (could be irrelevant, or create a separate issue for
it):
- [ ] <del> Remove the `metrics` word </del>
- [ ] <del> Update file and variable names to match the new rule
context.</del>
- [ ] <del> Rearrange files, constants, and exports </del>
## 🎯 DoD
Having the rule working like the Metric threshold one and seeing its
related alerts.
---------
## Summary
This PR removes the
`xpack.observability.unsafe.alertDetails.apm.enabled` feature flag to
enable the Alert Detail page for the APM Latency Threshold Rule. I've
also removed the`alertDetailsAppSection` options along with the
`alertDetailsUrl` action context variable for the remaining APM rules
since the APM Alert Detail page should only be available for the APM
Latency Threshold rule.
I also changed`isAlertDetailsEnabledPerApp()` method to allow the
`apm.transaction_duration` rule type to work but not `apm.error_rate`,
`apm.transaction_error_rate`, or `apm.anomaly` rule types. This change
was necessary because the granularity of the feature flag was set to the
solution level and didn't allow to set the flag per rule type.
### Testing
To test this PR you will need to have some APM data in your cluster.
1. Create an APM Latency Threshold Rule with a low threshold so it will
trigger
2. Create an APM Error Count Rule with a low threshold so it will
trigger
3. Click on the "Action Menu" (the ellipses) in the alert (in the Alert
Table) for the latency threshold alert
4. Click on the "View alert details" menu item for the latency threshold
alert
5. Verify it takes you to the new "alert details" page for APM
6. Repeat steps 3 & 4 for the error count alert BUT it should open the
"alert flyout" instead.
---------
Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes#148297
## 📝 Summary
- Use theme and baseTheme from charts plugin
## 🧪 How to test
From the UI's perspective, nothing has changed, so the Alert Summary
Widget on the Alerts page and Rule details page should work as
previously.
- Make sure the dark and light theme for Alert Summary Widget works as
expected.
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/147972
# Summary
This PR makes sure the SLO link is also filtered from the global
navigation, depending on feature flag configuration being passed.
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Move alerts search bar to triggers action use package
* Fix useAlertDataView test
* Fix mocks for useAlertDataView test
* Fix type issue and add getAlertsSearchBar mock
* Refactor alerts search bar and remove refresh now
* Remove refreshNow from observability overview page
* Fix alert status query
* Remove relative time test
* Change AnyQuery type to Query
* Update the feature flags
* Fix tests and AlertFlyout footer
* Add unit test for the helper
* Update the order of the checks to fix tests
* Add test for edge cases
* Fix test direct access to the page
* Fix test
* Add the o11y context to the alert table config
* Fix checks
* Make the feature flag optional
* optional config for the check
* Made option only for alertDetails
* parameterize shareable rules list to adapt to o11y
* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'
* parameterize rule details link
* add Refresh button to triggers_actions_ui
* hide create rule button in o11y rules page
* removed unused stuff
* fix CI issues
* state container for last response column
* fix CI issues
* fix failing functional test on o11y rule details page
* make ruleListProps optional
* sync status filter with urlbar
* remove flaky test
* temp
* temp2
* fix o11y functional failing test - use clickByButtonText instead of clickByLinkText
* fix CI
* remove noData, noPermission prompt and refactor use_load_hooks to get filteredRuleTypes as a prop
* hide create rule button on empty screen in the o11y rules page
* fix CI issues
* remove not needed unit tests
* remove unused hook
* fix failing tests
* fix no permission prompt failing tests
* fix re-rendering issue when clicking on create rule button
* remove statecontainers for lastResponse column from triggers_actions_ui plugin
* refactor statusFilter using useEffect
* refactor executionStatusFilter using useEffect
* sunchronize urlbar with filters
* rename executionStatusesFilter to lastResponseFilter
* add more unit tests for rules_list
* more unit tests
* temporarily disable flaky tests
* remove unused stuff and move stuff to rule_details page
* rename ruleDetailsLink to ruleDetailsRoute
* fix o11y unit tests
* add more scenarios in the use_load_rules tests
* delete kibanaFeature remnant code that was added with type filtering before
It was introduced here 2dfc0b9d19
* more cleanup
* bring rule_details_page tests in their original state
* add missing types
* bring back empty lines
* more cleanup
* add more types
* unskip o11y tests
* apply feedback
* more unit tests
* remove filteredRuleTypes, we already have everything that we need
* refactor to only use rule type id to filter in triggers action ui
* add selection of visible columns + fix rule definition to not harcoded kibana feature privileges + fix unit test with new logic
* fix type + unit test
* fix bug around no data when default rules type are on
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Xavier Mouligneau <xavier.mouligneau@elastic.co>
* refactor alert flyout to just use hook
* fix unit test
* thanks to test, we find out discrepency between reconcilliation of components
* open rule details from o11y
* still lazy load alert configuration but on the start and not teh mount
* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'
* review I
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
* replace core and plugins with specific dependencies
* remove core and plugins from tests
* clean unused plugins variable
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>