diff --git a/CHANGELOG.md b/CHANGELOG.md index 76137ab4de..1e888c4904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#6887](https://github.com/thanos-io/thanos/pull/6887) Query Frontend: *breaking :warning:* Add tenant label to relevant exported metrics. Note that this change may cause some pre-existing custom dashboard queries to be incorrect due to the added label. - [#7028](https://github.com/thanos-io/thanos/pull/7028) Query|Query Frontend: Add new `--query-frontend.enable-x-functions` flag to enable experimental extended functions. - [#6884](https://github.com/thanos-io/thanos/pull/6884) Tools: Add upload-block command to upload blocks to object storage. +- [#7080](https://github.com/thanos-io/thanos/pull/7080) Rule: Added a new flag for max-source-resolution. ### Changed diff --git a/cmd/thanos/rule.go b/cmd/thanos/rule.go index dce39cbf97..0100274aed 100644 --- a/cmd/thanos/rule.go +++ b/cmd/thanos/rule.go @@ -95,16 +95,17 @@ type ruleConfig struct { rwConfig *extflag.PathOrContent - resendDelay time.Duration - evalInterval time.Duration - outageTolerance time.Duration - forGracePeriod time.Duration - ruleFiles []string - objStoreConfig *extflag.PathOrContent - dataDir string - lset labels.Labels - ignoredLabelNames []string - storeRateLimits store.SeriesSelectLimits + resendDelay time.Duration + evalInterval time.Duration + outageTolerance time.Duration + forGracePeriod time.Duration + ruleFiles []string + maxSourceResolution string + objStoreConfig *extflag.PathOrContent + dataDir string + lset labels.Labels + ignoredLabelNames []string + storeRateLimits store.SeriesSelectLimits } type Expression struct { @@ -139,6 +140,7 @@ func registerRule(app *extkingpin.App) { walCompression := cmd.Flag("tsdb.wal-compression", "Compress the tsdb WAL.").Default("true").Bool() cmd.Flag("data-dir", "data directory").Default("data/").StringVar(&conf.dataDir) + cmd.Flag("max-source-resolution", "Max resolution wanted for the data queried.").StringVar(&conf.maxSourceResolution) cmd.Flag("rule-file", "Rule files that should be used by rule manager. Can be in glob format (repeated). Note that rules are not automatically detected, use SIGHUP or do HTTP POST /-/reload to re-read them."). Default("rules/").StringsVar(&conf.ruleFiles) cmd.Flag("resend-delay", "Minimum amount of time to wait before resending an alert to Alertmanager."). @@ -626,7 +628,7 @@ func runRule( OutageTolerance: conf.outageTolerance, ForGracePeriod: conf.forGracePeriod, }, - queryFuncCreator(logger, queryClients, promClients, grpcEndpointSet, metrics.duplicatedQuery, metrics.ruleEvalWarnings, conf.query.httpMethod, conf.query.doNotAddThanosParams), + queryFuncCreator(logger, queryClients, promClients, grpcEndpointSet, metrics.duplicatedQuery, metrics.ruleEvalWarnings, conf.query.httpMethod, conf.query.doNotAddThanosParams, conf.maxSourceResolution), conf.lset, // In our case the querying URL is the external URL because in Prometheus // --web.external-url points to it i.e. it points at something where the user @@ -891,6 +893,7 @@ func queryFuncCreator( ruleEvalWarnings *prometheus.CounterVec, httpMethod string, doNotAddThanosParams bool, + maxSourceResolution string, ) func(partialResponseStrategy storepb.PartialResponseStrategy) rules.QueryFunc { // queryFunc returns query function that hits the HTTP query API of query peers in randomized order until we get a result @@ -919,6 +922,7 @@ func queryFuncCreator( PartialResponseStrategy: partialResponseStrategy, Method: httpMethod, DoNotAddThanosParams: doNotAddThanosParams, + MaxSourceResolution: maxSourceResolution, }) span.Finish() diff --git a/docs/components/rule.md b/docs/components/rule.md index 044148c3ba..80c7d8cbc9 100644 --- a/docs/components/rule.md +++ b/docs/components/rule.md @@ -370,6 +370,8 @@ Flags: --log.format=logfmt Log format to use. Possible options: logfmt or json. --log.level=info Log filtering level. + --max-source-resolution=MAX-SOURCE-RESOLUTION + Max resolution wanted for the data queried. --objstore.config= Alternative to 'objstore.config-file' flag (mutually exclusive). Content of