Prometheus: add $__rate_interval variable (#26937)

* Add rate interval variable to prometheus data source

* Add tests + auto complete

* Fix prometheus tests

* Add doc

* Modify test title

* Modify kbn method name after merge
This commit is contained in:
Zoltán Bedi
2020-08-13 18:58:40 +02:00
committed by GitHub
parent f9f60c9193
commit aae25c5308
5 changed files with 40 additions and 1 deletions
@@ -110,6 +110,9 @@ Populate a variable with the instances having a certain state over the time rang
Query: query_result(max_over_time(<metric>[${__range_s}s]) != <state>)
Regex:
```
### Using `$__rate_interval` variable
The `$__rate_interval` variable is meant to be used in the rate function. It is defined as max( `$__interval` + _Scrape interval_, 4 * _Scrape interval_), where _Scrape interval_ is the Min step setting (AKA query_interval, a setting per PromQL query), if any is set, and otherwise the _Scrape interval_ as set in the Prometheus data source (but ignoring any Min interval setting in the panel, because the latter is modified by the resolution setting).
### Using variables in queries