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.
## 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>
* 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
* 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>
* 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>
* testing find rules api & load observability rules
* add rules option in observability sidebar
* make rules menu option configurable
* create o11y rules page
* update manage rules link
* rules page
* filter o11y rule types only(temp solution)
* remove unused stuff
* Add documentation link
* fix typescript errors
* add selection to EuiBasicTable
* add rest columns in the table
* toggle popover
* add actions column
* temp
* add breadcrumbs to rules page
* add pagination to rules page
* add onChange handler in rules pagination
* add create rule button
* add icon type to the create rule button
* Show number of rules
* add auto refresh button
* use correct rule management link in apm based on feature flag
* use correct rule management link in infra and observability alerts page based on on feature flag
* centralize useRulesLink logic inside the new useRulesLinkCreator observability hook
* useRulesLink in uptime
* useRulesLink in apm
* mock observability useLinks function in uptime tests
* temporarily remove the create rule button
* remove unused console statement
* remove unused button
* fix uptime failing tests
* remove useContextForPlugin and rename hook to create_use_rules_link
* remove useKibanaForContext from uptime and use useKibana instead
* remove unused imports
* add a todo comment in the loadRules export
* use await import for createUseRulesLink and declare core and setup as async
* fix typescript error
* Revert "fix typescript error"
This reverts commit c5a67d5d56.
* Revert "use await import for createUseRulesLink and declare core and setup as async"
This reverts commit 627a6265cf.
* experiment with page bundle size
* fix for useEffect
* use async import for loadRules
* experiments
* Revert "experiments"
This reverts commit 8b389dbf6a.
* increase page bundle size limit
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Add feature flag to display a blank overview page when enabled
* Add tests for overview page feature flag
* Fix types
* Fix more types
* Remove duplicated BucketSize type
* fix linter
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* chore(NA): auto creation of the package.json for the new types pkg rule
* chore(NA): first alpha api extractor working version
* chore(NA): support kbn-analytics
* chore(NA): correctly read tsconfig files and deps from ts_config rule
* chore(NA): layed out pkg_npm_types tree artifact custom rule
* chore(NA): missing todos
* chore(NA): node modules link mapping
* chore(NA): fully working pkg_npm_types rule
* chore(NA): fix changes on new packages using elastic datemath pkgs
* docs(NA): remove todo
* docs(NA): last todo text correction
* chore(NA): removed commented lines
* fix(NA): include missing package version
* chore(NA): include license keys
* chore(NA): change mock types package into private
* chore(NA): disable validator on ts_project rule
* chore(NA): use the wrapper for ts_project
* commit using @elastic.co
* chore(NA): commit using @elastic.co
* chore(NA): split types from code on @kbn/i18n
* chore(NA): update yarn.lock file
* chore(NA): split @kbn/i18n and @kbn/i18n-react
* chore(NA): missing import fix
* chore(NA): fix jest project configs
* chore(NA): change imports on kbn i18n
* chore(NA): change imports on kbn i18n
* chore(NA): correct loader imports
* chore(NA): missnig i18nLoader export key
* chore(NA): fix type exports
* chore(NA): export type only
* chore(NA): export type only
* fix(NA): type exports
* chore(NA): missing @Kbn/i18n/react imports
* chore(NA): missing skip path for kbn-i18n-react
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Make it so `xpack.observability.unsafe.alertingExperience.enabled` only shows and hides the Alerts page, and `xpack.observability.unsafe.cases.enabled` show and hides the Cases page.
* Remove alerting feature flag from advanced settings
Make it so the alerting UI in Observability can only be turned on and off in kibana.yml with `xpack.observability.enableAlertingExperience`.
We no longer:
* Allow turning this on and off for the current space in the advanced settings in Kibana
* Allow turning this on on cloud
* Send telemetry on whether or not the flag is enabled
Add some docs in READMEs as well.
* Set up Observability rule APIs
* Populate alerts table with data from API
* Move field map types/utils to common
* Format reason/link in alert type
* Format reason/link in alert type
* Fix issues with tsconfigs
* Storybook cleanup for example alerts
* Use `MemoryRouter` in the stories and `useHistory` in the component to get the history
* Replace examples with ones from "real" data
* Use `() => {}` instead of `jest.fn()` in mock registry data
* Store/display evaluations, add active/recovered badge
* Some more story fixes
* Decode rule data with type from owning registry
* Use transaction type/environment in link to app
* Fix type issues
* Fix API tests
* Undo changes in task_runner.ts
* Remove Mutable<> wrappers for field map
* Remove logger.debug calls in alerting es client
* Add API test for recovery of alerts
* Revert changes to src/core/server/http/router
* Use type imports where possible
* Update limits
* Set limit to 100kb
Co-authored-by: Nathan L Smith <smith@nlsmith.com>
* using kibana persisted date when available to set the date time
* fixing types
* adding setTime when changin the dates in the url
* renaming
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* creating overview page and menu
* styling the home page
* adjusting breadcrumb
* renaming isnt working
* renaming isnt working
* renaming isnt working
* fixing import
* fixing scroll when resize window
* fixing eslint errors
* prepending links
* adding target option
* refactoring
* adding dark mode support
* fixing prettier format
* fixing i18n
* reverting some unnecessary changes
* addressing PR comments
* fixing functional tests
* ordering observability menu
* fixing tests
* addressing PR comments
* fixing scroll
* addressing pr comments
* addressing pr comments
* creating overview page
* mocking data
* mocking data
* refactoring
* crearting apm chart
* adding overview page
* adding metric charts
* adding charts
* changing mock data location
* adding mock registry
* adding date picker
* adding route validation
* adding io-ts
* adding io-ts
* adding io-ts support
* fixing imports and mock data
* adding app folder
* creating a section for each plugin
* adding stats
* adding domain min max
* refactoring xcoordinaters
* fixing route
* adding bucket size
* adding group property on logs
* adding home page
* dont break page if location state is undefined
* each component fetches its own data
* Refactoring
* adding loading indicator to chart
* fixing uptime chart
* adding brush functionality to charts
* fixing refresh button and auto refresh function
* adding horizontal line to accordion section
* adding emptySection to dashboard page
* adding add data button
* adding resources section
* removing margins from horizontal rule
* changing min interval to 60s
* fixing empty section
* removing unnecessary code
* adding unit tests
* fixing imports
* adding initial story book for observability
* removeing uptime mock data
* fixing xDomain to show correct data on x-axis
* fixing empty state alignment
* adding story book and other improvements
* adding news component
* adding support to custom colors on EuiProgress and EuiStats
* removing infra mock data
* adding error message when api throwns an error
* adding alert section
* Adding alerts
* adding alert api call
* addressing PR comments
* adding storybook
* adding feedback button
* addressing PR comments
* chamging plugins return data
* fixing kibana app navigation
* fixing unit test
* fixing ts issues
* addressing PR comments
* using lodash truncate
* adding comment
* updating public documentation
* fixing alerts request
* fixing unit test
* fixing unit test
* aligin beta badge to the center
* adding moment duration to get the units as seconds
* addressing PR comments
* addressing PR comments