Skip to content
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
7 changes: 7 additions & 0 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ type Config struct {
MaxSamples int
IngesterMaxQueryLookback time.Duration

// The default evaluation interval for the promql engine.
// Needs to be configured for subqueries to work as it is the default
// step if not specified.
DefaultEvaluationInterval time.Duration

// For testing, to prevent re-registration of metrics in the promql engine.
metricsRegisterer prometheus.Registerer
}
Expand All @@ -43,6 +48,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
f.BoolVar(&cfg.IngesterStreaming, "querier.ingester-streaming", false, "Use streaming RPCs to query ingester.")
f.IntVar(&cfg.MaxSamples, "querier.max-samples", 50e6, "Maximum number of samples a single query can load into memory.")
f.DurationVar(&cfg.IngesterMaxQueryLookback, "querier.query-ingesters-within", 0, "Maximum lookback beyond which queries are not sent to ingester. 0 means all queries are sent to ingester.")
f.DurationVar(&cfg.DefaultEvaluationInterval, "querier.default-evaluation-interval", time.Minute, "The default evaluation interval or step size for subqueries.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would slightly prefer this defaults to 15 seconds, but not going to make a big thing of it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for it in prometheus is 1m hence I made it 1m here too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sticking with Prometheus defaults seems the right thing to do.

cfg.metricsRegisterer = prometheus.DefaultRegisterer
}

Expand Down Expand Up @@ -79,6 +85,7 @@ func New(cfg Config, distributor Distributor, chunkStore ChunkStore) (storage.Qu
return newLazyQuerier(querier), nil
})

promql.SetDefaultEvaluationInterval(cfg.DefaultEvaluationInterval)
engine := promql.NewEngine(promql.EngineOpts{
Logger: util.Logger,
Reg: cfg.metricsRegisterer,
Expand Down