From 41f5925a35f53a4944c88a3126cff8ac6d115dbc Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sat, 9 Dec 2023 21:56:48 -0800 Subject: [PATCH] expose query priority enabled and default priority to cli flags Signed-off-by: Ben Ye --- docs/configuration/config-file-reference.md | 2 ++ pkg/util/validation/limits.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/configuration/config-file-reference.md b/docs/configuration/config-file-reference.md index 8282c15c9a..c87286ab1e 100644 --- a/docs/configuration/config-file-reference.md +++ b/docs/configuration/config-file-reference.md @@ -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: | 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: | default = 0] # List of priority definitions. diff --git a/pkg/util/validation/limits.go b/pkg/util/validation/limits.go index a10e3f1f78..f5cbe5f2b5 100644 --- a/pkg/util/validation/limits.go +++ b/pkg/util/validation/limits.go @@ -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."` } @@ -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.")