Skip to content

Commit

Permalink
using constants for flags
Browse files Browse the repository at this point in the history
Signed-off-by: metonymic-smokey <ahuja.aditi@gmail.com>
  • Loading branch information
metonymic-smokey committed Sep 20, 2021
1 parent 356c8d3 commit fdaf2b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/thanos/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ import (
"github.com/thanos-io/thanos/pkg/ui"
)

const (
promqlNegativeOffset = "promql-negative-offset"
promqlAtModifier = "promql-at-modifier"
)

// registerQuery registers a query command.
func registerQuery(app *extkingpin.App) {
comp := component.Query
Expand Down Expand Up @@ -146,7 +151,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 promql-negative-offset and promql-at-modifier.").Default("").Strings()
featureList := cmd.Flag("enable-feature", "Comma separated experimental feature names to enable.The current list of features is "+promqlNegativeOffset+" and "+promqlAtModifier+".").Default("").Strings()

enableExemplarPartialResponse := cmd.Flag("exemplar.partial-response", "Enable partial response for exemplar endpoint. --no-exemplar.partial-response for disabling.").
Hidden().Default("true").Bool()
Expand All @@ -167,10 +172,10 @@ func registerQuery(app *extkingpin.App) {

var enableNegativeOffset, enableAtModifier bool
for _, feature := range *featureList {
if feature == "promql-negative-offset" {
if feature == promqlNegativeOffset {
enableNegativeOffset = true
}
if feature == "promql-at-modifier" {
if feature == promqlAtModifier {
enableAtModifier = true
}
}
Expand Down

0 comments on commit fdaf2b1

Please sign in to comment.