Open js-jankisalvi opened 2 months ago
Pinging @elastic/response-ops (Team:ResponseOps)
From a comment in a previous attempted PR: https://github.com/elastic/kibana/pull/189041 ...
In order to make the double update (rule and task) more resilient, we determined that this should be the order of updates:
In one of the previous related PRs, I believe I noticed we did NOT have a test where we created a rule in a disabled state, and then did a bulk update of it. We should add a FT for this case, and anything similar/related. You can repro this today, manually, by importing a rule that has been exported - it will be disabled on import (with no backing task doc). You can then enable it via the rule list, which will use the bulk enable/disable functionality.
Assuming this PR gets merged, it may change the way we fix this problem: Add bulk update function that directly updates using the esClient #191760.
Since this allows a partial update, what I'm wondering is if we just blast the enabled
field in the task docs, as appropriate, without any OCC. Previously we were doing a full update (essentially). We were thinking we would need to OCC a bunch of the task doc updates, but not really sure that we do. We have conflict resolution in the task claimer, but I don't think there's really a need for it here, for the tasks anyway.
Related to: https://github.com/elastic/kibana/issues/181050
When enabling rules, the Alerting framework skips rules if their saved object has
alert.attributes.enabled: true
. This behavior creates issues described here and in the attached SDH.There might be a situation where a rule is marked as enabled, but no corresponding task exists in the Task Manager. In the UI, these rules will appear enabled but will never run. Users expect that all rules affected by the bulk enable action will get a corresponding task created in the Task Manager and be scheduled for execution. Therefore, it would be best to also check if the rules to be enabled have tasks in the Task Manager, instead of relying solely on the rule's current enabled state.