Metricador
Core library to add performance metrics to your Node.js application. Supports using metric implementations such as Counters and Histograms to send data over to specialized backends (such as Graphite).
Usage
Top level of your app:
var metricador = ; var metricRegistry = metricadorregistry;var metricPublishers = metricadorpublishersconsolejson metricadorpublishersgraphitejson;var metricReporter = metricPublishers;
Inside one of your app controllers:
var metricador = ; var metricRegistry = metricadorregistry;var hitCounter = metricRegistry;var responseTimes = metricRegistry; // ...Business logic...hitCounter;responseTimes;
Every 30 seconds the reporter will output something similar to the standard console:
'myapp.controllers.registration.hits': 3401 'myapp.controllers.registration.responsetimes.0_100': 2001 'myapp.controllers.registration.responsetimes.100_250': 2400 'myapp.controllers.registration.responsetimes.250_500': 230 'myapp.controllers.registration.responsetimes.500_1000': 20 'myapp.controllers.registration.responsetimes.1000_1500': 1 'myapp.controllers.registration.responsetimes.1500_Inf': 3
Since we registered a Graphite publisher it will also send the data to the Graphite server for plotting.