Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add engine param to thanos engine constructor #228

Merged
merged 1 commit into from
Apr 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ type Opts struct {
// EnableXFunctions enables custom xRate, xIncrease and xDelta functions.
// This will default to false.
EnableXFunctions bool

// FallbackEngine
Engine v1.QueryEngine
}

func (o Opts) getLogicalOptimizers() []logicalplan.Optimizer {
Expand Down Expand Up @@ -193,8 +196,15 @@ func New(opts Opts) *compatibilityEngine {
),
}

var engine v1.QueryEngine
if opts.Engine == nil {
engine = promql.NewEngine(opts.EngineOpts)
} else {
engine = opts.Engine
}

return &compatibilityEngine{
prom: promql.NewEngine(opts.EngineOpts),
prom: engine,

debugWriter: opts.DebugWriter,
disableFallback: opts.DisableFallback,
Expand All @@ -208,7 +218,7 @@ func New(opts Opts) *compatibilityEngine {
}

type compatibilityEngine struct {
prom *promql.Engine
prom v1.QueryEngine

debugWriter io.Writer

Expand Down