RESTMetrics
Defined in: packages/rest/src/telemetry.ts:149
An in-memory metrics aggregator for RESTTelemetry: counters, gauges and latency histograms, with a hard cap on distinct label sets so an unexpected route shape cannot grow it without bound.
const metrics = new RESTMetrics();const rest = new REST({ token, telemetry: metrics });// later: metrics.snapshot(), or metrics.toPrometheus() for a /metrics endpointImplements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RESTMetrics(
options?):RESTMetrics
Defined in: packages/rest/src/telemetry.ts:157
Parameters
Section titled “Parameters”options?
Section titled “options?”maxRoutes: distinct route labels kept before the rest become other (default 500).
maxRoutes?
Section titled “maxRoutes?”number
Returns
Section titled “Returns”RESTMetrics
Methods
Section titled “Methods”emit()
Section titled “emit()”emit(
event):void
Defined in: packages/rest/src/telemetry.ts:195
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”reset()
Section titled “reset()”reset():
void
Defined in: packages/rest/src/telemetry.ts:301
Clears every value.
Returns
Section titled “Returns”void
snapshot()
Section titled “snapshot()”snapshot():
RESTMetricsSnapshot
Defined in: packages/rest/src/telemetry.ts:281
The current values.
Returns
Section titled “Returns”toPrometheus()
Section titled “toPrometheus()”toPrometheus(
prefix?):string
Defined in: packages/rest/src/telemetry.ts:309
The values in the Prometheus text exposition format.
Parameters
Section titled “Parameters”prefix?
Section titled “prefix?”string = "lunibee_rest"
Returns
Section titled “Returns”string