mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary This PR is updating Discover's rule to be created under the `stackAlerts` consumer and we created an [breaking change issue](https://github.com/elastic/dev/issues/2344) to explain the consequences of this update. We also fix the rule's consumer for all rule types created under the observability rule management to use their producer instead of `alerts`. Also, we add the ability for the ES Query and new Generic Threshold rules type to pick the consumer associated to the rule. The `ensureAuthorized` and the `filter` functions have modified and simplified to support this use case please check the newest unit test added in `x-pack/plugins/alerting/server/authorization/alerting_authorization.test.ts`. There is now a dropdown in the rule form to prompt the user when creating ES Query/Generic threshold rules to select the consumer based on their authorized consumers (we can no longer use `alerts` for these). If there is only 1 option, then the dropdown will not be shown and the option will be chosen automatically. Generic threshold rules will have the following possible consumers: - infrastructure - logs ES query rules will have the following possible consumers: - infrastructure - logs - stackAlerts (only from the stack management rule page) ## To Test: ### Single Consumer: 1. Create a user with only `logs` feature enabled (ensuring `stackAlerts` is not enabled). 2. Navigate to the O11Y rule management page 3. Click the create rule button 4. Assert that both ES query and generic threshold rules are available 5. Click ES query and fill out the relevant information and create the rule 6. Assert that the rule created has `logs` set in the `consumer` field 7. Repeat 5-6 for the generic threshold rule 8. Repeat 2-7 but on the Stack Management rules page 9. Repeat 1-8 for the `infrastructure` feature. ### Multiple Consumers: 1. Create a user with `logs`, `infrastructure` and `apm` features enabled (ensuring `stackAlerts` is not enabled). 2. Navigate to the O11Y rule management page 3. Click the create rule button 4. Assert that both ES query and generic threshold rules are available 5. Click ES query and fill out the relevant information and create the rule 6. A dropdown should prompt the user to select between 1 of the 3 consumers, select 1 7. Assert that the rule was created with the selected consumer 8. Repeat 5-7 for the generic threshold rule 9. Repeat 2-8 but on the Stack Management rules page ![Screenshot from 2023-08-08 16-45-43]( |
||
---|---|---|
.. | ||
services | ||
test_suites | ||
config.base.ts | ||
ftr_provider_context.d.ts |