Skip to content

Commit

Permalink
MQE: Add support to disable functions+aggregations by name
Browse files Browse the repository at this point in the history
  • Loading branch information
jhesketh committed Jan 9, 2025
1 parent ce6871c commit 28b5513
Show file tree
Hide file tree
Showing 10 changed files with 251 additions and 169 deletions.
61 changes: 36 additions & 25 deletions cmd/mimir/config-descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1969,23 +1969,34 @@
},
{
"kind": "field",
"name": "enable_vector_vector_binary_comparison_operations",
"name": "enable_binary_logical_operations",
"required": false,
"desc": "Enable support for binary comparison operations between two vectors in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Enable support for binary logical operations in the Mimir query engine. Only applies if the MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-vector-vector-binary-comparison-operations",
"fieldFlag": "querier.mimir-query-engine.enable-binary-logical-operations",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "enable_vector_scalar_binary_comparison_operations",
"name": "enable_one_to_many_and_many_to_one_binary_operations",
"required": false,
"desc": "Enable support for binary comparison operations between a vector and a scalar in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Enable support for one-to-many and many-to-one binary operations (group_left/group_right) in the Mimir query engine. Only applies if the MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-vector-scalar-binary-comparison-operations",
"fieldFlag": "querier.mimir-query-engine.enable-one-to-many-and-many-to-one-binary-operations",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "enable_scalars",
"required": false,
"desc": "Enable support for scalars in the Mimir query engine. Only applies if the MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-scalars",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
Expand All @@ -2002,57 +2013,57 @@
},
{
"kind": "field",
"name": "enable_binary_logical_operations",
"name": "enable_subqueries",
"required": false,
"desc": "Enable support for binary logical operations in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Enable support for subqueries in the Mimir query engine. Only applies if the MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-binary-logical-operations",
"fieldFlag": "querier.mimir-query-engine.enable-subqueries",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "enable_scalars",
"name": "enable_vector_scalar_binary_comparison_operations",
"required": false,
"desc": "Enable support for scalars in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Enable support for binary comparison operations between a vector and a scalar in the Mimir query engine. Only applies if the MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-scalars",
"fieldFlag": "querier.mimir-query-engine.enable-vector-scalar-binary-comparison-operations",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "enable_subqueries",
"name": "enable_vector_vector_binary_comparison_operations",
"required": false,
"desc": "Enable support for subqueries in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Enable support for binary comparison operations between two vectors in the Mimir query engine. Only applies if the MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-subqueries",
"fieldFlag": "querier.mimir-query-engine.enable-vector-vector-binary-comparison-operations",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "enable_histogram_quantile_function",
"name": "disabled_aggregations",
"required": false,
"desc": "Enable support for the histogram_quantile function in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Comma-separated list of aggregations to disable. Queries using a disabled aggregation will fall back to Prometheus' query engine. Only applies if MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-histogram-quantile-function",
"fieldType": "boolean",
"fieldDefaultValue": "",
"fieldFlag": "querier.mimir-query-engine.disabled-aggregations",
"fieldType": "string",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "enable_one_to_many_and_many_to_one_binary_operations",
"name": "disabled_functions",
"required": false,
"desc": "Enable support for one-to-many and many-to-one binary operations (group_left/group_right) in the Mimir query engine. Only applies if the MQE is in use.",
"desc": "Comma-separated list of function names to disable. Queries using a disabled function will fall back to Prometheus' query engine. Only applies if MQE is in use.",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "querier.mimir-query-engine.enable-one-to-many-and-many-to-one-binary-operations",
"fieldType": "boolean",
"fieldDefaultValue": "",
"fieldFlag": "querier.mimir-query-engine.disabled-functions",
"fieldType": "string",
"fieldCategory": "experimental"
}
],
Expand Down
6 changes: 4 additions & 2 deletions cmd/mimir/help-all.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2097,12 +2097,14 @@ Usage of ./cmd/mimir/mimir:
Maximum number of split (by time) or partial (by shard) queries that will be scheduled in parallel by the query-frontend for a single input query. This limit is introduced to have a fairer query scheduling and avoid a single query over a large time range saturating all available queriers. (default 14)
-querier.max-samples int
Maximum number of samples a single query can load into memory. This config option should be set on query-frontend too when query sharding is enabled. (default 50000000)
-querier.mimir-query-engine.disabled-aggregations comma-separated-list-of-strings
[experimental] Comma-separated list of aggregations to disable. Queries using a disabled aggregation will fall back to Prometheus' query engine. Only applies if MQE is in use.
-querier.mimir-query-engine.disabled-functions comma-separated-list-of-strings
[experimental] Comma-separated list of function names to disable. Queries using a disabled function will fall back to Prometheus' query engine. Only applies if MQE is in use.
-querier.mimir-query-engine.enable-aggregation-operations
[experimental] Enable support for aggregation operations in the Mimir query engine. Only applies if the MQE is in use. (default true)
-querier.mimir-query-engine.enable-binary-logical-operations
[experimental] Enable support for binary logical operations in the Mimir query engine. Only applies if the MQE is in use. (default true)
-querier.mimir-query-engine.enable-histogram-quantile-function
[experimental] Enable support for the histogram_quantile function in the Mimir query engine. Only applies if the MQE is in use. (default true)
-querier.mimir-query-engine.enable-one-to-many-and-many-to-one-binary-operations
[experimental] Enable support for one-to-many and many-to-one binary operations (group_left/group_right) in the Mimir query engine. Only applies if the MQE is in use. (default true)
-querier.mimir-query-engine.enable-scalar-scalar-binary-comparison-operations
Expand Down
57 changes: 32 additions & 25 deletions docs/sources/mimir/configure/configuration-parameters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1496,47 +1496,54 @@ mimir_query_engine:
# CLI flag: -querier.mimir-query-engine.enable-aggregation-operations
[enable_aggregation_operations: <boolean> | default = true]
# (experimental) Enable support for binary comparison operations between two
# vectors in the Mimir query engine. Only applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-vector-vector-binary-comparison-operations
[enable_vector_vector_binary_comparison_operations: <boolean> | default = true]
# (experimental) Enable support for binary comparison operations between a
# vector and a scalar in the Mimir query engine. Only applies if the MQE is in
# use.
# CLI flag: -querier.mimir-query-engine.enable-vector-scalar-binary-comparison-operations
[enable_vector_scalar_binary_comparison_operations: <boolean> | default = true]
# (experimental) Enable support for binary comparison operations between two
# scalars in the Mimir query engine. Only applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-scalar-scalar-binary-comparison-operations
[enable_scalar_scalar_binary_comparison_operations: <boolean> | default = true]
# (experimental) Enable support for binary logical operations in the Mimir
# query engine. Only applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-binary-logical-operations
[enable_binary_logical_operations: <boolean> | default = true]
# (experimental) Enable support for one-to-many and many-to-one binary
# operations (group_left/group_right) in the Mimir query engine. Only applies
# if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-one-to-many-and-many-to-one-binary-operations
[enable_one_to_many_and_many_to_one_binary_operations: <boolean> | default = true]
# (experimental) Enable support for scalars in the Mimir query engine. Only
# applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-scalars
[enable_scalars: <boolean> | default = true]
# (experimental) Enable support for binary comparison operations between two
# scalars in the Mimir query engine. Only applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-scalar-scalar-binary-comparison-operations
[enable_scalar_scalar_binary_comparison_operations: <boolean> | default = true]
# (experimental) Enable support for subqueries in the Mimir query engine. Only
# applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-subqueries
[enable_subqueries: <boolean> | default = true]
# (experimental) Enable support for the histogram_quantile function in the
# Mimir query engine. Only applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-histogram-quantile-function
[enable_histogram_quantile_function: <boolean> | default = true]
# (experimental) Enable support for binary comparison operations between a
# vector and a scalar in the Mimir query engine. Only applies if the MQE is in
# use.
# CLI flag: -querier.mimir-query-engine.enable-vector-scalar-binary-comparison-operations
[enable_vector_scalar_binary_comparison_operations: <boolean> | default = true]
# (experimental) Enable support for one-to-many and many-to-one binary
# operations (group_left/group_right) in the Mimir query engine. Only applies
# if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-one-to-many-and-many-to-one-binary-operations
[enable_one_to_many_and_many_to_one_binary_operations: <boolean> | default = true]
# (experimental) Enable support for binary comparison operations between two
# vectors in the Mimir query engine. Only applies if the MQE is in use.
# CLI flag: -querier.mimir-query-engine.enable-vector-vector-binary-comparison-operations
[enable_vector_vector_binary_comparison_operations: <boolean> | default = true]
# (experimental) Comma-separated list of aggregations to disable. Queries
# using a disabled aggregation will fall back to Prometheus' query engine.
# Only applies if MQE is in use.
# CLI flag: -querier.mimir-query-engine.disabled-aggregations
[disabled_aggregations: <string> | default = ""]
# (experimental) Comma-separated list of function names to disable. Queries
# using a disabled function will fall back to Prometheus' query engine. Only
# applies if MQE is in use.
# CLI flag: -querier.mimir-query-engine.disabled-functions
[disabled_functions: <string> | default = ""]
```

### frontend
Expand Down
6 changes: 3 additions & 3 deletions pkg/querier/engine/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Config struct {

PromQLExperimentalFunctionsEnabled bool `yaml:"promql_experimental_functions_enabled" category:"experimental"`

MimirQueryEngine streamingpromql.FeatureToggles `yaml:"mimir_query_engine" category:"experimental"`
MimirQueryEngine streamingpromql.MQEOpts `yaml:"mimir_query_engine" category:"experimental"`
}

func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
Expand Down Expand Up @@ -73,8 +73,8 @@ func NewPromQLEngineOptions(cfg Config, activityTracker *activitytracker.Activit
}

mqeOpts := streamingpromql.EngineOpts{
CommonOpts: commonOpts,
FeatureToggles: cfg.MimirQueryEngine,
CommonOpts: commonOpts,
MQEOpts: cfg.MimirQueryEngine,
}

return commonOpts, mqeOpts, cfg.PromQLExperimentalFunctionsEnabled
Expand Down
Loading

0 comments on commit 28b5513

Please sign in to comment.