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

Optimize access to flapping settings in the task runner #149884

Closed
doakalexi opened this issue Jan 30, 2023 · 2 comments
Closed

Optimize access to flapping settings in the task runner #149884

doakalexi opened this issue Jan 30, 2023 · 2 comments
Assignees
Labels
Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@doakalexi
Copy link
Contributor

Investigate better pattern to reducing the amount of i/o when getting flappingSettings in the task runner.

To do this, we will need to add timings around the get rulesSettingsClient and get flappingSettings code in the task runner to measure the impact, since it is a new blocking i/o to ES on every rule run.

@doakalexi doakalexi added the Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) label Jan 30, 2023
@elasticmachine
Copy link
Contributor

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

@pmuellr pmuellr moved this from Awaiting Triage to Todo in AppEx: ResponseOps - Execution & Connectors Feb 2, 2023
ymao1 added a commit that referenced this issue Sep 16, 2024
…hing rules settings (#192404)

Resolves #184321 and
#149884

## Summary

Created a `RulesSettingsService` that caches flapping and query delay
settings per space for 1 minute so rules are not accessing the SO index
with every execution.

Also moved all classes related to the rules settings into the
`rules_settings` folder so some of these changes are just renaming
changes.

## To Verify
1. Add some logging to
`x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts`
to indicate when settings are being fetched and when they're returning
from the cache.
2. Create and run some rules in different spaces to see that flapping
and query delay settings are being returned from the cache when the
cache has not expired.

---------

Co-authored-by: Elastic Machine <[email protected]>
@ymao1
Copy link
Contributor

ymao1 commented Sep 16, 2024

Addressed with #192404

@ymao1 ymao1 closed this as completed Sep 16, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 16, 2024
…hing rules settings (elastic#192404)

Resolves elastic#184321 and
elastic#149884

## Summary

Created a `RulesSettingsService` that caches flapping and query delay
settings per space for 1 minute so rules are not accessing the SO index
with every execution.

Also moved all classes related to the rules settings into the
`rules_settings` folder so some of these changes are just renaming
changes.

## To Verify
1. Add some logging to
`x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts`
to indicate when settings are being fetched and when they're returning
from the cache.
2. Create and run some rules in different spaces to see that flapping
and query delay settings are being returned from the cache when the
cache has not expired.

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 7a0fe2e)
kibanamachine added a commit that referenced this issue Sep 16, 2024
…nd caching rules settings (#192404) (#193011)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Response Ops][Alerting] Creating global service for fetching and
caching rules settings
(#192404)](#192404)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-16T13:22:44Z","message":"[Response
Ops][Alerting] Creating global service for fetching and caching rules
settings (#192404)\n\nResolves
#184321
and\r\nhttps://github.com//issues/149884\r\n\r\n##
Summary\r\n\r\nCreated a `RulesSettingsService` that caches flapping and
query delay\r\nsettings per space for 1 minute so rules are not
accessing the SO index\r\nwith every execution.\r\n\r\nAlso moved all
classes related to the rules settings into the\r\n`rules_settings`
folder so some of these changes are just renaming\r\nchanges.\r\n\r\n##
To Verify\r\n1. Add some logging
to\r\n`x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts`\r\nto
indicate when settings are being fetched and when they're
returning\r\nfrom the cache.\r\n2. Create and run some rules in
different spaces to see that flapping\r\nand query delay settings are
being returned from the cache when the\r\ncache has not
expired.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"7a0fe2e83683cf38c537694daa88a3a75bfe3e57","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.16.0"],"title":"[Response
Ops][Alerting] Creating global service for fetching and caching rules
settings","number":192404,"url":"https://github.com/elastic/kibana/pull/192404","mergeCommit":{"message":"[Response
Ops][Alerting] Creating global service for fetching and caching rules
settings (#192404)\n\nResolves
#184321
and\r\nhttps://github.com//issues/149884\r\n\r\n##
Summary\r\n\r\nCreated a `RulesSettingsService` that caches flapping and
query delay\r\nsettings per space for 1 minute so rules are not
accessing the SO index\r\nwith every execution.\r\n\r\nAlso moved all
classes related to the rules settings into the\r\n`rules_settings`
folder so some of these changes are just renaming\r\nchanges.\r\n\r\n##
To Verify\r\n1. Add some logging
to\r\n`x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts`\r\nto
indicate when settings are being fetched and when they're
returning\r\nfrom the cache.\r\n2. Create and run some rules in
different spaces to see that flapping\r\nand query delay settings are
being returned from the cache when the\r\ncache has not
expired.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"7a0fe2e83683cf38c537694daa88a3a75bfe3e57"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192404","number":192404,"mergeCommit":{"message":"[Response
Ops][Alerting] Creating global service for fetching and caching rules
settings (#192404)\n\nResolves
#184321
and\r\nhttps://github.com//issues/149884\r\n\r\n##
Summary\r\n\r\nCreated a `RulesSettingsService` that caches flapping and
query delay\r\nsettings per space for 1 minute so rules are not
accessing the SO index\r\nwith every execution.\r\n\r\nAlso moved all
classes related to the rules settings into the\r\n`rules_settings`
folder so some of these changes are just renaming\r\nchanges.\r\n\r\n##
To Verify\r\n1. Add some logging
to\r\n`x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts`\r\nto
indicate when settings are being fetched and when they're
returning\r\nfrom the cache.\r\n2. Create and run some rules in
different spaces to see that flapping\r\nand query delay settings are
being returned from the cache when the\r\ncache has not
expired.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"7a0fe2e83683cf38c537694daa88a3a75bfe3e57"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ying Mao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Development

No branches or pull requests

3 participants