docs/ts/runtime/metrics.mdx
A Counter tracks cumulative values that only increase. Use counters for metrics like request counts, errors, etc.
new Counter(name, cfg?): Counter
string
increment(value?): void
Increment the counter by the given value (default 1).
number = 1
void
ref(): Counter
A CounterGroup tracks counters with labels. Each unique combination of label values creates a separate counter time series.
L extends Record<keyof L, string | number | boolean>
The label interface (must have string/number/boolean fields) Note: Number values in labels are converted to integers using Math.floor().
new CounterGroup<L>(name, cfg?): CounterGroup<L>
string
CounterGroup<L>
ref(): CounterGroup<L>
CounterGroup<L>
with(labels): Counter
Get a counter for the given label values.
Note: Number values in labels are converted to integers using Math.floor().
L
A Gauge tracks values that can go up or down. Use gauges for metrics like memory usage, active connections, temperature, etc.
new Gauge(name, cfg?): Gauge
string
ref(): Gauge
set(value): void
Set the gauge to the given value.
number
void
L extends Record<keyof L, string | number | boolean>
new GaugeGroup<L>(name, cfg?): GaugeGroup<L>
string
GaugeGroup<L>
ref(): GaugeGroup<L>
GaugeGroup<L>
with(labels): Gauge
Get a gauge for the given label values.
Note: Number values in labels are converted to integers using Math.floor().
L