Skip to content

fix(provider): reduce lock contention#4809

Merged
SuperQ merged 1 commit intoprometheus:mainfrom
siavashs:fix/provider-lock-contention
Dec 18, 2025
Merged

fix(provider): reduce lock contention#4809
SuperQ merged 1 commit intoprometheus:mainfrom
siavashs:fix/provider-lock-contention

Conversation

@siavashs
Copy link
Contributor

The provider loops over all alerts per state, which results in 3 loops over all store alerts and one call per alert to the marker per loop.

Add a custom collector from counting alerts by state. This reduces the number of calls to store and marker to 1/3.

Copy link
Contributor

@Spaceman1701 Spaceman1701 left a comment

Choose a reason for hiding this comment

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

this looks great!

@siavashs siavashs requested a review from SuperQ December 12, 2025 16:55
The provider loops over all alerts per state, which results in 3 loops
over all store alerts and one call per alert to the marker per loop.

Add a custom collector from counting alerts by state.
This reduces the number of calls to store and marker to 1/3.

Signed-off-by: Siavash Safi <siavash@cloudflare.com>
@siavashs siavashs force-pushed the fix/provider-lock-contention branch from 1a46e08 to 3f5c437 Compare December 17, 2025 23:09
@SuperQ SuperQ merged commit 5d9cce4 into prometheus:main Dec 18, 2025
7 checks passed
@siavashs siavashs deleted the fix/provider-lock-contention branch December 18, 2025 09:05
@SoloJacobs SoloJacobs mentioned this pull request Jan 29, 2026
SuperQ added a commit that referenced this pull request Feb 2, 2026
* [ENHANCEMENT] docs(opsgenie): Fix description of `api_url` field. #4908
* [ENHANCEMENT] docs(slack): Document missing app configs. #4871
* [ENHANCEMENT] docs: Fix `max-silence-size-bytes`. #4805
* [ENHANCEMENT] docs: Update expr for `AlertmanagerClusterFailedToSendAlerts` to exclude value 0. #4872
* [ENHANCEMENT] docs: Use matchers for inhibit rules examples. #4131
* [ENHANCEMENT] docs: add notification integrations. #4901
* [ENHANCEMENT] docs: update `slack_config` attachments documentation links. #4802
* [ENHANCEMENT] docs: update description of filter query params in openapi doc. #4810
* [ENHANCEMENT] provider: Reduce lock contention. #4809
* [FEATURE] slack: Add support for top-level text field in slack notification. #4867
* [FEATURE] smtp: Add support for authsecret from file. #3087
* [FEATURE] smtp: Customize the ssl/tls port support (#4757). #4818
* [FEATURE] smtp: Enhance email notifier configuration validation. #4826
* [FEATURE] telegram: Add `chat_id_file` configuration parameter. #4909
* [FEATURE] telegram: Support global bot token. #4823
* [FEATURE] webhook: Support templating in url fields. #4798
* [FEATURE] wechat: Add config directive to pass api secret via file. #4734
* [FEATURE] provider: Implement per alert limits. #4819
* [BUGFIX] Allow empty `group_by` to override parent route. #4825
* [BUGFIX] Set `spellcheck=false` attribute on silence filter input. #4811
* [BUGFIX] jira: Fix for handling api v3 with ADF. #4756
* [BUGFIX] jira: Prevent hostname corruption in cloud api url replacement. #4892
---------

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
Signed-off-by: Ben Kochie <superq@gmail.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants