-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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: Support concurrent queries for saving alert instances #70525
Alerting: Support concurrent queries for saving alert instances #70525
Conversation
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default.
3656109
to
5669998
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change - really clean implementation.
My only nits which are non-blocking:
- Naming, I'd have gone for
max_state_save_concurrency
, but that's purely subjective so I'm happy with it as-is. - A test to exercise a concurrency value other than 1, but I don't think it's worth the effort. The
ForEachJob
function in dskit is battle tested, so I'm not especially worried.
logger.Debug("Saving alert states done", "count", len(states)) | ||
|
||
logger.Debug("Saving alert states", "count", len(states), "max_concurrent_state_savers", st.maxConcurrentStateSavers) | ||
_ = concurrency.ForEachJob(ctx, len(states), st.maxConcurrentStateSavers, saveState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though the ForEachJob
function will work as expected with concurrency=1, it will spawn a Goroutine needlessly. This is probably not anything to be worried about, just flagging it.
I like it, will change it! |
concurrency=1 (default):
concurrency=10
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default.
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72)
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72)
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72)
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72)
…nces (#70869) * Alerting: Support concurrent queries for saving alert instances (#70525) This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72) * remove changes in api_testing.go --------- Co-authored-by: George Robinson <george.robinson@grafana.com>
Hello @santihernandezc!
Please, if the current pull request addresses a bug fix, label it with the |
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72)
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default.
This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default.
…ces (#70921) * Alerting: Support concurrent queries for saving alert instances (#70525) This commit adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default. (cherry picked from commit 7edbe72) * Trigger PR automation --------- Co-authored-by: George Robinson <george.robinson@grafana.com>
What is this feature?
This pull request adds support for concurrent queries when saving alert instances to the database. This is an experimental feature in response to some customers experiencing delays between rule evaluation and sending alerts to Alertmanager, resulting in flapping. It is disabled by default.
1 concurrent saver (default):
10 concurrent savers:
Why do we need this feature?
[Add a description of the problem the feature is trying to solve.]
Who is this feature for?
[Add information on what kind of user the feature is for.]
Which issue(s) does this PR fix?:
Fixes #
Special notes for your reviewer:
Please check that: