Registers the /metrics
page generating function with the
containing Express app.
The containing Bridge instance.
Adds a new collector function. These collector functions are run whenever the /metrics page is about to be generated, allowing code to update values of gauges.
A new collector function. This function is passed no arguments and is not expected to return anything. It runs purely to have a side-effect on previously registered gauges.
Adds a new counter metric
Options
A counter metric.
Adds a new gauge metric.
Options
A gauge metric.
Adds a new timer metric, represented by a prometheus Histogram.
Options
A histogram metric.
Once created, the value of this metric can be incremented with the
startTimer
method.
Increments the value of a counter metric
Registers some exported metrics that expose counts of various kinds of objects within the bridge.
A function that when invoked returns the current counts of various items in the bridge.
Registers some exported metrics that relate to operations of the embedded matrix-js-sdk. In particular, a metric is added that counts the number of calls to client API endpoints made by the client library.
Begins a new timer observation for a timer metric.
A function to be called to end the timer and report the observation.
Generated using TypeDoc
Prometheus-style /metrics gathering and exporting. This class provides a central location to register gauge and counter metrics used to generate the
/metrics
page.This class depends on having
prom-client
installed. It will attempt to load this module when the constructor is invoked.var orange = {}; metrics.addGauge({ name: "oranges", help: "current number of oranges", refresh: (gauge) => { gauge.set({}, Object.keys(oranges).length); }, });
var oranges_gauge = metrics.addGauge({ name: "oranges", help: "current number of oranges", }); var apples_gauge = metrics.addGauge({ name: "apples", help: "current number of apples", });
metrics.addCollector(() => { var counts = this._countFruit(); oranges_gauge.set({}, counts.oranges); apples_gauge.set({}, counts.apples); });
metrics.addCollector({ name: "things_made", help: "count of things that we have made", });
function makeThing() { metrics.incCounter("things_made"); return new Thing(); }