set_metric

Type of operation: Metadata, Metrics

Description

Register a metric, with its metadata defined in an options object. name should be an expected value in the metric name field.

Values for options metadata:

label, unit, and description are strings

type is one of: ‘cumulativeCounter’, ‘delta’, ‘gauge’

interval a duration representing the reporting interval of the metric, such as 1m, 15s

rollup is one of: ‘count’, ‘max’, ‘min’, ‘rate’, ‘sum’, ‘avg’

aggregate is one of: ‘any’, ‘any_not_null’, ‘avg’, ‘count’, ‘countdistinct’, ‘counddistinctexact’, ‘max’, ‘median’, ‘medianexact’, ‘min’, ‘stddev’, ‘sum’

unit is optional. See the Metrics documentation for more information.

Usage

set_metric options, name

Argument

Type

Required

Multiple

options

options

Required

Only one

name

string

Required

Only one

Options

Option

Type

Meaning

label

string

The UI label of the metric

type

string

‘cumulativeCounter’, ‘delta’, or ‘gauge’

unit

string

‘Bytes’, ‘s’, or some other unit

description

string

Longer description shown in the UI

rollup

string

How to rollup/align multiple samples within a series: ‘avg’, ‘count’, ‘max’, ‘min’, ‘rate’, or ‘sum’

aggregate

string

How to aggregate multiple series: ‘any’, ‘any_not_null’, ‘avg’, ‘count’, ‘count_distinct’, ‘count_distinct_exact’, ‘max’, ‘median’, ‘median_exact’, ‘min’, ‘stddev’, or ‘sum’

interval

duration

How frequently the metric is expected to be reported

Accelerable

set_metric is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs, can be accelerated, making queries on the dataset respond faster.

Examples

set_metric options(label:"Ingress Bytes", type:"cumulativeCounter", unit:"bytes", description:"Ingress reported from somewhere", rollup:"rate", aggregate:"sum", interval: 15s), "ingress_bytes"

Register the metric ‘ingress_bytes’ within this dataset. The dataset must already implement the “metric” interface.

set_metric options(label:"Temperature", type:"gauge", unit:"C", description:"Storage room B temperature", rollup:"avg", aggregate:"avg", interval: 5m), "temp"

Register the metric ‘temp’ within this dataset. The dataset must already implement the “metric” interface, for example with ‘interface “metric”, metric:sensor_type, value:value’

Aliases

  • addmetric (deprecated)