-
Notifications
You must be signed in to change notification settings - Fork 5
Transforms
[User Guide](User Guide)
Metric query grammar includes a wide variety of utility transforms. Transforms take time-series data as the result of a metric query or of another transform. Transforms can also require constants as parameters. Constant values are specified by a $ prefix.
In the syntax examples, the <time_series> token represents the result of either a <time_series> or a . All metric queries and transforms are multiple input and multiple output, however they return one or more time-series in the result set, depending on the behavior of specific transforms.
Transforms | Description |
---|---|
ABOVE | Culls all input metrics whose set of data point values, when evaluated, are not above the numerical limit. |
ABSOLUTE | Converts the data point values to their corresponding absolute value. |
ALIAS | Transforms the name one or more metrics. |
AVERAGE | Calculates the average of all values at each time stamp. |
BELOW | Culls all input metrics whose set of data point values are not below the numerical limit. |
CONSECUTIVE | Returns all data points that are consecutive. |
COUNT | Calculates a metric having a set of time stamps. |
CULL_ABOVE | Removes data points from metrics if the value is above a limit. |
CULL_BELOW | Removes data points from metrics id the value is below a limit |
DERIVATIVE | Calculates the discrete time derivative. |
DEVIATION | Calculates the standard deviation per time stamp for a collection of input series, or the standard deviation for all data points for a single input series. |
DIFF | Calculates an arithmetic difference. |
DIFF_V | Calculates and arithmetic difference using a vector of subtrahends to be subtracted from each input time series. |
DIVIDE | Calculates a quotient. |
DIVIDE_V | Calculates a quotient using a vector of divisors to be divided into each time series. |
DOWNSAMPLE | Down samples one or more metrics. |
EXCLUDE | Culls metrics based on the matching of regular expression against the metric identifier. |
FILL | Creates additional data points to fill gaps. |
FILL_CALCULATE | Creates constant line based on the calculated value. |
GROUP | Calculates the union of all data points of time series that match the regular exception. Also, having the time periods that calculate overlap as the intersection of the time series. |
HIGHEST | Evaluates all input metrics based on an evaluation of the metric data point values, returning top metrics having the highest evaluated value. |
INCLUDE | Retains metrics based on the matching of a regular expression against the metrics identifier. |
INTEGRAL | Calculates the discrete time integral. |
JOIN | Joins multiple lists of metrics into a single list. |
LIMIT | Returns a subset input metrics in stable order from the head of the list not to exceed the specified limit. |
LOG | Calculates the logarithm according to the specified base. |
LOWEST | Evaluates all input metrics based on an evaluation of the metric data point values, returning top metrics having the lowest evaluated value. |
MAX | For each timestamp in the input range, calculate the maximum value across all input metrics. |
MIN | For each timestamp in the input range, calculate the minimum value across all input metrics. |
MOVING | Evaluates input metrics using a moving window. |
NORMALIZE | Normalizes the data point values of time series. |
NORMALIZE_V | Normalizes the data point value of time series using a vector of unit normal's to be applied to each input time series. |
PERCENTILE | Calculates the Nth percentile. |
PROPAGATE | Forward fills gaps with the last known value at the start(earliest occurring time) of the gap. |
RANGE | Calculates the difference between the maximum and minimum values at each timestamp. |
SCALE | Calculates a product. |
SCALE_V | Calculates a product using a vector of multipliers to be multiplied into each input time series. |
SHIFT | Shifts the timestamp for each data point by the specified constant. |
SORT | Sorts a list of metrics. |
SUM | Calculates an arithmetic sum. |
SUM_V | Calculates an arithmetic sum using a vector of addends to be summed with each input time series. |
UNION | Perform the union of all data points for the given time series. |
##ABOVE Culls all input metrics whose set of data point values, when evaluated, are not above the numerical limit. Type indicates the type of evaluation to perform. Must be one of 'avg', 'min', 'max', 'recent'. All evaluation types consider all data points for a metric with the exception of 'recent' which only evaluates the most recent data point in the series. If the type is not specified, ‘avg’ is used.
ABOVE(<time_series>[,<time_series>]*,<limit>,<type>)
ABOVE(<time_series>[,<time_series>]*,<limit>)
#####Example 1: ABOVE(-1d:scope:metric:avg:4h-avg, $0.5, $avg)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "0"
}
}
Output:
[]
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}
Output:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "1"
}
}
Output:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "1"
}
}
##ABSOLUTE
Converts the data point values to their corresponding absolute value.
ABSOLUTE(<time_series>[,<time_series>]*)
#####Example: ABSOLUTE(-1d:scope:metric:avg:4h-avg)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "109.6666666666666",
"1444392000000": "114.3333333333334",
"1444406400000": "-37.5",
"1444420800000": "-34.5",
"1444435200000": "-15.5",
"1444449600000": "1.0"
}
}
Output:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "109.6666666666666",
"1444392000000": "114.3333333333334",
"1444406400000": "37.5",
"1444420800000": "34.5",
"1444435200000": "15.5",
"1444449600000": "1.0"
}
}
##ALIAS
Transforms the name of one or more metrics.
ALIAS(<time_series)[,<time-series>]*)
Input | Output |
---|---|
ALIAS(-1d:scope:metric:avg:4h-avg, $new_metric, $literal) | -1d:scope:new_metric:avg:4h-avg (Changes the output metric name to new_metric) |
ALIAS(-1d:scope:metric:avg:4h-avg, $/metric/new_metric/, $regex) | -1d:scope:new_metric:avg:4h-avg (Replaces “metric” in input metric name with “new_metric” in output metric name) |
ALIAS(-1d:scope:old_metric:avg:4h-avg, $/old/new/, $regex) | -1d:scope:new_metric:avg:4h-avg (Replaces “old” in input metric name with “new” in output metric name |
##AVERAGE Calculates the average of all values at each timestamp.
#####Average Example
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "2",
"1444406400000": "2",
"1444420800000": "2",
"1444435200000": "2",
"1444449600000": "2"
}
}]
Output:
{
"scope": "AVERAGE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1.5",
"1444392000000": "1.5",
"1444406400000": "1.5",
"1444420800000": "1.5",
"1444435200000": "1.5",
"1444449600000": "1.5"
}
##BELOW Culls all input metrics whose set of data point values, when evaluated, are not below the numerical limit. Type indicates the type of evaluation to perform. Must be one of 'avg', 'min', 'max', or 'recent'. All evaluation types consider all data points for metics with the exception of 'recent', which only evaluats the most recent data point in the series. If the type is not specified, 'avg' is used.
BELOW(<time_series>[,<time_series>]*,<limit>,<type>)
BELOW(<time_series>[,<time_series>]*,<limit>)
#####Example 1: BELOW(-1d:scope:metric:avg:4h-avg,$0.5,$avg)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "0"
}
}
Output:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "0"
}
}
#####Example 2: BELOW(-1d:scope:metric:avg:4h-avg,$0.5)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
Output:
[]
#####Example 3: BELOW(-1d:scope:metric:avg:4h-avg,$0.5,recent)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "0"
}
}
Output:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "0"
}
}
##CONSECUTIVE Returns all data points that are consecutive. The first interval parameter defines the threshold of consecutivity that you want to collect. Any continuous data points whose connected time window larger than this threshold will be collected. The second internal parameter is the by default data point density on the time series.
CONSECUTIVE(,time_series>,$interval,$interval)
#####Example: CONSECUTIVE(-1d:scope:metric:avg:4h-avg,$3s,$1s)
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1400000000000": "1",
"1400000003000": "2",
"1400000004000": "3",
"1400000005000": "4",
"1400000008000": "5",
"1400000009000": "6"
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1400000003000": "2",
"1400000004000": "3",
"1400000005000": "4",
}
}]
##COUNT Calculates a metric having a set of timestamps that are the union of all input metric timestamp values. Each timestamp value is the constant value of the count of input metrics.
COUNT(<time_series>[,<time_series>]*)
#####Example: COUNT(-2d:-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
}]
Output:
{
"scope": "COUNT",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "2",
"1444406400000": "2",
"1444420800000": "2",
"1444435200000": "2",
"1444449600000": "2"
}
}
##CULL_ABOVE Removes data points from metrics if their value is above a limit.
NOTE: Cull above and cull below require two constants: limit and type.
CULL_ABOVE(<time_series>[,<time_series>]*,<limit>)
#####Example: CULL_ABOVE(-2d:-1d:scope:metric:avg:4h-avg,$3)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}
Output:
{
"scope": "CULL_ABOVE",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
}
}
##CULL_BELOW Removes data points from metrics that have their value below a limit.
CULL_BELOW(<time_series>[,<time_series>]*,<limit>)
#####Example: CULL_BELOW(-2d:-1d:scope:metric:avg:4h-avg,$3)
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
Output:
[{
"scope": "CULL_BELOW",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
##DERIVATIVE Calculates the discrete time derivative.
DERIVATIVE(<time_series>[,<time_series.]*)
#####Example: DERIVATIVE(-2d:-1d:scope:metricA:avg:4h-avg)
Input:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444420800000": "98.3340924629247",
"1444435200000": "105.48854166666666",
"1444449600000": "113.86979166666667",
"1444464000000": "129.76145833333334",
"1444478400000": "118.52708333333334",
"1444492800000": "126.11441532258064"
}
}
Output:
{
"scope": "DERIVIATIVE",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444420800000": null,
"1444435200000": "7.154449203741962",
"1444449600000": "8.381250000000009",
"1444464000000": "15.891666666666666",
"1444478400000": "-11.234375",
"1444492800000": "8.481530112044823"
}
}
```
##DEVIATION
Calculates the standard deviation per timestamp for a collection of input series, or the standard deviation for all data points for a single input series. The required tolerance parameter is a decimal fraction between 0.0 and 1.0 that describes the allowed percentage of missing data to be considered before not performing the operation. The operational points parameter is the number of point to evaluate starting with the most recent. Ig specified, the points parameter will always evaluate the deviation as a row operation on each input time series, If the point parameter is omitted, then for an input of a single time series, all the data points in the series will be used for evaluation.
```java
DEVIATION(<time_series>[,<time_series>]*,$tolerance,$points)
DEVIATION(<time_series>[,<time_series>]*,$tolerance)
```
#####`Example 1: DEVIATION(-1d:metric:avg:4h-avg,$0.1,$6)`
```Java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444334400000": "182.36805555555554",
"1444348800000": "296.03333333333336",
"1444363200000": "282.7388888888889",
"1444377600000": "286.65277777777777",
"1444392000000": "242.75",
"1444406400000": "130.17277397219954"
}
}]
Output:
[{
"scope": "DEVIATION",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444406400000": "67.04009541743302"
}
}]
```
#####`Example2: DEVIATION(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg,$0.1)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444334400000": "182.36805555555554",
"1444348800000": "296.03333333333336",
"1444363200000": "282.7388888888889",
"1444377600000": "286.65277777777777",
"1444392000000": "242.75",
"1444406400000": "130.17277397219954"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444334400000": "43768.333333333336",
"1444348800000": "71048.0",
"1444363200000": "67857.33333333333",
"1444377600000": "68796.66666666667",
"1444392000000": "58260.0",
"1444406400000": "26601.0"
}
}]
Output:
[{
"scope": "DEVIATION",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444334400000": "30819.93161247807",
"1444348800000": "50029.19541228457",
"1444363200000": "47782.45396759747",
"1444377600000": "48443.89540001789",
"1444392000000": "41024.390900795224",
"1444406400000": "18717.701435141746"
}
}]
```
##DIFF
Calculates an arithmetic difference. If no subtrahend is provided, the data point values of each time series timestamp for all but the first metric are subtracted from the data point value of the first metric. If a subtrahend is provided as value, it's subtracted from each data point in the set of input metrics. If a subtrahend is provided as a constant "UNION", the data point values of each time series timestamp for all but the first metric are subtracted from the data point value of the first metric, and all datapoints that do not share common timestamps will be left as is in the first metric.
```java
DIFF(<time_series>[,<time_series>]*,$subtrahend)
DIFF(<time_series>[,<time_series>]*)
```
#####`Example 1: DIFF(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "DIFF",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "1",
"1444406400000": "2",
"1444420800000": "3",
"1444435200000": "4",
"1444449600000": "5"
}
}]
```
#####`Example 2: DIFF(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg,$1)`
```Java
Inout:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "1",
"1444406400000": "2",
"1444420800000": "3",
"1444435200000": "4",
"1444449600000": "5"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "0"
}
}]
```
##DIFF_V
Calculates an arithmetic difference using a vector of subtrahends to be subtracted from each input time-series.
```java
DIFF(<time_series>[,<time_series>]*,<subtrahend_time_series.)
```
#####`Example: DIFF_V(-1d:scope:metricA:avg,-1d:scope:metricB:avg-1d:scope:subtrahends:avg)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "subtrahends",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "DIFF",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "0",
"1444392000000": "1",
"1444406400000": "2",
"1444420800000": "3",
"1444435200000": "4",
"1444449600000": "5"
}
},{
"scope": "DIFF",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
```
##DIVIDE
Calculates a quotient. If no divisor is provided, the data point values of each timestamp for all but the first metric are divided into the data point value of the first metric. If a divisor is provided as a value, it's divided into each data point in the set of input metrics. If a divisor is provided as constant 'UNION', the data point values of each timestamp for all but the first metric are divided into the data point value of the first metric, and all data points that do not share common timestamp will be left as is in the first metric.
```java
DIVIDE(<time_series>[,<time_series>]*,$divisor)
DIVIDE(<time_series>[,<time_series>]*)
```
#####`Example 1: DIVIDE(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "DIVIDE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
```
#####`Example 2: DIVIDE(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg,$1)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "DIVIDE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
```
##DIVIDE_V
Calculates a quotient using a vector of divisors to be divided into each input time series.
```java
DIVIDE_V(<time_series>[,<time_series>]*,<divisor_time_series>)
```
#####`Example: DIVIDE_V(-1d:scope:metricA:avg,-1d:scope:metricB:avg,-1d:scope:divisors:avg)`
```java
Input:[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "divisors",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "DIVIDE_V",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "DIVIDE_V",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
}]
```
##DOWNSAMPLE
Down samples one or more metrics. The downsampler expression supplied is the standard metric downsampler consisting of the aggregation function and period. For example, '1s-avg'.
```java
DOWNSAMPLE(<time_series>[,<time_series>]*,$downsampler)
```
#####`Example: DOWNSAMPLE(-8h:argus.jvm:file.descriptor.open:sum:1h-max,$4h-avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444507200000": "566.0",
"1444510800000": "541.0",
"1444514400000": "574.0",
"1444518000000": "694.0",
"1444521600000": "535.0",
"1444525200000": "522.0",
"1444528800000": "552.0",
"1444532400000": "653.0"
}
}]
Output:
[{
"scope": "DOWNSAMPLE",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444507200000": "582.0",
"1444525200000": "583.0"
}
}]
```
##EXCLUDE
Culls metrics based on the matching of a regular expression against the metric identifier.
```java
EXCLUDE(<time_series>[,<time_series>]*,$regex)
```
#####`Example: ECLUDE(-1d:scope:metricA:avg,-1d:scope:metricB:avg,$m*A)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
}]
Output:
[{
"scope": "EXCLUDE",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
}]
```
##FILL
Creates additional data points to fill gaps. The interval parameter specified the maximum gap allowed before inserting a new data point. The offset parameter specifies the offset applied to each datapoint applied after fill data points are generated. If after the offset is applied, a fill data point coincides with an existing data point, the fill data point is discarded. The value parameter specifies the numeric value for generated data points.
```java
FILL(<time_series>[,<time_series>]*,$interval, $offset, $value)
```
The second form of the FILL function is used to generate a constant line. Rather than filling one or more time series, the start and end parameters define the time range to be filled. This form results in a single time series result.
```Java
FILL($start,$end,$interval, $offset, $value)`
#####`Example 1: FILL(-2d:-1d:scope:metricA:avg:4h-avg,$4h,$0m,$0)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444449600000": "6"
}
}]
Output:
{
"scope": "FILL",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "0",
"1444406400000": "0",
"1444420800000": "0",
"1444435200000": "0",
"1444449600000": "6"
}
}
```
#####`Example 2: FILL($-1d,$-0d,$4h,$0m,$100)`
```java
Input:
[]
Output:
{
"scope": "FILL",
"metric": "result",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "100",
"1444392000000": "100",
"1444406400000": "100",
"1444420800000": "100",
"1444435200000": "100",
"1444449600000": "100"
}
}
```
##FILL_CALCULATE
Creates a constant line based on the calculated value. The interval parameter specified the maximum gap allowed before inserting a new data point. The offset parameter specifies the offset applied to each data point applied after fill data points are generated. If after the offset is applied, a fill data point coincides with an existing data point, The fill data point is discarded. The calculation type parameter specifies the numeric value for generated data points based on the function selected. Supported calculation types are min, max, dev, p1...1000 (percentile).
```java
FILL_CALCULATE(<time_series>[,<time_series>]*, $type, $interval, $offset)
FILL_CALCULATE(<time_series>[,<time_series>]*,$type)
```
#####`Example 1: FILL_CALCULATE(-2d:-1d:scope:metricA:avg:4h-avg,$4h,$0m,$p95)`
#####`Example 2: FILL_CALCULATE(-2d:-1d:scope:metricA:avg:4h-avg,$p95)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444449600000": "2",
"1444381600000": "3",
"1444482600000": "4",
"1444384600000": "5",
"1444486600000": "6",
"1444388600000": "7",
"1444490600000": "8",
"1444392600000": "9",
"1444494600000": "10"
}
}]
Output:
{
"scope": "FILL_CALCULATE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "9",
"1444449600000": "9",
"1444381600000": "9",
"1444482600000": "9",
"1444384600000": "9",
"1444486600000": "9",
"1444388600000": "9",
"1444490600000": "9",
"1444392600000": "9",
"1444494600000": "9"
}
}
```
##GROUP
Calculates the union of all data points of time series which match the regular exception, having the time periods for which there is overlap calculated as the intersection of the time series. The resulting data points within the intersecting time period are selected as the first examined data point for the timestamp from the intersecting series. The type parameter must be one of ‘inclusive’ or ‘exclusive’. If the ‘inclusive’ value is specified, only the series that match the expression will be grouped. If the ‘exclusive’ value is specified, only the series not matching the expression will be grouped. If the type parameter is unspecified, the ‘inclusive’ value will be used.
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444392000000": "1",
"1444406400000": "2",
"1444420800000": "3",
}
}]
Output:
{
"scope": "GROUP",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "3",
}
}
```
##HIGHEST
Evaluates all input metrics based on an evaluation of the metric data point values, returning top metrics having the highest evaluated value.
The limit parameter indicates the maximum number of time series to return.
The type parameter indicates the type of evaluation to perform. Must be one of 'avg', 'min', 'max', 'recent'. All evaluation types consider all data points for a metric with the exception of 'recent' which only evaluates the most recent data point in the series. If null the value defaults to 'average'.
```java
HIGHEST(<time_series>[,<time_series>]*,$limit,$type)
HIGHEST(<time_series>[,<time_series>]*,$limit)
```
#####`Example: HIGHEST(-1d:scope:metric*:avg:1d-avg,$2,$recent)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "3",
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
}
},{
"scope": "scope",
"metric": "metricC",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
}
}]
Output:
[{
"scope": "HIGHEST",
"metric": "metricC",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
}
},{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "3",
}
}]
```
##INCLUDE
Retains metrics based on the matching of a regular expression against the metric identifier.
```java
INCLUDE(<time_series>[,<time_series>]*,$regex)
```
#####`Example: INCLUDE(-1d:scope:metricA:avg,-1d:scope:metricB:avg,$m*A)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
}]
Output:
[{
"scope": "INCLUDE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
```
##INTEGRAL
Calculates the discrete time integral.
```java
INTEGRAL(<time_series>[,<time_series>]*)
```
#####`Example: INTEGRAL(-1d:scope:metric:avg:4h-avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444464000000": "519.0458333333333",
"1444478400000": "474.10833333333335",
"1444492800000": "600.1791666666667",
"1444507200000": "524.3465829846583",
"1444521600000": "499.70833333333337",
"1444536000000": "511.7277777777778"
}
}]
Output:
[{
"scope": "INTEGRAL",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444464000000": "519.0458333333333",
"1444478400000": "993.1541666666667",
"1444492800000": "1593.3333333333335",
"1444507200000": "2117.6799163179917",
"1444521600000": "2617.388249651325",
"1444536000000": "3129.128581143038"
}
}]
```
##JOIN
Joins multiple lists of metrics into a single list.
```java
JOIN(<time_series>[,<time_series>]*)
```
#####`Example: JOIN(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricA:avg:4h-avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}],
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
Output:
[{
"scope": "JOIN",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
```
##LIMIT
Returns a subset input metrics in stale order from the heas of the list not to exceed the specified limit.
```java
LIMIT(<time_series>[,<time_series>]*,$limit)
```
#####`Example: LIMIT(-2d:-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg,$1)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
}]
Output:
{
"scope": "LIMIT",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}
```
##LOG
Calculates the logarithm according to the specified base.
```java
LOG(<time_series>[,<time_series>]*,$base)
```
#####`Example: LOG(-1d:scope:metric:max:6h-avg,$10)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444608000000": "61.0",
"1444629600000": "61.0",
"1444651200000": "61.0",
"1444672800000": "61.0"
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444608000000": "1.785329835010767",
"1444629600000": "1.785329835010767",
"1444651200000": "1.785329835010767",
"1444672800000": "1.785329835010767"
}
}]
```
##LOWEST
Evaluates all input metrics based on an evaluation of the metric data point values, returning top metrics having the lowest evaluated value.
The limit parameter indicated the maximum number of time series to return.
The type parameter indicates the type of evaluation to perform. Must be one of the following: avg, min, max, or recent. All evaluation types consider all data points for a metric with the exception of 'recent', which only evaluates the most recent data point in the series. If null the value defaults to 'average'.
```java
LOWEST(<time_series>[,<time_series>]*,$limit,$type)
LOWEST(<time_series>[,<time_series>]*,$limit)
```
#####`Example: LOWEST(-1d:scope:metric*:avg:1d-avg,$2,$recent)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "3",
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
}
},{
"scope": "scope",
"metric": "metricC",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
}
}]
Output:
[{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
}
},{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "3",
}
}]
```
##MAX
For each timestamp in the input range calculate the maximum value across all input metrics.
```java
MAX(<time_series>[,<time_series>]*)
```
#####`Example: MAX(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "6",
"1444392000000": "5",
"1444406400000": "4",
"1444420800000": "3",
"1444435200000": "2",
"1444449600000": "1"
}
}]
Output:
{
"scope": "MAX",
"metric": "result",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "6",
"1444392000000": "5",
"1444406400000": "4",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}
```
##MIN
For each timestamp in the input range calculate the minimum value across all input metrics.
```java
MIN(<time_series>[,<time_series>]*)
```
#####`Example:MIN(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "6",
"1444392000000": "5",
"1444406400000": "4",
"1444420800000": "3",
"1444435200000": "2",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "MIN",
"metric": "result",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "3",
"1444435200000": "2",
"1444449600000": "1"
}
}]
```
##MOVING
Evaluates input metics usinf amoging window. The interval soecifiess the wifht of the evaluation window and can be median or avg. If the type parameter is omitted, then the avg is used.
```java
MOVING(<time_series>[,<time_series>]*,$interval, $type)
```
```java
MOVING(<time_series>[,<time_series>]*,$interval)
```
#####`Example: MOVING(-1d:scope:metric:avg:4h-max,$6h)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "452.0",
"1444636800000": "466.0",
"1444651200000": "477.0",
"1444665600000": "680.0",
"1444680000000": "486.0",
"1444694400000": "287.0"
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": null,
"1444636800000": "459.0",
"1444651200000": "471.5",
"1444665600000": "578.5",
"1444680000000": "583.0",
"1444694400000": "386.5"
}
}]
```
##NORMALIZE
Normalizes the data point values of time-series. If a normal constant is supplied, it is used as the unit normal otherwise, the unit normal is the sum of data point values at each time stamp.
```java
NORMALIZE(<time_series>[,<time_series>]*,$unitnormal)
```
```java
NORMALIZE(<time_series>[,<time_series>]*)
```
#####`Example: NORMALIZE(-1d:scope:metric:avg:4h-max,$10)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "452.0",
"1444636800000": "466.0",
"1444651200000": "477.0",
"1444665600000": "680.0",
"1444680000000": "486.0",
"1444694400000": "287.0"
}
}]
Output:
{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "45.2",
"1444636800000": "46.6",
"1444651200000": "47.7",
"1444665600000": "68.0",
"1444680000000": "48.6",
"1444694400000": "28.7"
}
}
```
#####`Function Example: NORMALIZE(-1d:scope:metric:avg:4h-max-1d:scope:metric:avg:4h-max)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "452.0",
"1444636800000": "466.0",
"1444651200000": "477.0",
"1444665600000": "680.0",
"1444680000000": "486.0",
"1444694400000": "287.0"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "452.0",
"1444636800000": "466.0",
"1444651200000": "477.0",
"1444665600000": "680.0",
"1444680000000": "486.0",
"1444694400000": "287.0"
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "0.5",
"1444636800000": "0.5",
"1444651200000": "0.5",
"1444665600000": "0.5",
"1444680000000": "0.5",
"1444694400000": "0.5"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444622400000": "0.5",
"1444636800000": "0.5",
"1444651200000": "0.5",
"1444665600000": "0.5",
"1444680000000": "0.5",
"1444694400000": "0.5"
}
}]
```
##NORMALIZE_V
Normalizes the data point values of time-series using vector of unit normals to be applied to each input time-series.
```Java
NORMALIZE_V(<time_series>[,<time_series>]*,<unitnormal_time_series>)
```
#####`Vector Normalize Example: NORMALIZE_V(-1d:scope:metricA:avg,-1d:scope:metricB:avg,-1d:scope:normals:avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "normals",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "10",
"1444406400000": "100",
"1444420800000": "100",
"1444435200000": "10",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "0.2",
"1444406400000": "0.03",
"1444420800000": "0.04",
"1444435200000": "0.5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "0.3",
"1444406400000": "0.04",
"1444420800000": "0.05",
"1444435200000": "0.6",
"1444449600000": "7"
}
}]
```
##PERCENTILE
Calculates the Nth percentile. If a window size is specified, each metric will be evaluated individually using the specified moving window. Otherwise, the set of data points across metrics at each given time stamp are evaluated resulting in a single metric result. The Nth percentile value must be between 0 and 100, inclusive.
```java
PERCENTILE(<time_series>[,<time_series>]*,$npercent)
```
```Java
PERCENTILE(<time_series>[,<time_series>]*,$npercent,$interval)
```
#####`Example: PERCENTILE(-1d:scope:metric[ABCD]:avg:1d-max,$95)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "-1",
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
}
},{
"scope": "scope",
"metric": "metricC",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "4",
}
},{
"scope": "scope",
"metric": "metricD",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "8",
}
}]
Output:
[{
"scope": "PERCENTILE",
"metric": "result",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7.4",
}
}]
```
#####`Example: PERCENTILE(-1d:scope:metric:avg:6h-max,$95,$1d)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "-1",
"1444392000000": "2",
"1444406400000": "4",
"1444420800000": "8",
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444420800000": "7.4",
}
}]
```
##PROPAGATE
Forward fills gaps with the last known value at the star (earliest occurring time) of the gap. The maximum gap size is specified using the interval parameter.
```java
PROPAGATE(<time_series>[,<time_series>]*,$interval)
```
#####`Example: PROPAGATE(-1d:scope:metric:avg:6h-max,$6h)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444420800000": "4",
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "4",
}
}]
```
##RANGE
Calculate the difference between maximum and minimum values at each time stamp. If a single time-series is specified, the minimum and maximum of all values in the time-series is returned.
```java
RANGE(<time_series>[,<time_series>]*)
```
#####`Example: RANGE(-1d:scope:metric[ABCD]:avg:1d-max)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "-1",
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
}
},{
"scope": "scope",
"metric": "metricC",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "4",
}
},{
"scope": "scope",
"metric": "metricD",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "8",
}
}]
Output:
[{
"scope": "RANGE",
"metric": "result",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "9.0",
}
}]
```
##SCALE
Calculates a product. If no multiplier is provided, the data point values of each time stamp for all but the first metric are multiplied into the data point value of the first metric. If a multiplier is provided as a value, it's multiplied into each data point in the set of input metrics. If a multiplier is provided as a constant "UNION", the data point values of each time stamp for all but the first metric are multiplied into the data point value of the first metric, and all data points that do not share any common timestamp will be left as is in the first metric.
```java
SCALE(<time_series>[,<time_series>]*,$multiplier)
```
```Java
SCALE(<time_series>[,<time_series>]*)
```
#####`Example: SCALE(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)`
```Java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "SCALE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
```
#####`Example: SCALE(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg,$1)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "SCALE",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
```
##SCALE_V
Calculates a product using a vector of multipliers to be multiplied into each input time-series.
```java
SCALE_V(<time_series>[,<time_series>]*,<multiplier_time_series>)
```
#####`Example: SCALE_V(-1d:scope:metricA:avg,-1d:scope:metricB:avg,-1d:scope:multipliers:avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "multipliers",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "SCALE_V",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "SCALE_V",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
}]
```
##SHIFT
Shifts the time stamp for each data point by the specified constant.
```java
SHIFT(<time_series>[,<time_series>]*,$interval)
```
#####`Example: SHIFT(-1d:scope:metric:avg:4h-avg,$4h)`
```java
Input:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
}
}]
Output:
[{
"scope": "scope",
"metric": "metric",
"tags": {},
"namespace": null,
"datapoints": {
"1444392000000": "1",
"1444406400000": "2",
"1444420800000": "3",
"1444435200000": "4",
"1444449600000": "5"
}
}]
```
##SORT
Sorat a list of metrics. The required type parameter can be one maxima, minima, name, or dev. The required order parameter must be one of ascending or descending. The optional limit parameter indicates the maximum number of series to return. If the limit parameter is omitted, all results are returned.
The maxima sort uses the maximum value of all the data points in each series to perform the sort. Likewise, the minima sort uses the minimum value from all the data points in each series. The deviation sort uses the standard deviation calculated for each series to perform the sort. The name sort uses the metric identifier to perform the sort.
```java
SORT(<time_series>[,<time_series>]*,$type,$order,$limit)
```
#####`Example:SORT(-1d:scope:metric[AB]:avg:4h-avg,$name,$descending)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
}]
Output:
[{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "7",
"1444392000000": "8",
"1444406400000": "9",
"1444420800000": "10",
"1444435200000": "11",
"1444449600000": "12"
}
},{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
}]
```
##SUM
Calculates an arithmetic sum. If no added is provided, the data point values of each time stamp are summed if they share a common timestamp. If an addend is provided as value, it is added to each overlapping data point in the set of input metrics. If an addend is provided as constant 'UNION', the data point values of each time stamp are summed regardless if they share a common timestamp.
```java
SUM(<time_series>[,<time_series>]*,$addend)
```
```Java
SUM(<time_series>[,<time_series>]*)
```
#####`Example: SUM(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "SUM",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
}]
```
#####`Example: SUM(-1d:scope:metricA:avg:4h-avg,-1d:scope:metricB:avg:4h-avg,$1)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "2",
"1444406400000": "2",
"1444420800000": "2",
"1444435200000": "2",
"1444449600000": "2"
}
}]
```
##SUM_V
Calculates an arithmetic sum using a vector of addends to be summed with each input time-series.
```java
SUM_V(<time_series>[,<time_series>]*,<addend_time_series>)
```
#####`Example: SUM_V(-1d:scope:metricA:avg,-1d:scope:metricB:avg,-1d:scope:addends:avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "4",
"1444435200000": "5",
"1444449600000": "6"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "addends",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "1",
"1444406400000": "1",
"1444420800000": "1",
"1444435200000": "1",
"1444449600000": "1"
}
}]
Output:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "2",
"1444392000000": "3",
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "3",
"1444392000000": "4",
"1444406400000": "5",
"1444420800000": "6",
"1444435200000": "7",
"1444449600000": "8"
}
}]
```
##UNION
Performs the union of all data points for the given time-series. If more than one data point exists at a given time stamp, the first value encountered is used.
```java
UNION(<time_series>[,<time_series>]*)
```
#####`Example: UNION(-1d:scope:metricA:avg,-1d:scope:metricB:avg)`
```java
Input:
[{
"scope": "scope",
"metric": "metricA",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
}
},{
"scope": "scope",
"metric": "metricB",
"tags": {},
"namespace": null,
"datapoints": {
"1444406400000": "4",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
}]
Output:
{
"scope": "UNION",
"metric": "result",
"tags": {},
"namespace": null,
"datapoints": {
"1444377600000": "1",
"1444392000000": "2",
"1444406400000": "3",
"1444420800000": "5",
"1444435200000": "6",
"1444449600000": "7"
}
}
```
Home
[Getting Started](Getting Started)
##[User Guide](User Guide)
Alerts
Annotations
Dashboards
Metrics
Namespaces
[Data Model](Data Model)
Transforms
[Web Service API](Web Service API)
- [/alerts](Alerts Resource)
- [/annotations](Annotation Resource)
- [/audit](Audit Resource)
- [/authentication](Authentication Resource)
- [/collection](Collection Resource)
- [/dashboards](Dashboard Resource)
- [/discover](Discover Resource)
- [/history](History Resource)
- [/management](Management Resource)
- [/metrics](Metrics Resource)
- [/namespace](Namespace Resource)
- [/users](Users Resource)