Closed
Conversation
Support "limit" parameter in queries to restrict output data to the specified size. Changes were made towards the following endpoints: * /api/v1/series * /api/v1/labels * /api/v1/label/:name:/values Fixes: prometheus#12795. Signed-off-by: Pranshu Srivastava <[email protected]>
GiedriusS
reviewed
Sep 11, 2023
| } | ||
|
|
||
| func parseLimitParam(limitStr string) (limit int, err error) { | ||
| limit = int(^uint(0) >> 1) // MaxInt |
Contributor
There was a problem hiding this comment.
Let's just use math.MaxInt :)
|
|
||
| func parseLimitParam(limitStr string) (limit int, err error) { | ||
| limit = int(^uint(0) >> 1) // MaxInt | ||
| if limitStr != "" { |
Contributor
There was a problem hiding this comment.
Return early:
if limitStr == "" {
return limit, nil
}
...
GiedriusS
reviewed
Sep 11, 2023
| names = []string{} | ||
| } | ||
|
|
||
| // Respect the "limit" parameter. |
Contributor
There was a problem hiding this comment.
Probably also not worth adding all these comments because it's clear what this does.
Member
|
Hi @rexagod, thanks for the PR. This looks useful, but the comments from @GiedriusS look reasonable. Would you like to update the PR? We looked at this at our bug scrub. |
Member
|
Closing as this was picked up in #13396 |
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.
Support
limitparameter in queries to restrict output data to the specified size. Changes were made towards the following endpoints:Fixes: #12795.