metric¶
Description¶
Select the metrics in the rollup verb.
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 |
Required |
Multiple |
Constant |
---|---|---|---|---|
name |
string |
Required |
Only one |
Variable |
filter |
bool |
Optional |
Only one |
Variable |
label |
expression |
Optional |
Only one |
Variable |
type |
expression |
Optional |
Only one |
Variable |
unit |
expression |
Optional |
Only one |
Variable |
description |
expression |
Optional |
Only one |
Variable |
rollup |
expression |
Optional |
Only one |
Variable |
aggregate |
expression |
Optional |
Only one |
Variable |
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.