feat(config): add global label length limits#1
Open
rabellamy wants to merge 1 commit into
Open
Conversation
598759c to
53d4a2d
Compare
This commit introduces two new global configuration parameters, `label_name_length_limit` and `label_value_length_limit`, which provide a safety ceiling on the maximum allowable size for label names and values. By setting these global limits, Prometheus dynamically enforces restrictions at multiple system boundaries to protect against Out-Of-Memory (OOM) crashes and excessive resource consumption caused by astronomically large labels: - **Scrape & Parsers** (`model/textparse`, `scrape`): Drops incoming scrape payloads and series that expose metrics with labels exceeding the threshold. - **Remote Write** (`storage/remote`): Drops violating series and returns an HTTP 400 Bad Request, preventing misconfigured remote senders from overwhelming the ingestion path. - **PromQL** (`promql`): Returns an evaluation error during query execution if functions like `label_replace` or `label_join` attempt to mutate and generate labels that violate the limits. Fixes prometheus#16525
53d4a2d to
40f959b
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.
This PR introduces two new global configuration parameters,
label_name_length_limitandlabel_value_length_limit, which provide a safety ceiling on the maximum allowable size for label names and values.By setting these global limits, Prometheus dynamically enforces restrictions at multiple system boundaries to protect against Out-Of-Memory (OOM) crashes and excessive resource consumption caused by astronomically large labels:
model/textparse,scrape): Drops incoming scrape payloads and series that expose metrics with labels exceeding the threshold.storage/remote): Drops violating series and returns anHTTP 400 Bad Request, preventing misconfigured remote senders from overwhelming the ingestion path.promql): Returns an evaluation error during query execution if functions likelabel_replaceorlabel_joinattempt to mutate and generate labels that violate the limits.docs/configuration/configuration.mdto detail usage.promql/label_limits_test.goandstorage/remote/label_limits_test.goand verified the full test suite passes.Which issue(s) does the PR fix:
Fixes prometheus#16525
Release notes for end users (ALL commits must be considered).
Reviewers should verify clarity and quality.