Name used for the metric
Options for the metric
Depending on the metric technology used. Even though the MetricOptions
support almost all options for each supported technology, be careful how you use and setup your
options since they may generated strange behaviors that were not intended with this API.
Name used for the metric
Options for the metric
Depending on the metric technology used. Even though the MetricOptions
support almost all options for each supported technology, be careful how you use and setup your
options since they may generated strange behaviors that were not intended with this API.
Observe method.
import { Histogram } from '@mists/nestjs-metrics';
const histogram = new Histogram('metric_histogram');
// will observe value 10 (custom value)
histogram.observe(10);
// will observe value 1, attaching also a `server_id` label
histogram.observe(1, {server_id: 'instance_1'})
Value to decrement with; default 1
Tags to attach to the increment; optional
Reset method.
import { Histogram } from '@mists/nestjs-metrics';
const histogram = new Histogram('metric_histogram');
// will reset all histogram values
histogram.reset();
Time method.
See Timer.startTimer for usage.
Generated using TypeDoc
Histogram Metric
Histograms track sizes and frequency of ecents. One more feature for histograms, is the timer metric which can record duration of events.
import { Histogram } from '@mists/nestjs-metrics'; const histogram = new Histogram('metric_histogram'); // force prometheus settings const histogram = new Histogram('metric_histogram', { prometheus: { help: 'This is a histogram metric' } }) // force statsd settings; if no settings are provided here, // default settings will be used const histogram = new Histogram('metric_histogram', { statsd: { host: 'localhost', socketTimeout: 2000, } })