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] Adding a configurable minimal rule interval for newly created rules #125396

Merged
merged 32 commits into from
Feb 28, 2022

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Feb 11, 2022

Resolves #124810

Summary

  • Removed minimumScheduleInterval from rule type registration since it was not used by any rule type
  • Added minimumScheduleInterval to kibana.yml config
  • Updated server side validation to use configured value instead of rule type value
  • Updated client side validation to use configured value instead of rule type value
    • Added new route for getting this config inside triggers_actions_ui plugin

To verify:

  • Verify that rules created before this PR with an interval less than the minimum continue running
  • Verify that when updating existing rules with too-short intervals, the minimum is enforced.
  • Verify that you cannot create a rule via the UI or API with a schedule less than the minimum.

Breaking Change

We previously did not enforce any minimum schedule interval for rules. Adding this minimum may be a breaking change for users using automated methods to create or update their rules. If users are impacted by this change in behavior, they have the option of configuring xpack.alerting.minimumScheduleInterval to be a smaller value or increasing the interval of their alerting rules.

Checklist

Specifies whether to skip writing alerts and scheduling actions if rule execution is cancelled due to timeout. Default: `true`. This setting can be overridden by individual rule types.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will make a separate PR to add this to the cloud allowlist.

@@ -139,7 +138,7 @@ export interface AlertingPluginsStart {
}

export class AlertingPlugin {
private readonly config: Promise<AlertsConfig>;
private readonly config: AlertingConfig;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why this was a Promise, but I am able to get the config synchronously so I updated the code. If there's a reason it has to be a Promise, am happy to revert these changes.

@ymao1 ymao1 changed the title Removing minimumScheduleInterval on rule type registration [Alerting] Adding a configurable minimal rule interval for newly created rules Feb 14, 2022
@@ -161,6 +161,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
'--xpack.encryptedSavedObjects.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"',
'--xpack.alerting.invalidateApiKeysTask.interval="15s"',
'--xpack.alerting.healthCheck.interval="1s"',
'--xpack.alerting.minimumScheduleInterval="1s"',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting minimum very short on functional tests.

@ymao1 ymao1 self-assigned this Feb 14, 2022
@ymao1 ymao1 added backport:skip This commit does not require backporting Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework 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.2.0 labels Feb 14, 2022
@ymao1 ymao1 marked this pull request as ready for review February 14, 2022 18:16
@ymao1 ymao1 requested a review from a team as a code owner February 14, 2022 18:16
@elasticmachine
Copy link
Contributor

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

@ymao1 ymao1 added release_note:breaking and removed release_note:skip Skip the PR/issue when compiling release notes labels Feb 14, 2022
@ymao1 ymao1 requested a review from a team as a code owner February 14, 2022 20:50
@ymao1
Copy link
Contributor Author

ymao1 commented Feb 24, 2022

Cloud allowlist PR: https://github.com/elastic/cloud/pull/98054

@ymao1
Copy link
Contributor Author

ymao1 commented Feb 24, 2022

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Feb 24, 2022

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Feb 25, 2022

Followup issue for enabling/disabling: #126409

@ymao1
Copy link
Contributor Author

ymao1 commented Feb 28, 2022

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Feb 28, 2022

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
triggersActionsUi 322 325 +3

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 291 292 +1
triggersActionsUi 234 235 +1
total +2

Async chunks

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

id before after diff
triggersActionsUi 677.8KB 678.8KB +1.0KB

Page load bundle

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

id before after diff
alerting 37.9KB 38.1KB +104.0B
Unknown metric groups

API count

id before after diff
alerting 299 300 +1
triggersActionsUi 246 247 +1
total +2

History

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

cc @ymao1

@ymao1 ymao1 merged commit f51131c into elastic:main Feb 28, 2022
@ymao1 ymao1 deleted the alerting/minimum_rule_interval branch February 28, 2022 22:48
yctercero added a commit that referenced this pull request Mar 1, 2022
…interval for rules

Fixes failing cypress tests that are a result of this recent change within alerting - #125396

Rule min interval times now must be 1 minute or greater.
@ymao1
Copy link
Contributor Author

ymao1 commented Mar 14, 2022

With this PR: #127498, we are changing the default behavior to warn instead of error so removing the breaking changes label.

@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
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 ci:cloud-deploy Create or update a Cloud deployment Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) ui-copy Review of UI copy with docs team is recommended v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding a configurable minimal rule interval for newly created rules to follow