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

[Alert Summaries] [BE] Move “Notify When” and throttle from rule to action #144130

Merged
merged 33 commits into from
Nov 16, 2022

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Oct 27, 2022

Summary

Closes #143368

  • Deprecates notify_when and throttle
  • Makes notify_when and throttle optional
  • Adds optional frequency prop in actions including a boolean summary plus notify_when and throttle
  • On edit / create; Allows global or per action configurations only (no mix and match, no defaults)
  • Stores null in notify_when and throttle when per-action configs are used

This does NOT automatically migrate global notify_when to per-action frequency params. Until #143376 merges, global notify_when is still required to actually successfully send notifications.

Checklist

@Zacqary Zacqary added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesManagement Issues related to the Rules Management UX v8.6.0 labels Oct 27, 2022
@XavierM XavierM self-requested a review October 31, 2022 17:25
@Zacqary Zacqary marked this pull request as ready for review November 2, 2022 16:10
@Zacqary Zacqary requested review from a team as code owners November 2, 2022 16:10
@elasticmachine
Copy link
Contributor

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

@Zacqary Zacqary added the release_note:skip Skip the PR/issue when compiling release notes label Nov 2, 2022
Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Thank you for the fix @Zacqary. I posted a bunch of minor comments and nits.

I still have an open question/suggestion for the changes in security_solution/server/lib/detection_engine/rule_schema/model/rule_schemas.ts. Let's make a decision regarding this (I tend to revert the changes) and I'll approve the PR!

Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Security Solution changes LGTM 👍 Thanks for addressing the comments.

Copy link
Contributor

@ersin-erdal ersin-erdal left a comment

Choose a reason for hiding this comment

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

Asked a question above but i think it got lost in the collapsed comment :)
Other than that, LGTM.

…tion

# Conflicts:
#	x-pack/plugins/alerting/server/routes/create_rule.ts
#	x-pack/plugins/alerting/server/routes/lib/index.ts
#	x-pack/plugins/alerting/server/routes/update_rule.ts
#	x-pack/plugins/alerting/server/rules_client/rules_client.ts
@@ -0,0 +1,24 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like total copy of x-pack/plugins/alerting/server/lib/validate_rule_type_params.ts. With the same variables, types.
Maybe better to reuse it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah looks like I committed this file by mistake

@Zacqary
Copy link
Contributor Author

Zacqary commented Nov 16, 2022

@elasticmachine merge upstream

@Zacqary
Copy link
Contributor Author

Zacqary commented Nov 16, 2022

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
alerting 406 408 +2
triggersActionsUi 501 502 +1
total +3

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
alerting 39.2KB 39.2KB +57.0B
Unknown metric groups

API count

id before after diff
alerting 415 417 +2
triggersActionsUi 530 531 +1
total +3

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 441 447 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
securitySolution 518 524 +6
total +20

History

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

@Zacqary Zacqary merged commit 0c864fe into elastic:main Nov 16, 2022
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 16, 2022
…ction (elastic#144130)

* Add frequency props to actions and validate them on edit/create

* Nullify undefined throttle

* Update schema to allow for frequency param on actions

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Commit missing file

* Fix types

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fix types

* Fix jest

* Fix validating global freq params

* Add tests for create and edit

* Reset legacy api

* Make notify and throttle optional in route schemas

* Fix tests

* Split missing frequency test cases

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 0c864fe)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.6

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 16, 2022
…e to action (#144130) (#145469)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Alert Summaries] [BE] Move “Notify When” and throttle from rule to
action (#144130)](#144130)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Zacqary Adam
Xeper","email":"Zacqary@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-16T22:02:36Z","message":"[Alert
Summaries] [BE] Move “Notify When” and throttle from rule to action
(#144130)\n\n* Add frequency props to actions and validate them on
edit/create\r\n\r\n* Nullify undefined throttle\r\n\r\n* Update schema
to allow for frequency param on actions\r\n\r\n* [CI] Auto-commit
changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD
--fix'\r\n\r\n* Commit missing file\r\n\r\n* Fix types\r\n\r\n* [CI]
Auto-commit changed files from 'node scripts/eslint --no-cache
--fix'\r\n\r\n* Fix types\r\n\r\n* Fix jest\r\n\r\n* Fix validating
global freq params\r\n\r\n* Add tests for create and edit\r\n\r\n* Reset
legacy api\r\n\r\n* Make notify and throttle optional in route
schemas\r\n\r\n* Fix tests\r\n\r\n* Split missing frequency test
cases\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0c864fe479e332aa92bf189f0123661cd52262ae","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Feature:Alerting/RulesManagement","v8.6.0","v8.7.0"],"number":144130,"url":"https://github.com/elastic/kibana/pull/144130","mergeCommit":{"message":"[Alert
Summaries] [BE] Move “Notify When” and throttle from rule to action
(#144130)\n\n* Add frequency props to actions and validate them on
edit/create\r\n\r\n* Nullify undefined throttle\r\n\r\n* Update schema
to allow for frequency param on actions\r\n\r\n* [CI] Auto-commit
changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD
--fix'\r\n\r\n* Commit missing file\r\n\r\n* Fix types\r\n\r\n* [CI]
Auto-commit changed files from 'node scripts/eslint --no-cache
--fix'\r\n\r\n* Fix types\r\n\r\n* Fix jest\r\n\r\n* Fix validating
global freq params\r\n\r\n* Add tests for create and edit\r\n\r\n* Reset
legacy api\r\n\r\n* Make notify and throttle optional in route
schemas\r\n\r\n* Fix tests\r\n\r\n* Split missing frequency test
cases\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0c864fe479e332aa92bf189f0123661cd52262ae"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/144130","number":144130,"mergeCommit":{"message":"[Alert
Summaries] [BE] Move “Notify When” and throttle from rule to action
(#144130)\n\n* Add frequency props to actions and validate them on
edit/create\r\n\r\n* Nullify undefined throttle\r\n\r\n* Update schema
to allow for frequency param on actions\r\n\r\n* [CI] Auto-commit
changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD
--fix'\r\n\r\n* Commit missing file\r\n\r\n* Fix types\r\n\r\n* [CI]
Auto-commit changed files from 'node scripts/eslint --no-cache
--fix'\r\n\r\n* Fix types\r\n\r\n* Fix jest\r\n\r\n* Fix validating
global freq params\r\n\r\n* Add tests for create and edit\r\n\r\n* Reset
legacy api\r\n\r\n* Make notify and throttle optional in route
schemas\r\n\r\n* Fix tests\r\n\r\n* Split missing frequency test
cases\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0c864fe479e332aa92bf189f0123661cd52262ae"}}]}]
BACKPORT-->

Co-authored-by: Zacqary Adam Xeper <Zacqary@users.noreply.github.com>
benakansara pushed a commit to benakansara/kibana that referenced this pull request Nov 17, 2022
…ction (elastic#144130)

* Add frequency props to actions and validate them on edit/create

* Nullify undefined throttle

* Update schema to allow for frequency param on actions

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Commit missing file

* Fix types

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fix types

* Fix jest

* Fix validating global freq params

* Add tests for create and edit

* Reset legacy api

* Make notify and throttle optional in route schemas

* Fix tests

* Split missing frequency test cases

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@stefnestor
Copy link
Contributor

Cross-posting FYI @Zacqary, it looks like a cascade impact on Terraform was missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.6.0 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alert Summaries] [BE] Move “Notify When” and throttle from rule to action
9 participants