Skip to content

Commit

Permalink
expose query priority enabled and default priority to cli flags (#5705)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 authored Dec 10, 2023
1 parent 74a75c7 commit f9f956b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/configuration/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3053,10 +3053,12 @@ The `limits_config` configures default and per-tenant limits imposed by Cortex s
# Configuration for query priority.
query_priority:
# Whether queries are assigned with priorities.
# CLI flag: -frontend.query-priority.enabled
[enabled: <boolean> | default = false]

# Priority assigned to all queries by default. Must be a unique value. Use
# this as a baseline to make certain queries higher/lower priority.
# CLI flag: -frontend.query-priority.default-priority
[default_priority: <int> | default = 0]

# List of priority definitions.
Expand Down
6 changes: 4 additions & 2 deletions pkg/util/validation/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ type DisabledRuleGroup struct {
type DisabledRuleGroups []DisabledRuleGroup

type QueryPriority struct {
Enabled bool `yaml:"enabled" json:"enabled" doc:"nocli|description=Whether queries are assigned with priorities.|default=false"`
DefaultPriority int64 `yaml:"default_priority" json:"default_priority" doc:"nocli|description=Priority assigned to all queries by default. Must be a unique value. Use this as a baseline to make certain queries higher/lower priority.|default=0"`
Enabled bool `yaml:"enabled" json:"enabled"`
DefaultPriority int64 `yaml:"default_priority" json:"default_priority"`
Priorities []PriorityDef `yaml:"priorities" json:"priorities" doc:"nocli|description=List of priority definitions."`
}

Expand Down Expand Up @@ -216,6 +216,8 @@ func (l *Limits) RegisterFlags(f *flag.FlagSet) {
f.Var(&l.MaxCacheFreshness, "frontend.max-cache-freshness", "Most recent allowed cacheable result per-tenant, to prevent caching very recent results that might still be in flux.")
f.Float64Var(&l.MaxQueriersPerTenant, "frontend.max-queriers-per-tenant", 0, "Maximum number of queriers that can handle requests for a single tenant. If set to 0 or value higher than number of available queriers, *all* queriers will handle requests for the tenant. If the value is < 1, it will be treated as a percentage and the gets a percentage of the total queriers. Each frontend (or query-scheduler, if used) will select the same set of queriers for the same tenant (given that all queriers are connected to all frontends / query-schedulers). This option only works with queriers connecting to the query-frontend / query-scheduler, not when using downstream URL.")
f.IntVar(&l.QueryVerticalShardSize, "frontend.query-vertical-shard-size", 0, "[Experimental] Number of shards to use when distributing shardable PromQL queries.")
f.BoolVar(&l.QueryPriority.Enabled, "frontend.query-priority.enabled", false, "Whether queries are assigned with priorities.")
f.Int64Var(&l.QueryPriority.DefaultPriority, "frontend.query-priority.default-priority", 0, "Priority assigned to all queries by default. Must be a unique value. Use this as a baseline to make certain queries higher/lower priority.")

f.IntVar(&l.MaxOutstandingPerTenant, "frontend.max-outstanding-requests-per-tenant", 100, "Maximum number of outstanding requests per tenant per request queue (either query frontend or query scheduler); requests beyond this error with HTTP 429.")

Expand Down

0 comments on commit f9f956b

Please sign in to comment.