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

[Response Ops][Alerting] Removing second call to load rule at end of rule execution #192402

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Sep 9, 2024

Resolves #192396

Summary

Removes second call to load rule at the end of the rule execution. This call was meant to get any changes to the rule schedule that users may have initiated during rule execution but there is a lot of overhead in loading a rule and any changes to the schedule would be captured during the next execution anyway.

To Verify

  1. Add some logging and a delay to rule execution after the initial rule load:
--- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts
+++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts
@@ -684,6 +684,10 @@ export class TaskRunner<
       schedule = asErr(err);
     }

+    this.logger.info(`STARTING RULE EXECUTION`);
+
+    await new Promise((r) => setTimeout(r, 30000));
+
     await withAlertingSpan('alerting:process-run-results-and-update-rule', () =>
  1. Start Kibana and create a rule with a schedule of 3 minutes.
  2. Wait for the rule to run and log, then change the schedule interval to something else.
  3. The next execution of the rule should still occur 3 minutes later, and then further executions should occur on the new schedule.

@ymao1 ymao1 self-assigned this Sep 9, 2024
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

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

cc @ymao1

@ymao1 ymao1 marked this pull request as ready for review September 9, 2024 19:44
@ymao1 ymao1 requested a review from a team as a code owner September 9, 2024 19:44
@ymao1 ymao1 added Feature:Alerting 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.16.0 labels Sep 9, 2024
@elasticmachine
Copy link
Contributor

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

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM

@ymao1 ymao1 merged commit a8d758b into elastic:main Sep 9, 2024
42 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Sep 9, 2024
@ymao1 ymao1 deleted the alerting/remove-final-schedule-get branch September 9, 2024 20:09
gergoabraham pushed a commit to gergoabraham/kibana that referenced this pull request Sep 13, 2024
…rule execution (elastic#192402)

Resolves elastic#192396

## Summary

Removes second call to load rule at the end of the rule execution. This
call was meant to get any changes to the rule schedule that users may
have initiated during rule execution but there is a lot of overhead in
loading a rule and any changes to the schedule would be captured during
the next execution anyway.

## To Verify

1. Add some logging and a delay to rule execution after the initial rule
load:

```
--- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts
+++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts
@@ -684,6 +684,10 @@ export class TaskRunner<
       schedule = asErr(err);
     }

+    this.logger.info(`STARTING RULE EXECUTION`);
+
+    await new Promise((r) => setTimeout(r, 30000));
+
     await withAlertingSpan('alerting:process-run-results-and-update-rule', () =>
```

2. Start Kibana and create a rule with a schedule of 3 minutes.
3. Wait for the rule to run and log, then change the schedule interval
to something else.
4. The next execution of the rule should still occur 3 minutes later,
and then further executions should occur on the new schedule.
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 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.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skip loading the rule's schedule after an alerting rule runs
5 participants