Skip to main content

Interface: MetricMeter

common.MetricMeter

A meter for creating metrics to record values on.

The Metric API is an experimental feature and may be subject to change.

Methods

createCounter

createCounter(name, unit?, description?): MetricCounter

Create a new counter metric that supports adding values.

Parameters

NameTypeDescription
namestringName for the counter metric.
unit?stringUnit for the counter metric. Optional.
description?stringDescription for the counter metric. Optional.

Returns

MetricCounter


createGauge

createGauge(name, valueType?, unit?, description?): MetricGauge

Create a new gauge metric that supports setting values.

Parameters

NameTypeDescription
namestringName for the gauge metric.
valueType?NumericMetricValueTypeType of value to set. Defaults to int.
unit?stringUnit for the gauge metric. Optional.
description?stringDescription for the gauge metric. Optional.

Returns

MetricGauge


createHistogram

createHistogram(name, valueType?, unit?, description?): MetricHistogram

Create a new histogram metric that supports recording values.

Parameters

NameTypeDescription
namestringName for the histogram metric.
valueType?NumericMetricValueTypeType of value to record. Defaults to int.
unit?stringUnit for the histogram metric. Optional.
description?stringDescription for the histogram metric. Optional.

Returns

MetricHistogram


withTags

withTags(tags): MetricMeter

Return a clone of this meter, with additional tags. All metrics created off the meter will have the tags.

Parameters

NameTypeDescription
tagsMetricTagsTags to append.

Returns

MetricMeter