Prometheus: make $__range more precise (#21722)

* Make $__range more precise in Prometheus

It is now always equivalent to `${__range_s}s`, rather than rounding
down to an integer multiple of the biggest possible unit. For example,
a range of 47 hours is now represented as `169200s` rather than `1d`.

Closes #21689.

* Update a unit test to match new __range calc
This commit is contained in:
Bruce Merry
2020-02-11 15:28:06 +02:00
committed by GitHub
parent e612d7a2f9
commit 02c779cfa3
3 changed files with 3 additions and 4 deletions

View File

@@ -111,7 +111,7 @@ Query: query_result(topk(5, sum(rate(http_requests_total[$__range])) by (instanc
Regex: /"([^"]+)"/
```
Populate a variable with the instances having a certain state over the time range shown in the dashboard, using the more precise `$__range_s`:
Populate a variable with the instances having a certain state over the time range shown in the dashboard, using `$__range_s`:
```
Query: query_result(max_over_time(<metric>[${__range_s}s]) != <state>)