Backend: Merge master into the backend branch (#845)

* CI: fix shellcheck issues (#789)

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* annotations: fix options in grafana 6.x, fix #813

* fix function editor in Grafana 6.4, closes #810

* add typings for grafana packages

* Add $__range_series variable for calculating function over the whole series, #531

* fix tests

* Don't set alert styles for react panels, fix #823

* docs: add range variables

* docs: percentile reference

* fix codespell

Co-authored-by: Mario Trangoni <mario@mariotrangoni.de>
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
This commit is contained in:
vignesh-reddy
2019-12-30 01:45:47 -06:00
committed by Alexander Zobnin
parent b4b0c5b8f4
commit c300debe35
15 changed files with 499 additions and 52 deletions

View File

@@ -1,6 +1,23 @@
Functions reference
===================
## Functions Variables
There are some built-in template variables available for using in functions:
- `$__range_ms` - panel time range in ms
- `$__range_s` - panel time range in seconds
- `$__range` - panel time range, string representation (`30s`, `1m`, `1h`)
- `$__range_series` - invoke function over all series values
Examples:
```
groupBy($__range, avg)
percentile($__range_series, 95) - 95th percentile over all values
```
---
## Transform
@@ -10,7 +27,7 @@ Functions reference
groupBy(interval, function)
```
Takes each timeseries and consolidate its points falled in given _interval_ into one point using _function_, which can be one of: _avg_, _min_, _max_, _median_.
Takes each timeseries and consolidate its points fallen in the given _interval_ into one point using _function_, which can be one of: _avg_, _min_, _max_, _median_.
Examples:
```
@@ -124,7 +141,7 @@ Replaces `null` values with N
aggregateBy(interval, function)
```
Takes all timeseries and consolidate all its points falled in given _interval_ into one point using _function_, which can be one of: _avg_, _min_, _max_, _median_.
Takes all timeseries and consolidate all its points fallen in the given _interval_ into one point using _function_, which can be one of: _avg_, _min_, _max_, _median_.
Examples:
```
@@ -142,6 +159,20 @@ This will add metrics together and return the sum at each datapoint. This method
---
### _percentile_
```
percentile(interval, N)
```
Takes all timeseries and consolidate all its points fallen in the given _interval_ into one point by Nth percentile.
Examples:
```
percentile(1h, 99)
percentile($__range_series, 95) - 95th percentile over all values
```
---
### _average_
```
average(interval)