From e4a9fa57247fbe9199eac569962415b95ba87d39 Mon Sep 17 00:00:00 2001 From: xjewer Date: Thu, 11 Apr 2019 18:09:57 +0100 Subject: [PATCH] query: set default evaluation interval (#1028) Subqueries allows request with no [specified resolution](https://prometheus.io/blog/2019/01/28/subquery-support/). Set it up and allow to configure default evaluation interval. --- cmd/thanos/query.go | 4 ++++ docs/components/query.md | 3 +++ 2 files changed, 7 insertions(+) diff --git a/cmd/thanos/query.go b/cmd/thanos/query.go index c0ba380192..1e229bc789 100644 --- a/cmd/thanos/query.go +++ b/cmd/thanos/query.go @@ -97,6 +97,8 @@ func registerQuery(m map[string]setupFunc, app *kingpin.Application, name string enablePartialResponse := cmd.Flag("query.partial-response", "Enable partial response for queries if no partial_response param is specified."). Default("true").Bool() + defaultEvaluationInterval := modelDuration(cmd.Flag("query.default-evaluation-interval", "Set default evaluation interval for sub queries.").Default("1m")) + storeResponseTimeout := modelDuration(cmd.Flag("store.response-timeout", "If a Store doesn't send any data in this specified duration then a Store will be ignored and partial data will be returned if it's enabled. 0 disables timeout.").Default("0ms")) m[name] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error { @@ -127,6 +129,8 @@ func registerQuery(m map[string]setupFunc, app *kingpin.Application, name string fileSD = file.NewDiscovery(conf, logger) } + promql.SetDefaultEvaluationInterval(time.Duration(*defaultEvaluationInterval)) + return runQuery( g, logger, diff --git a/docs/components/query.md b/docs/components/query.md index 0558f47587..427ae15562 100644 --- a/docs/components/query.md +++ b/docs/components/query.md @@ -301,6 +301,9 @@ Flags: if no max_source_resolution param is specified. --query.partial-response Enable partial response for queries if no partial_response param is specified. + --query.default-evaluation-interval=1m + Set default evaluation interval for sub + queries. --store.response-timeout=0ms If a Store doesn't send any data in this specified duration then a Store will be ignored