metric(name: string, [filter: bool]?, [label: expression]?, [type: expression]?, [unit: expression]?, [description: expression]?, [rollup: expression]?, [aggregate: expression]?) -> expression

Select the metrics in the rollup verb.

This function is deprecated. Please use align and m() instead.

Domain

This is a scalar function (calculates a single output value for a single input row).

Categories

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.