diff --git a/cmd/promtool/main.go b/cmd/promtool/main.go
index 16cc40233a..17035bb3b4 100644
--- a/cmd/promtool/main.go
+++ b/cmd/promtool/main.go
@@ -314,7 +314,7 @@ func main() {
promQLLabelsDeleteQuery := promQLLabelsDeleteCmd.Arg("query", "PromQL query.").Required().String()
promQLLabelsDeleteName := promQLLabelsDeleteCmd.Arg("name", "Name of the label to delete.").Required().String()
- featureList := app.Flag("enable-feature", "Comma separated feature names to enable. Valid options: promql-experimental-functions, promql-delayed-name-removal. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details").Default("").Strings()
+ featureList := app.Flag("enable-feature", "Comma separated feature names to enable. Valid options: promql-experimental-functions, promql-delayed-name-removal, promql-duration-expr, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details").Default("").Strings()
documentationCmd := app.Command("write-documentation", "Generate command line documentation. Internal use.").Hidden()
@@ -351,6 +351,10 @@ func main() {
parser.EnableExperimentalFunctions = true
case "promql-delayed-name-removal":
promqlEnableDelayedNameRemoval = true
+ case "promql-duration-expr":
+ parser.ExperimentalDurationExpr = true
+ case "promql-extended-range-selectors":
+ parser.EnableExtendedRangeSelectors = true
case "":
continue
default:
diff --git a/cmd/promtool/main_test.go b/cmd/promtool/main_test.go
index 9e6e7268f7..68d145795a 100644
--- a/cmd/promtool/main_test.go
+++ b/cmd/promtool/main_test.go
@@ -655,7 +655,7 @@ func TestCheckRulesWithFeatureFlag(t *testing.T) {
// As opposed to TestCheckRules calling CheckRules directly we run promtool
// so the feature flag parsing can be tested.
- args := []string{"-test.main", "--enable-feature=promql-experimental-functions", "check", "rules", "testdata/features.yml"}
+ args := []string{"-test.main", "--enable-feature=promql-experimental-functions", "--enable-feature=promql-duration-expr", "--enable-feature=promql-extended-range-selectors", "check", "rules", "testdata/features.yml"}
tool := exec.Command(promtoolPath, args...)
err := tool.Run()
require.NoError(t, err)
diff --git a/cmd/promtool/testdata/features.yml b/cmd/promtool/testdata/features.yml
index 769f8362bf..946e07d0d7 100644
--- a/cmd/promtool/testdata/features.yml
+++ b/cmd/promtool/testdata/features.yml
@@ -1,6 +1,10 @@
groups:
- name: features
rules:
- - record: x
- # We don't expect anything from this, just want to check the function parses.
+ # We don't expect anything from these, just want to check the syntax parses.
+ - record: promql-experimental-functions
expr: sort_by_label(up, "instance")
+ - record: promql-duration-expr
+ expr: rate(up[1m * 2])
+ - record: promql-extended-range-selectors
+ expr: rate(up[1m] anchored)
diff --git a/docs/command-line/promtool.md b/docs/command-line/promtool.md
index f6737bc37f..e8ffa75aaa 100644
--- a/docs/command-line/promtool.md
+++ b/docs/command-line/promtool.md
@@ -12,7 +12,7 @@ Tooling for the Prometheus monitoring system.
| -h, --help | Show context-sensitive help (also try --help-long and --help-man). |
| --version | Show application version. |
| --experimental | Enable experimental commands. |
-| --enable-feature ... | Comma separated feature names to enable. Valid options: promql-experimental-functions, promql-delayed-name-removal. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details |
+| --enable-feature ... | Comma separated feature names to enable. Valid options: promql-experimental-functions, promql-delayed-name-removal, promql-duration-expr, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details |