From 6ce1d23d9d14179aa723b6b891757ff997428c97 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Tue, 17 Dec 2024 09:04:27 +0000 Subject: [PATCH] engine: make it possible to write lookback delta and stats Signed-off-by: Michael Hoffmann --- engine/engine.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/engine/engine.go b/engine/engine.go index 3b7b418c..152947e0 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -101,9 +101,10 @@ func (o Opts) getLogicalOptimizers() []logicalplan.Optimizer { // QueryOpts implements promql.QueryOpts but allows to override more engine default options. type QueryOpts struct { - lookbackDelta time.Duration - - enablePerStepStats bool + // These values are used to implement promql.QueryOpts, they have weird "Param" suffix because + // they are accessed by methods of the same name. + LookbackDeltaParam time.Duration + EnablePerStepStatsParam bool // DecodingConcurrency can be used to override the DecodingConcurrency engine setting. DecodingConcurrency int @@ -112,16 +113,16 @@ type QueryOpts struct { EnablePartialResponses bool } -func (opts QueryOpts) LookbackDelta() time.Duration { return opts.lookbackDelta } -func (opts QueryOpts) EnablePerStepStats() bool { return opts.enablePerStepStats } +func (opts QueryOpts) LookbackDelta() time.Duration { return opts.LookbackDeltaParam } +func (opts QueryOpts) EnablePerStepStats() bool { return opts.EnablePerStepStatsParam } func fromPromQLOpts(opts promql.QueryOpts) *QueryOpts { if opts == nil { return &QueryOpts{} } return &QueryOpts{ - lookbackDelta: opts.LookbackDelta(), - enablePerStepStats: opts.EnablePerStepStats(), + LookbackDeltaParam: opts.LookbackDelta(), + EnablePerStepStatsParam: opts.EnablePerStepStats(), } }