Skip to content

Commit b73398a

Browse files
committed
Adding DecodingConcurrency config flag for ThanosEngine
Signed-off-by: Paurush Garg <[email protected]>
1 parent 195e99f commit b73398a

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pkg/engine/config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ var supportedOptimizers = []string{"default", "all", "propagate-matchers", "sort
1212

1313
// 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

0 commit comments

Comments
 (0)