Skip to content
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][7.x] Add migration that copies existing rule saved object ids to another location in the saved object #108075

Closed
chrisronline opened this issue Aug 10, 2021 · 5 comments · Fixed by #108196
Assignees
Labels
estimate:small Small Estimated Level of Effort Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) technical debt Improvement of the software architecture and operational architecture

Comments

@chrisronline
Copy link
Contributor

Relates to #100067

To prepare for the upcoming saved object ID migration, we need to copy over the existing ID to a new location in the saved object for every rule.

Once the migration happens in 8.0, there is no way to determine the legacy ID given the new, migrated ID. This is a problem for our code that searches against the event log as the event log will contain references to legacy IDs and we need to start searching across both IDs.

See the PoC PR for more insight into how this might work.

@chrisronline chrisronline added Feature:Alerting loe:small Small Level of Effort Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework labels Aug 10, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@mikecote
Copy link
Contributor

I've started a PR (#108196) which creates a 7.16.0 migration (to be merged in 7.16). This migration will set legacyId for existing rules but there is also the scenario where rules are created after migrating to 7.16 but before upgrading to 8.0. For this scenario, I'm thinking of enhancing the rule client's create fn to also set legacy ID when the kibanaVersion is < 8.0.0.

There is another question that comes to mind; what should we do with legacyId when exporting a rule? Should we wipe it out or keep it? If we keep it and import the rule in a different environment, the legacyId will not point to any valid document (or any event logs since the rule is new). If we lose it, we simply lose event log history (the purpose for legacyId).

@chrisronline
Copy link
Contributor Author

what should we do with legacyId when exporting a rule? Should we wipe it out or keep it?

Good point! During export, we won't really know if the legacyId will exist in the other environment, but there is a chance it could, if the user is doing regular exports, right? I wonder if we can always export it and just rely on the query not finding any results in the new environment as a "not great, but will work" scenario? Do we have to worry about potential conflicts though, where the legacyId exists in the other environment but it belongs to a different saved object?

@mikecote
Copy link
Contributor

Do we have to worry about potential conflicts though, where the legacyId exists in the other environment but it belongs to a different saved object?

I do think this can be a valid scenario (if using pre-defined IDs).

From a requirements perspective, I'm thinking it's not necessary to re-connect existing event log documents to a rule after importing it. Which makes me lean on the side of emptying out the legacyId on export. Thoughts?

@chrisronline
Copy link
Contributor Author

++ agreed. I don't know how common this will be and I don't think it will result in a poor UX even if it did happen.

@gmmorris gmmorris added the technical debt Improvement of the software architecture and operational architecture label Aug 13, 2021
@gmmorris gmmorris added the estimate:small Small Estimated Level of Effort label Aug 18, 2021
@gmmorris gmmorris removed the loe:medium Medium Level of Effort label Sep 2, 2021
@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimate:small Small Estimated Level of Effort Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants