Skip to content

fix: improve gc in provider and store#5013

Merged
siavashs merged 6 commits intoprometheus:mainfrom
siavashs:fix/improve-gc-callbacks
Feb 19, 2026
Merged

fix: improve gc in provider and store#5013
siavashs merged 6 commits intoprometheus:mainfrom
siavashs:fix/improve-gc-callbacks

Conversation

@siavashs
Copy link
Copy Markdown
Contributor

@siavashs siavashs commented Feb 16, 2026

Break up GC into stages to release the locks earlier.
This should avoid blocking while alerts are deleted from internal caches.
The callbacks are now called without holding locks in the caller.
Add PostGC callback to mem provider.
Modify the marker Delete method to accept multiple arguments.
Store does not copy deleted alerts to avoid unnecessary allocations.

Pull Request Checklist

Please check all the applicable boxes.

  • Please list all open issue(s) discussed with maintainers related to this change
    • Fixes #
  • Is this a new Receiver integration?
  • Is this a bugfix?
    • I have added tests that can reproduce the bug which pass with this bugfix applied
  • Is this a new feature?
    • I have added tests that test the new feature's functionality
  • Does this change affect performance?
    • I have provided benchmarks comparison that shows performance is improved or is not degraded
      • You can use benchstat to compare benchmarks
    • I have added new benchmarks if required or requested by maintainers
  • Is this a breaking change?
    • My changes do not break the existing cluster messages
    • My changes do not break the existing api
  • I have added/updated the required documentation
  • I have signed-off my commits
  • I will follow best practices for contributing to this project

Which user-facing changes does this PR introduce?

NONE

Break up GC into stages to release the locks earlier.
This should avoid blocking while alerts are deleted from internal caches.
The callbacks are now called without holding locks in the caller.
Modify the marker and PostDelete callback to accept multiple arguments.

Signed-off-by: Siavash Safi <siavash@cloudflare.com>
@siavashs siavashs force-pushed the fix/improve-gc-callbacks branch from 1b16d2e to 31ae468 Compare February 16, 2026 13:42
@siavashs siavashs marked this pull request as ready for review February 16, 2026 13:48
Comment thread provider/mem/mem_test.go Outdated
Comment thread store/store.go Outdated
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
@siavashs siavashs requested a review from ultrotter February 17, 2026 16:00
Comment thread provider/mem/mem.go Outdated
Comment thread provider/mem/mem.go Outdated
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Comment thread provider/mem/mem_test.go
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
@siavashs siavashs requested a review from ultrotter February 18, 2026 16:41
@siavashs siavashs merged commit ea9a871 into prometheus:main Feb 19, 2026
7 checks passed
@siavashs siavashs deleted the fix/improve-gc-callbacks branch February 19, 2026 10:55
coatico pushed a commit to coatico/alertmanager that referenced this pull request Mar 10, 2026
* fix: improve gc in provider and store

Break up GC into stages to release the locks earlier.
This should avoid blocking while alerts are deleted from internal caches.
The callbacks are now called without holding locks in the caller.
Add PostGC callback to mem provider.
Modify the marker Delete method to accept multiple arguments.
Store does not copy deleted alerts to avoid unnecessary allocations.

Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Signed-off-by: VAN LINT <marnix.vanlint@worldline.com>
coatico pushed a commit to coatico/alertmanager that referenced this pull request Mar 10, 2026
* fix: improve gc in provider and store

Break up GC into stages to release the locks earlier.
This should avoid blocking while alerts are deleted from internal caches.
The callbacks are now called without holding locks in the caller.
Add PostGC callback to mem provider.
Modify the marker Delete method to accept multiple arguments.
Store does not copy deleted alerts to avoid unnecessary allocations.

Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Signed-off-by: VAN LINT <marnix.vanlint@worldline.com>
SoloJacobs pushed a commit to SoloJacobs/alertmanager that referenced this pull request Mar 15, 2026
* fix: improve gc in provider and store

Break up GC into stages to release the locks earlier.
This should avoid blocking while alerts are deleted from internal caches.
The callbacks are now called without holding locks in the caller.
Add PostGC callback to mem provider.
Modify the marker Delete method to accept multiple arguments.
Store does not copy deleted alerts to avoid unnecessary allocations.

Signed-off-by: Siavash Safi <siavash@cloudflare.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.

2 participants