Skip to content

Commit 9dbff30

Browse files
engine: make it possible to write lookback delta and stats (#502)
LookbackDelta and Stats were unexported fields of the struct. We cannot write to them like this so we need to export them. Signed-off-by: Michael Hoffmann <[email protected]> Co-authored-by: Michael Hoffmann <[email protected]>
1 parent 40b4c4c commit 9dbff30

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

engine/engine.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ func (o Opts) getLogicalOptimizers() []logicalplan.Optimizer {
101101

102102
// QueryOpts implements promql.QueryOpts but allows to override more engine default options.
103103
type QueryOpts struct {
104-
lookbackDelta time.Duration
105-
106-
enablePerStepStats bool
104+
// These values are used to implement promql.QueryOpts, they have weird "Param" suffix because
105+
// they are accessed by methods of the same name.
106+
LookbackDeltaParam time.Duration
107+
EnablePerStepStatsParam bool
107108

108109
// DecodingConcurrency can be used to override the DecodingConcurrency engine setting.
109110
DecodingConcurrency int
@@ -112,16 +113,16 @@ type QueryOpts struct {
112113
EnablePartialResponses bool
113114
}
114115

115-
func (opts QueryOpts) LookbackDelta() time.Duration { return opts.lookbackDelta }
116-
func (opts QueryOpts) EnablePerStepStats() bool { return opts.enablePerStepStats }
116+
func (opts QueryOpts) LookbackDelta() time.Duration { return opts.LookbackDeltaParam }
117+
func (opts QueryOpts) EnablePerStepStats() bool { return opts.EnablePerStepStatsParam }
117118

118119
func fromPromQLOpts(opts promql.QueryOpts) *QueryOpts {
119120
if opts == nil {
120121
return &QueryOpts{}
121122
}
122123
return &QueryOpts{
123-
lookbackDelta: opts.LookbackDelta(),
124-
enablePerStepStats: opts.EnablePerStepStats(),
124+
LookbackDeltaParam: opts.LookbackDelta(),
125+
EnablePerStepStatsParam: opts.EnablePerStepStats(),
125126
}
126127
}
127128

0 commit comments

Comments
 (0)