promql/features
This check verifies that PromQL queries don’t use features that require --enable-feature=... flags that are not enabled on the Prometheus server this rule would be deployed to.
Some PromQL features are experimental and must be explicitly enabled on the Prometheus server. If a rule uses such features but the target Prometheus server doesn’t have the required feature flags enabled, the query will fail at evaluation time.
Pint will query the flags API of each configured Prometheus server to get the list of enabled feature flags and compare it against features required by the query. It will also query the build info API to determine the running Prometheus version and report when a feature requires a newer version than the one running.
Currently detected features:
promql-experimental-functions- required when using experimental PromQL functions such asmad_over_time,sort_by_label,sort_by_label_desc,info,double_exponential_smoothing,limitk,limit_ratio, and others.promql-duration-expr- required when using arithmetic expressions in time durations.promql-extended-range-selectors- required when usinganchoredorsmoothedrange selector modifiers.promql-binop-fill-modifiers- required when usingfill()binary operator modifier.
See Prometheus feature flags documentation for details on each feature.
Configuration
This check doesn’t have any configuration options.
How to enable it
This check is enabled by default for all configured Prometheus servers.
Example:
prometheus "prod" {
uri = "https://prometheus-prod.example.com"
timeout = "60s"
include = [
"rules/prod/.*",
"rules/common/.*",
]
}
prometheus "dev" {
uri = "https://prometheus-dev.example.com"
timeout = "30s"
include = [
"rules/dev/.*",
"rules/common/.*",
]
}
How to disable it
You can disable this check globally by adding this config block:
checks {
disabled = ["promql/features"]
}
You can also disable it for all rules inside given file by adding a comment anywhere in that file. Example:
# pint file/disable promql/features
Or you can disable it per rule by adding a comment to it. Example:
# pint disable promql/features
If you want to disable only individual instances of this check you can add a more specific comment.
# pint disable promql/features($prometheus)
Where $prometheus is the name of Prometheus server to disable.
Example:
# pint disable promql/features(prod)
How to snooze it
You can disable this check until given time by adding a comment to it. Example:
# pint snooze $TIMESTAMP promql/features
Where $TIMESTAMP is either use RFC3339 formatted or YYYY-MM-DD. Adding this comment will disable promql/features until $TIMESTAMP, after that check will be re-enabled.