metric¶
Description¶
Select the metrics in the rollup verb.
This function is deprecated. Please use align and m() instead.
Return type¶
expression
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
metric(name, [ filter ], [ label ], [ type ], [ unit ], [ description ], [ rollup ], [ aggregate ])
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
name |
string |
no |
no |
none |
filter |
bool |
yes |
no |
none |
label |
expression |
yes |
no |
none |
type |
expression |
yes |
no |
none |
unit |
expression |
yes |
no |
none |
description |
expression |
yes |
no |
none |
rollup |
expression |
yes |
no |
none |
aggregate |
expression |
yes |
no |
none |
Examples¶
metric("requests_total", return_code >= 400 and return_code <= 599)
Select the metric ‘requests_total’ within this dataset where return_code is between 400 and 599. The dataset must already implement the “metric” interface.
metric("requests_total", label:"Request Rate", type:"cumulativeCounter", unit:"1/s", description:"Number of requests processed per second.", rollup:"rate", aggregate:"sum")
Select the metric ‘requests_total’ for rollup, and overwrite the new metric’s definition with the specified label, type, unit, description, rollup method and aggregate method. The dataset must implement the “metric” interface.