-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make default search limit configurable #1022
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor comments.
The new param should be added to the config docs.
modules/ingester/instance_search.go
Outdated
maxResults := int(req.Limit) | ||
// limit should always be set, if it's missing set a safe default | ||
if maxResults == 0 { | ||
maxResults = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should never be reached correct? It's the main purpose of the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this line should never be reached. I wanted to add it as an extra safety check, just in case someone sends a query directly to the ingester. But this should be pretty much impossible as it's pretty hard to send a grpc request.
Protecting against 0 also doesn't make a lot of sense and it can never be negative 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to re-add the check again as req.Limit == 0
is most likely an indication that the caller didn't bother to set the limit. It's unlikely they explicitly wanted a limit of 0. If the limit is unset I think we should simply use a safe default limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs look good to me.
What this PR does:
Adds a configuration parameter
querier.search_default_limit
which allows you to set a server-side default.Which issue(s) this PR fixes:
Part of #932
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]