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.
Increment method.
import { Counter } from '@mists/nestjs-metrics';
const counter = new Counter('metric_counter');
// will increment by 1 (the default value)
counter.inc();
// will increment by 10 (custom value)
counter.inc(10);
// will increment by 1, attaching also a `server_id` label
counter.inc(1, {server_id: 'instance_1'})
Value to increment with; default 1
Tags to attach to the increment; optional
Generated using TypeDoc
Counter Metric
import { Counter } from '@mists/nestjs-metrics'; const counter = new Counter('metric_counter'); // force prometheus settings const counter = new Counter('metric_counter', { prometheus: { help: 'This is a counter metric' } }) // force statsd settings; if no settings are provided here, // default settings will be used const counter = new Counter('metric_counter', { statsd: { host: 'localhost', socketTimeout: 2000, } })