prometheus-plugin-app-info
Node.js prometheus client plugin for application and nodejs version.
Installation
npm i -S prometheus-plugin-app-info
Requirements
>=prom-client-4.0.0
npm module (installed as peer dependency). If your project depends on previous version of client this plugin might not work.>=node-4.0.0
because this module uses ES6 syntax- Valid
package.json
file in$PWD
Metric list
- Application and nodejs info
- type: 'Counter'
- name: 'nodejs_app_info'
- labels: ['name', 'version', 'major', 'minor', 'patch']
Usage
Simple
const client = ;const appInfoPlugin = ; // start metrics collectionappInfoPluginstart; // log metrics to consoleconsole; // stop metrics collectionappInfoPlugin; // stop and clear metrics registerappInfoPlugin;
Override metric defaults
const client = ;const appInfoPlugin = ;const override = 'metric_name': // provide default metric name to override it's params type: 'Counter' // could be changed, but it's not recommended name: 'my_metric_name' // name could be changed description: 'My custom description' // description could be changed labelValues: // additional labels customLabel: 'hello' // custom labels could be added { return } // if it's a function, it will be called to get label value in runtime ;// start metrics collectionappInfoPluginstart; // pass override object to init function // log metrics to consoleconsole; // stop metrics collectionappInfoPlugin; // stop and clear metrics registerappInfoPlugin;