Proposal for memory limiting in the scrape loop#76
Open
dashpole wants to merge 4 commits intoprometheus:mainfrom
Open
Proposal for memory limiting in the scrape loop#76dashpole wants to merge 4 commits intoprometheus:mainfrom
dashpole wants to merge 4 commits intoprometheus:mainfrom
Conversation
d421c14 to
5e8d860
Compare
Signed-off-by: David Ashpole <dashpole@google.com>
5e8d860 to
9076c48
Compare
Member
bwplotka
reviewed
Mar 11, 2026
Member
bwplotka
left a comment
There was a problem hiding this comment.
IMO this is a great plan, something I'd like to see 👍🏽
Signed-off-by: David Ashpole <dashpole@google.com>
aaa6bdf to
951d80e
Compare
bwplotka
approved these changes
Mar 12, 2026
Member
bwplotka
left a comment
There was a problem hiding this comment.
I'm supportive. It should break the ice on the non trivial issues you listed and it's elegant. This would also help with Otel-collector Prometheus scrapes.
- prometheus/prometheus#17109
- prometheus/prometheus#13939
- prometheus/prometheus#11306
- prometheus/prometheus#16917
Disclaimer @dashpole works with me at Google, so I'm not going to merge until we have buy-in from other maintainers.
dashpole
commented
Mar 12, 2026
|
|
||
| **2. The Prometheus Server Operator:** | ||
| Server operators need to understand the global impact of memory limiting so they can take corrective action (e.g., increasing memory limits, adding Prometheus replicas, or investigating massive targets). | ||
| * **Counter for aborted scrapes:** A new internal Prometheus metric (e.g., `prometheus_target_scrapes_skipped_memory_limit_total`) will be introduced to track the total number of aborted scrapes globally. Operators can set alerts on this metric to be notified of memory pressure, allowing them to intervene if data loss becomes too widespread. |
Contributor
Author
There was a problem hiding this comment.
Note to reviewers: The name can be debated/changed during review.
GiedriusS
reviewed
Mar 12, 2026
GiedriusS
reviewed
Mar 12, 2026
Signed-off-by: David Ashpole <dashpole@google.com>
8200c74 to
db29e0b
Compare
Signed-off-by: David Ashpole <dashpole@google.com>
9cbc215 to
677f3a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As @bwplotka presented in his "Scrape Trolley Dillema" talk last year at promcon, Prometheus could use a mechanism to prevent OOMs caused by short-term memory usage of scraping targets. This has also been a request from some users of the OTel collector's Prometheus receiver.
PoC: prometheus/prometheus@main...dashpole:prometheus:memory_limiter_simple
cc @bernot-dev @ArthurSens