1.1.2 • Published 5 years ago

rm-metrics v1.1.2

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Description

Expose node metrics with express router

Install

Go into a node project and type the following :

$> npm install rm-metrics

Exemple

See exemple file

Run

$> node exemple.js
$> curl http://localhost:3000/metrics

The module creates the following routes :

/metrics

will return various metrics

/slow

will wait using the cpu (sync) to generate eventloop lag. Either a random time between 0 and 1 sec. Or you can specify a number of ms from querystring (/slow?ms=100)

/leak

will cause a leak by allocating a random big string in the global namespace

/leakclean

will remove all allocated strings.

log format

This package calls the logger in that way :

loggerlevel(key, message, obj, callback);

  • level : can be info, error, warn
  • key : the package name
  • message : blablabla
  • obj (optional) : additional data in an object
  • callback (optional) : called when the data is logged