metrics

class Metric

A metric of one of the four custom metric types: counter, gauge, rate or trend.

add(tags)

Add a value to the metric.

Parameters:
  • x (float | bool) – The value to add to the metric, either a number or a boolean. The boolean is interpreted as 0 (false) or 1 (true)

  • tags (dict) – optional set of tags that will be tagged to the added data point (note that tags are added per data point and not for the entire metric).

Return type:

Self

counter(name)

Counter is an object for representing a custom cumulative counter metric.

Parameters:

name (str) – The name of the custom metric.

Return type:

Metric

Returns:

an initialized counter Metric

gauge(name)

Gauge is an object for representing a custom metric holding only the latest value added.

Parameters:

name (str) – The name of the custom metric.

Return type:

Metric

Returns:

an initialized gauge Metric

rate(name)

Rate is an object for representing a custom metric keeping track of the percentage of added values that are non-zero.

Parameters:

name (str) – The name of the custom metric.

Return type:

Metric

Returns:

an initialized rate Metric

trend(name)

Trend is an object for representing a custom metric that allows for calculating different statistics on the added values (min, max, average or percentiles).

Parameters:

name (str) – The name of the custom metric.

Return type:

Metric

Returns:

an initialized trend Metric