Skip to main content

snapshotServiceMetrics

@webda/bench


Function: snapshotServiceMetrics()

snapshotServiceMetrics(service): Promise<Record<string, number>>

Defined in: packages/bench/src/metrics.ts:11

Snapshot the counters and histograms of a Webda service

Services expose their prom-client metrics in this.metrics (see Service.initMetrics). Gauges are skipped: their collect callback may call the backend (e.g. PubSubService.size()), which would disturb the measurement. Histograms are reported as <name>_count and <name>_sum.

Parameters​

service​

any

the service, any object with a metrics record

Returns​

Promise<Record<string, number>>

metric values by name, empty when the service has no readable metric (e.g. metrics disabled)