New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

prometheus-plugin-app-info

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prometheus-plugin-app-info

Node.js prometheus client plugin for exporting for application and nodejs version.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

prometheus-plugin-app-info

Node.js prometheus client plugin for application and nodejs version.

build status coverage report

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 = require('prom-client');
const appInfoPlugin = require('prometheus-plugin-app-info');

// start metrics collection
appInfoPlugin.init().start();

// log metrics to console
console.log(client.register.metrics());

// stop metrics collection
appInfoPlugin.stop();

// stop and clear metrics register
appInfoPlugin.reset();

Override metric defaults

const client = require('prom-client');
const appInfoPlugin = require('prometheus-plugin-app-info');
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
      customFnLabel: () => { return new Date() } // if it's a function, it will be called to get label value in runtime
    }
  }
};
// start metrics collection
appInfoPlugin.init(override).start(); // pass override object to init function

// log metrics to console
console.log(client.register.metrics());

// stop metrics collection
appInfoPlugin.stop();

// stop and clear metrics register
appInfoPlugin.reset();

Keywords

metrics

FAQs

Package last updated on 16 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts