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

[RAM] Add error for action interval shorter than check interval #148919

Merged
merged 9 commits into from
Jan 24, 2023

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Jan 13, 2023

Summary

Closes #148569

Adds form error and API error for action intervals shorter than rule check intervals

Screen Shot 2023-01-13 at 1 46 55 PM

Screen Shot 2023-01-13 at 1 46 42 PM

Checklist

Delete any items that are not applicable to this PR.

@Zacqary Zacqary added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesManagement Issues related to the Rules Management UX v8.7.0 labels Jan 13, 2023
@Zacqary
Copy link
Contributor Author

Zacqary commented Jan 17, 2023

@elasticmachine merge upstream

@Zacqary Zacqary marked this pull request as ready for review January 18, 2023 17:42
@Zacqary Zacqary requested a review from a team as a code owner January 18, 2023 17:42
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@XavierM
Copy link
Contributor

XavierM commented Jan 20, 2023

@Zacqary are you sure that's the right ticket #148659?

@XavierM

This comment was marked as resolved.

@XavierM

This comment was marked as resolved.

action.frequency?.notifyWhen === RuleNotifyWhen.THROTTLE &&
parseDuration(action.frequency.throttle!) < scheduleInterval
);
if (actionsWithInvalidThrottles.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Should we fail all the actions if one failed this validation? or should we allow the persistence of the other actions? what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateActions is used to validate API requests. It would be more confusing for the user if their update or create request only applied 2 out of 3 of the actions they wanted it to, as opposed to just throwing an error and asking them to send the whole request again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok make sense but can we validate all the actions at once so we can return a fully detailed msg with the ruleId and ruleName, so they do not have to call it each time to figure out what's wrong in one step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a larger change that modifies part of validateActions out of scope for #148569. Can you create a new issue with a full spec for what you'd like error messages to look like and I can tackle that in another PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will!

@Zacqary
Copy link
Contributor Author

Zacqary commented Jan 23, 2023

@XavierM We don't currently have API integration tests for any other inner workings of Rules Client methods. These changes are covered in the additions to create.test.ts. The alerting_api_integration suite only tests if the API receives and responds to requests, and I don't think we should start asking it to duplicate the functionality of the Rules Client jest tests and give us redundant tests to maintain.

@Zacqary
Copy link
Contributor Author

Zacqary commented Jan 23, 2023

@XavierM: I think the error msg should be gone in this case, I am having a hard time to reproduce it now.

Fixed in e76abc8

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 707.7KB 709.0KB +1.4KB
Unknown metric groups

ESLint disabled line counts

id before after diff
triggersActionsUi 116 115 -1

Total ESLint disabled count

id before after diff
triggersActionsUi 119 118 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@XavierM XavierM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, #149415 for a follow up PR

@Zacqary Zacqary merged commit d60d537 into elastic:main Jan 24, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RAM] Add warning/error handling for alert throttles shorter than rule check interval
5 participants