diff --git a/docs/feature_flags.md b/docs/feature_flags.md index 402feb44f8..4243ab9f2b 100644 --- a/docs/feature_flags.md +++ b/docs/feature_flags.md @@ -187,7 +187,19 @@ state is mutex guarded. Cumulative-only OTLP requests are not affected. `--enable-feature=promql-duration-expr` -With this flag, arithmetic expressions can also be used in time durations. The following operators are supported: +With this flag, arithmetic expressions can be used in time durations in range queries and offset durations. For example: + +In range queries: + rate(http_requests_total[5m * 2]) # 10 minute range + rate(http_requests_total[(5+2) * 1m]) # 7 minute range + +In offset durations: + http_requests_total offset (1h / 2) # 30 minute offset + http_requests_total offset ((2 ^ 3) * 1m) # 8 minute offset + +Note: Duration expressions are not supported in the @ timestamp operator. + +The following operators are supported: * `+` - addition * `-` - subtraction @@ -196,13 +208,13 @@ With this flag, arithmetic expressions can also be used in time durations. The f * `%` - modulo * `^` - exponentiation -Examples: +Examples of equivalent durations: - 5m * 2 # Equivalent to 10m or 600s - 10m - 1m # Equivalent to 9m or 540s - (5+2) * 1m # Equivalent to 7m or 420s - 1h / 2 # Equivalent to 30m or 1800s - 4h % 3h # Equivalent to 1h or 3600s - (2 ^ 3) * 1m # Equivalent to 8m or 480s +* `5m * 2` is the equivalent to `10m` or `600s` +* `10m - 1m` is the equivalent to `9m` or `540s` +* `(5+2) * 1m` is the equivalent to `7m` or `420s` +* `1h / 2` is the equivalent to `30m` or `1800s` +* `4h % 3h` is the equivalent to `1h` or `3600s` +* `(2 ^ 3) * 1m` is the equivalent to `8m` or `480s` [d2c]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/deltatocumulativeprocessor