From 54434f6e497a6e479ba460e552d564683616fbef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 18 Mar 2022 09:53:37 +0200 Subject: [PATCH] query: promote negative offset and at-modifier to stable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's follow https://github.com/prometheus/prometheus/pull/10121 and make these into stable features as well. Signed-off-by: Giedrius Statkevičius --- CHANGELOG.md | 1 + cmd/thanos/query.go | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5294355905a..737aeee788b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#5218](https://github.com/thanos-io/thanos/pull/5218) Tools: Run bucket downsample tools continuously. - [#5224](https://github.com/thanos-io/thanos/pull/5224) Receive: Remove sort on label hashing - [#5231](https://github.com/thanos-io/thanos/pull/5231) Tools: Bucket verify tool ignores blocks with deletion markers. +- [#5244](https://github.com/thanos-io/thanos/pull/5244) Query: Promote negative offset and `@` modifier to stable features as per Prometheus [#10121](https://github.com/prometheus/prometheus/pull/10121). ### Removed diff --git a/cmd/thanos/query.go b/cmd/thanos/query.go index 25f7c611333..1e5d2a13b01 100644 --- a/cmd/thanos/query.go +++ b/cmd/thanos/query.go @@ -56,9 +56,9 @@ import ( ) const ( + queryPushdown = "query-pushdown" promqlNegativeOffset = "promql-negative-offset" promqlAtModifier = "promql-at-modifier" - queryPushdown = "query-pushdown" ) // registerQuery registers a query command. @@ -161,7 +161,7 @@ func registerQuery(app *extkingpin.App) { enableMetricMetadataPartialResponse := cmd.Flag("metric-metadata.partial-response", "Enable partial response for metric metadata endpoint. --no-metric-metadata.partial-response for disabling."). Hidden().Default("true").Bool() - featureList := cmd.Flag("enable-feature", "Comma separated experimental feature names to enable.The current list of features is "+promqlNegativeOffset+", "+promqlAtModifier+" and "+queryPushdown+".").Default("").Strings() + featureList := cmd.Flag("enable-feature", "Comma separated experimental feature names to enable.The current list of features is "+queryPushdown+".").Default("").Strings() enableExemplarPartialResponse := cmd.Flag("exemplar.partial-response", "Enable partial response for exemplar endpoint. --no-exemplar.partial-response for disabling."). Hidden().Default("true").Bool() @@ -182,16 +182,16 @@ func registerQuery(app *extkingpin.App) { return errors.Wrap(err, "parse federation labels") } - var enableNegativeOffset, enableAtModifier, enableQueryPushdown bool + var enableQueryPushdown bool for _, feature := range *featureList { - if feature == promqlNegativeOffset { - enableNegativeOffset = true + if feature == queryPushdown { + enableQueryPushdown = true } if feature == promqlAtModifier { - enableAtModifier = true + level.Warn(logger).Log("msg", "This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", promqlAtModifier) } - if feature == queryPushdown { - enableQueryPushdown = true + if feature == promqlNegativeOffset { + level.Warn(logger).Log("msg", "This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", promqlNegativeOffset) } } @@ -280,8 +280,6 @@ func registerQuery(app *extkingpin.App) { *strictStores, *strictEndpoints, *webDisableCORS, - enableAtModifier, - enableNegativeOffset, enableQueryPushdown, *alertQueryURL, component.Query, @@ -349,8 +347,6 @@ func runQuery( strictStores []string, strictEndpoints []string, disableCORS bool, - enableAtModifier bool, - enableNegativeOffset bool, enableQueryPushdown bool, alertQueryURL string, comp component.Component, @@ -480,8 +476,8 @@ func runQuery( NoStepSubqueryIntervalFn: func(int64) int64 { return defaultEvaluationInterval.Milliseconds() }, - EnableNegativeOffset: enableNegativeOffset, - EnableAtModifier: enableAtModifier, + EnableNegativeOffset: true, + EnableAtModifier: true, } )