-
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
[Alerting] Expose SO _version
to clients
#74381
Comments
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
Note: alerting UIs should also take advantage of such implementation. |
During development of elastic#75553, some issues came up with the optimistic concurrency control (OCC) we were using internally within the alertsClient, via the `version` option/property of the saved object. The referenced PR updates new fields in the alert from the taskManager task after the alertType executor runs. In some alertsClient methods, OCC is used to update the alert which are requested via user requests. And so in some cases, version conflict errors were coming up when the alert was updated by task manager, in the middle of one of these methods. Note: the SIEM function test cases stress test this REALLY well. In this PR, we remove OCC from methods that were currently using it, namely `update()`, `updateApiKey()`, `enable()`, `disable()`, and the `[un]mute[All,Instance]()` methods. Of these methods, OCC is really only _practically_ needed by `update()`, but even for that we don't support OCC in the API, yet; see: issue elastic#74381 . For cases where we know only attributes not contributing to AAD are being updated, a new function is provided that does a partial update on just those attributes, making partial updates for those attributes a bit safer. That will be used by PR elastic#75553.
Relates to #50260 |
There was an indirect reference to this issue from a PR today - #77838 (comment) I happened to think we haven't even proposed what we might want to do here. Given some context on what the referenced PR is "fixing", here are some questions:
My take is that I think we just want OCC for the My rationale is that |
Moving from |
Moving from |
Worth discussing this issue further given this comment by @mikecote . It sounds like there's a concern that exposing the version will lead to bad UX because the rule could easily be updated in the background by the system (when executing it) and that will likely clash with user's updating other parts of the rule SO. TBH It feels like this is our internal implementation leaking, and I think it's worth taking a closer look at the impact of the underlying implementation (updating the status on the SO there by changing the version) and see if this approach makes sense longer term... but obviously changing this now is very costly. |
Currently, users of the
security_solution
plugin can run into a number of race conditions when multiple users attempt to update a rule at the same time. There's no way for us to circumvent these with OCC, as the_version
field is not exposed for the alerts via the Alerting Client.Here's one area where we could run into trouble:
kibana/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts
Line 101 in 52bbfff
The solution would be to expose the
_version
in theget
andfind
APIs, and allow that to be passed in when updating. Then we can handle409
conflict scenarios by refreshing and having the user try the rule update again.The text was updated successfully, but these errors were encountered: