-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ResponseOps] move alert UUID generation from rule registry to alerting framework #142874
Labels
Feature:Alerting/RulesFramework
Issues related to the Alerting Rules Framework
Team:ResponseOps
Label for the ResponseOps team (formerly the Cases and Alerting teams)
Comments
Pinging @elastic/response-ops (Team:ResponseOps) |
10 tasks
Merged
3 tasks
pmuellr
added a commit
to pmuellr/kibana
that referenced
this issue
Nov 9, 2022
…ng framework resolves elastic#142874
pmuellr
added a commit
that referenced
this issue
Apr 3, 2023
…erting framework (#143489) resolves #142874 The alerting framework now generates an alert UUID for every alert it creates. The UUID will be reused for alerts which continue to be active on subsequent runs, until the alert recovers. When the same alert (alert instance id) becomes active again, a new UUID will be generated. These UUIDs then identify a "span" of events for a single alert. The rule registry plugin was already adding these UUIDs to it's own alerts-as-data indices, and that code has now been changed to make use of the new UUID the alerting framework generates. - adds property in the rule task state `alertInstances[alertInstanceId].meta.uuid`; this is where the alert UUID is persisted across runs - adds a new `Alert` method getUuid(): string` that can be used by rule executors to obtain the UUID of the alert they just retrieved from the factory; the rule registry uses this to get the UUID generated by the alerting framework - for the event log, adds the property `kibana.alert.uuid` to `*-instance` event log events; this is the same field the rule registry writes into the alerts-as-data indices - various changes to tests to accommodate new UUID data / methods - migrates the UUID previous stored with lifecycle alerts in the alert state, via the rule registry *INTO* the new `meta.uuid` field in the existing alert state.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature:Alerting/RulesFramework
Issues related to the Alerting Rules Framework
Team:ResponseOps
Label for the ResponseOps team (formerly the Cases and Alerting teams)
Currently the Rule Registry generates a unique UUID for every alert, which will be reused when the same alert with the same id is active during the next execution. When the alert recovers, and becomes active again, with the same alert id, a new UUID will be generated.
This functionality needs to be moved into the alerting framework itself, so it can manage the UUIDs. Instead of the Rule Registry generating the UUID, we'll make it available via the alert functions from the alert factory.
This is a blocker to implement flapping alert detection in alerting, as per current design, alerts that are flapping will reuse the same UUID even after they recover. Only after the alert is no long flapping will the UUID stop being used. Because the alerting framework determines flapping state, and because the rule registry operates as a "wrapper" over the existing alert executors it's used with, the easiest way to deal with this is to have the alerting framework generate the UUID.
Additional advantage - assuming we write these UUIDs into the event log, we'll be able to "join" over this field in searches over the event log and AAD indices combined.
Another advantage is that we'll save some space. The rule registry currently "wraps" a rule's task state to maintain the alert id / uuid relationship. Below is an example of what the task state looks like for a rule with one alert.
The Rule Registry takes the task state returned by a rule, set's it to be the value of the
wrapped
property, and then addstrackedAlerts
which contains the id / uuid mapping. The other top-level properties are maintained by the alerting framework. And you can see thatalertInstances
contains everything intrackedAlerts
but the alert UUID. So, we should be able to remove thiswrapped
wrapping completely, once we add the alert UUID to ...state
?meta
? not sure where.That implies either a migration, or having code that can read both the old wrapped style or new unwrapped style (and presumably always write the new style). But we typically handle these with migrations.
The text was updated successfully, but these errors were encountered: