@mimik/metrics-helper
v2.1.2
Published
Metrics helper for microservices
Readme
metricsHelper
Importing this module automatically starts collecting default Node.js metrics
(event loop, GC, heap, etc.) via prom-client.collectDefaultMetrics().
Example
import { Prometheus, APIRequestDuration, HTTPRequestDuration, EventCounter } from '@mimik/metrics-helper';
// or
import metricsHelper from '@mimik/metrics-helper';metricsHelper~Prometheus
The prom-client module object (a namespace, not a callable). Use it to create custom metrics (e.g. new Prometheus.Gauge(...)).
Kind: inner constant of metricsHelper
metricsHelper~register
Register to accumulate all the results.
Kind: inner constant of metricsHelper
metricsHelper~APIRequestDuration
Histogram for timing inbound API calls handled by this service (endpoint timing).
Use this for requests served by the service; use HTTPRequestDuration for outbound requests made to other services.
Labels: method (HTTP verb), route (matched route path), withQuery (whether a query string was present),
code (response status code). The buckets are [5, 10, 20, 60, 150, 400, 1000] in ms.
Kind: inner constant of metricsHelper
metricsHelper~HTTPRequestDuration
Histogram for timing outbound HTTP requests this service makes to other services.
Use this for calls to remote services; use APIRequestDuration for inbound endpoint timing.
Labels: function (calling function name), method (HTTP verb), route (target route path),
withQuery (whether a query string was present), code (response status code).
The buckets are [50, 150, 300, 600, 1200, 2000, 2800, 3600] in ms.
Kind: inner constant of metricsHelper
metricsHelper~EventCounter
Counter for the events sent to the topic associated with the process.
Kind: inner constant of metricsHelper
