cmd/prometheus: add --auto-gomemlimit.refresh-interval flag#18843
Open
sanidhyasin wants to merge 1 commit into
Open
cmd/prometheus: add --auto-gomemlimit.refresh-interval flag#18843sanidhyasin wants to merge 1 commit into
sanidhyasin wants to merge 1 commit into
Conversation
The auto-GOMEMLIMIT feature detects the cgroup or system memory limit only once at startup. When the limit changes at runtime (for example, a Vertical Pod Autoscaler adjusting a container's resources), GOMEMLIMIT keeps the value computed at startup until the process restarts. Add an optional --auto-gomemlimit.refresh-interval flag that wires automemlimit's WithRefreshInterval option, so the limit is periodically re-detected and reapplied. The default of 0s preserves the previous behaviour of detecting the limit only once at startup. Fixes prometheus#18712 Signed-off-by: Sanidhya Singh <singhsanidhya741@gmail.com>
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.
Which issue(s) does the PR fix:
Fixes #18712
Release notes for end users (ALL commits must be considered).
What this does
The auto-GOMEMLIMIT feature (
--auto-gomemlimit) detects the cgroup or system memory limit only once at startup, via a single call tomemlimit.SetGoMemLimitWithOpts. If the limit changes while Prometheus is running — for example, a Vertical Pod Autoscaler (VPA) adjusting a container's memory —GOMEMLIMITkeeps the value computed at startup until the process restarts.This PR adds an optional
--auto-gomemlimit.refresh-intervalflag that wires theautomemlimitlibrary's existingWithRefreshIntervaloption. When set to a non-zero duration, the limit is periodically re-detected andGOMEMLIMITis reapplied if it changed.0s, which preserves the current behaviour exactly (detect once at startup, no background refresh —WithRefreshInterval(0)is a no-op in the library).--auto-gomemlimitis enabled, consistent with--auto-gomemlimit.ratio.model.Duration, so the library's ticker can never receive an invalid interval.Notes
Changes
cmd/prometheus/main.go: new flag + config field, passed through asmemlimit.WithRefreshInterval.docs/command-line/prometheus.md: regenerated viamake cli-documentation.I have signed the DCO.