Skip to content

Commit ccf4d1d

Browse files
authored
Adding decodingConcurrency flag for Thanos Engine (#7118)
Signed-off-by: Paurush Garg <[email protected]>
1 parent 195e99f commit ccf4d1d

File tree

6 files changed

+40
-9
lines changed

6 files changed

+40
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* [ENHANCEMENT] Ingester: Add `enable_matcher_optimization` config to apply low selectivity matchers lazily. #7063
88
* [ENHANCEMENT] Distributor: Add a label references validation for remote write v2 request. #7074
99
* [ENHANCEMENT] Distributor: Add count, spans, and buckets validations for native histogram. #7072
10+
* [ENHANCEMENT] Ruler: Add DecodingConcurrency config flag for Thanos Engine. #7118
1011
* [BUGFIX] Ring: Change DynamoDB KV to retry indefinitely for WatchKey. #7088
1112
* [BUGFIX] Ruler: Add XFunctions validation support. #7111
1213

docs/blocks-storage/querier.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ querier:
269269
# CLI flag: -querier.optimizers
270270
[optimizers: <string> | default = "default"]
271271

272+
# Maximum number of goroutines that can be used to decode samples. 0
273+
# defaults to GOMAXPROCS / 2.
274+
# CLI flag: -querier.decoding-concurrency
275+
[decoding_concurrency: <int> | default = 0]
276+
272277
# If enabled, ignore max query length check at Querier select method. Users
273278
# can choose to ignore it since the validation can be done before Querier
274279
# evaluation like at Query Frontend or Ruler.

docs/configuration/config-file-reference.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4758,6 +4758,11 @@ thanos_engine:
47584758
# CLI flag: -querier.optimizers
47594759
[optimizers: <string> | default = "default"]
47604760

4761+
# Maximum number of goroutines that can be used to decode samples. 0 defaults
4762+
# to GOMAXPROCS / 2.
4763+
# CLI flag: -querier.decoding-concurrency
4764+
[decoding_concurrency: <int> | default = 0]
4765+
47614766
# If enabled, ignore max query length check at Querier select method. Users can
47624767
# choose to ignore it since the validation can be done before Querier evaluation
47634768
# like at Query Frontend or Ruler.
@@ -5519,6 +5524,11 @@ thanos_engine:
55195524
# sort-matchers, merge-selects, detect-histogram-stats
55205525
# CLI flag: -ruler.optimizers
55215526
[optimizers: <string> | default = "default"]
5527+
5528+
# Maximum number of goroutines that can be used to decode samples. 0 defaults
5529+
# to GOMAXPROCS / 2.
5530+
# CLI flag: -ruler.decoding-concurrency
5531+
[decoding_concurrency: <int> | default = 0]
55225532
```
55235533
55245534
### `ruler_storage_config`

pkg/engine/config.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ import (
1010

1111
var supportedOptimizers = []string{"default", "all", "propagate-matchers", "sort-matchers", "merge-selects", "detect-histogram-stats"}
1212

13-
// ThanosEngineConfig contains the configuration to create engine
13+
// ThanosEngineConfig contains the configuration to create engine.
1414
type ThanosEngineConfig struct {
15-
Enabled bool `yaml:"enabled"`
16-
EnableXFunctions bool `yaml:"enable_x_functions"`
17-
Optimizers string `yaml:"optimizers"`
18-
LogicalOptimizers []logicalplan.Optimizer `yaml:"-"`
15+
Enabled bool `yaml:"enabled"`
16+
EnableXFunctions bool `yaml:"enable_x_functions"`
17+
Optimizers string `yaml:"optimizers"`
18+
DecodingConcurrency int `yaml:"decoding_concurrency"`
19+
LogicalOptimizers []logicalplan.Optimizer `yaml:"-"`
1920
}
2021

2122
func (cfg *ThanosEngineConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
2223
f.BoolVar(&cfg.Enabled, prefix+"thanos-engine", false, "Experimental. Use Thanos promql engine https://github.com/thanos-io/promql-engine rather than the Prometheus promql engine.")
2324
f.BoolVar(&cfg.EnableXFunctions, prefix+"enable-x-functions", false, "Enable xincrease, xdelta, xrate etc from Thanos engine.")
2425
f.StringVar(&cfg.Optimizers, prefix+"optimizers", "default", "Logical plan optimizers. Multiple optimizers can be provided as a comma-separated list. Supported values: "+strings.Join(supportedOptimizers, ", "))
26+
f.IntVar(&cfg.DecodingConcurrency, prefix+"decoding-concurrency", 0, "Maximum number of goroutines that can be used to decode samples. 0 defaults to GOMAXPROCS / 2.")
2527
}
2628

2729
func (cfg *ThanosEngineConfig) Validate() error {

pkg/engine/engine.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ func New(opts promql.EngineOpts, thanosEngineCfg ThanosEngineConfig, reg prometh
6464
var thanosEngine *thanosengine.Engine
6565
if thanosEngineCfg.Enabled {
6666
thanosEngine = thanosengine.New(thanosengine.Opts{
67-
EngineOpts: opts,
68-
LogicalOptimizers: thanosEngineCfg.LogicalOptimizers,
69-
EnableAnalysis: true,
70-
EnableXFunctions: thanosEngineCfg.EnableXFunctions,
67+
EngineOpts: opts,
68+
LogicalOptimizers: thanosEngineCfg.LogicalOptimizers,
69+
EnableAnalysis: true,
70+
EnableXFunctions: thanosEngineCfg.EnableXFunctions,
71+
DecodingConcurrency: thanosEngineCfg.DecodingConcurrency,
7172
})
7273
}
7374

schemas/cortex-config-schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5928,6 +5928,12 @@
59285928
},
59295929
"thanos_engine": {
59305930
"properties": {
5931+
"decoding_concurrency": {
5932+
"default": 0,
5933+
"description": "Maximum number of goroutines that can be used to decode samples. 0 defaults to GOMAXPROCS / 2.",
5934+
"type": "number",
5935+
"x-cli-flag": "querier.decoding-concurrency"
5936+
},
59315937
"enable_x_functions": {
59325938
"default": false,
59335939
"description": "Enable xincrease, xdelta, xrate etc from Thanos engine.",
@@ -6943,6 +6949,12 @@
69436949
},
69446950
"thanos_engine": {
69456951
"properties": {
6952+
"decoding_concurrency": {
6953+
"default": 0,
6954+
"description": "Maximum number of goroutines that can be used to decode samples. 0 defaults to GOMAXPROCS / 2.",
6955+
"type": "number",
6956+
"x-cli-flag": "ruler.decoding-concurrency"
6957+
},
69466958
"enable_x_functions": {
69476959
"default": false,
69486960
"description": "Enable xincrease, xdelta, xrate etc from Thanos engine.",

0 commit comments

Comments
 (0)