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

[Discover] Refactor on_save_search to improve error handling #139511

Open
davismcphee opened this issue Aug 25, 2022 · 1 comment
Open

[Discover] Refactor on_save_search to improve error handling #139511

davismcphee opened this issue Aug 25, 2022 · 1 comment
Labels
chore Feature:Discover Discover Application impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort refactoring Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.

Comments

@davismcphee
Copy link
Contributor

Currently the approach on_save_search uses includes modifying the search object in place, attempting to save, and rolling back the modified properties on failure.

This approach is brittle since it's easy to forget to roll back the properties on failure. Instead we should clone the object before changing the properties, attempt the save, and only update the original search on success.

extracting values of the given savedSearch, mutating the object, continue to mutate it further when preparing to save, and if it fails, we unset values ... we should better provide a saved search for saving, and if it's successful we continue operations to modify / change our saved search, rather than undoing changes

Originally posted by @kertal in #136162 (comment)

@botelastic botelastic bot added the needs-team Issues missing a team label label Aug 25, 2022
@davismcphee davismcphee added Feature:Discover Discover Application refactoring Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. and removed needs-team Issues missing a team label labels Aug 25, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@timductive timductive added chore loe:small Small Level of Effort impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. labels Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:Discover Discover Application impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort refactoring Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
Projects
None yet
Development

No branches or pull requests

3 participants