-
Notifications
You must be signed in to change notification settings - Fork 816
query rejection #6005
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
Merged
Merged
query rejection #6005
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
12de492
query rejection
erlan-z c820096
doc-generator
erlan-z 6088633
query rejection
erlan-z dccf2e4
query rejection
erlan-z 63cfa4c
query rejection - update docs
erlan-z 211b153
query rejection - add time range attribute
erlan-z cb8ad44
query rejection - address comments
erlan-z 0dc3f1a
query rejection - add integration test, fix query_step_limit
erlan-z bf3e1cb
query rejection - fix imports and improve doc.
erlan-z 739cf23
query rejection - address comments.
erlan-z 0f6a230
query rejection - remove step limit check for subqueries.
erlan-z 572c8ca
query rejection - add API type
erlan-z c0d9115
query rejection - address comments
erlan-z File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3285,6 +3285,20 @@ query_priority: | |
# List of priority definitions. | ||
[priorities: <list of PriorityDef> | default = []] | ||
|
||
# Configuration for query rejection. | ||
query_rejection: | ||
# Whether query rejection is enabled. | ||
# CLI flag: -frontend.query-rejection.enabled | ||
[enabled: <boolean> | default = false] | ||
|
||
# List of query_attributes to match and reject queries. A query is rejected if | ||
# it matches any query_attribute in this list. Each query_attribute has | ||
# several properties (e.g., regex, time_window, user_agent), and all specified | ||
# properties must match for a query_attribute to be considered a match. Only | ||
# the specified properties are checked, and an AND operator is applied to | ||
# them. | ||
[query_attributes: <list of QueryAttribute> | default = []] | ||
|
||
# Duration to delay the evaluation of rules to ensure the underlying metrics | ||
# have been pushed to Cortex. | ||
# CLI flag: -ruler.evaluation-delay-duration | ||
|
@@ -5345,14 +5359,24 @@ limits: | |
# priority level. Value between 0 and 1 will be used as a percentage. | ||
[reserved_queriers: <float> | default = 0] | ||
|
||
# List of query attributes to assign the priority. | ||
# List of query_attributes to match and assign priority to queries. A query is | ||
# assigned to this priority if it matches any query_attribute in this list. Each | ||
# query_attribute has several properties (e.g., regex, time_window, user_agent), | ||
# and all specified properties must match for a query_attribute to be considered | ||
# a match. Only the specified properties are checked, and an AND operator is | ||
# applied to them. | ||
[query_attributes: <list of QueryAttribute> | default = []] | ||
``` | ||
|
||
### `QueryAttribute` | ||
|
||
```yaml | ||
# Regex that the query string should match. If not set, it won't be checked. | ||
# API type for the query. Should be one of the query, query_range, series, | ||
# labels, label_values. If not set, it won't be checked. | ||
[api_type: <string> | default = ""] | ||
|
||
# Regex that the query string (or at least one of the matchers in metadata | ||
# query) should match. If not set, it won't be checked. | ||
[regex: <string> | default = ""] | ||
|
||
# Overall data select time window (including range selectors, modifiers and | ||
|
@@ -5368,6 +5392,49 @@ time_window: | |
# lookback delta) that the query should be within. If set to 0, it won't be | ||
# checked. | ||
[end: <int> | default = 0] | ||
|
||
# Query time range should be within this limit to match. Depending on where it | ||
# was used, in most of the use-cases, either min or max value will be used. If | ||
# not set, it won't be checked. | ||
time_range_limit: | ||
# This will be duration (12h, 1d, 15d etc.). Query time range should be above | ||
# or equal to this value to match. Ex: if this value is 20d, then queries | ||
# whose range is bigger than or equal to 20d will match. If set to 0, it won't | ||
# be checked. | ||
[min: <int> | default = 0] | ||
|
||
# This will be duration (12h, 1d, 15d etc.). Query time range should be below | ||
# or equal to this value to match. Ex: if this value is 24h, then queries | ||
# whose range is smaller than or equal to 24h will match.If set to 0, it won't | ||
# be checked. | ||
[max: <int> | default = 0] | ||
|
||
# If query step provided should be within this limit to match. If not set, it | ||
# won't be checked. This property only applied to range queries and ignored for | ||
# other types of queries. | ||
query_step_limit: | ||
# Query step should be above or equal to this value to match. If set to 0, it | ||
# won't be checked. | ||
[min: <int> | default = 0] | ||
|
||
# Query step should be below or equal to this value to match. If set to 0, it | ||
# won't be checked. | ||
[max: <int> | default = 0] | ||
Comment on lines
+5415
to
+5422
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we incorporate this config here and deprecate it?
I'm trying to not have 2 ways of setting query limits. |
||
|
||
# Regex that User-Agent header of the request should match. If not set, it won't | ||
# be checked. | ||
[user_agent_regex: <string> | default = ""] | ||
|
||
# Grafana includes X-Dashboard-Uid header in query requests. If this field is | ||
# provided then X-Dashboard-Uid header of request should match this value. If | ||
# not set, it won't be checked. This property won't be applied to metadata | ||
# queries. | ||
[dashboard_uid: <string> | default = ""] | ||
|
||
# Grafana includes X-Panel-Id header in query requests. If this field is | ||
# provided then X-Panel-Id header of request should match this value. If not | ||
# set, it won't be checked. This property won't be applied to metadata queries. | ||
[panel_id: <string> | default = ""] | ||
``` | ||
|
||
### `DisabledRuleGroup` | ||
|
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.