Package Exports
- abacus
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (abacus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Abacus
A simple node.js module to count, report, and plot application metrics.
Install
npm install abacusUsage
var abacus = require('abacus');
var config = {
statsD: {
connection:{
host: 'localhost',
port: 5007
},
// This is the prefix for all metric names sent to statsD / graphite
metricPrefix: 'apps.abacus.'
},
resetOnFlush: true,
debug: false
}
var metrics = new abacus(config);
// increment by 1
metrics.increment('metricName');
// increment by 5
metrics.increment('metricName', 5);
// set value of metric
metrics.set('metricName',153)
// Get value of metric
metrics.get('metricName');
// Print a summary of counters to STDOUT every 10 seconds. Remember to set DEBUG environment variable
metrics.printPeriodically(10);
// Periodically flush counters to statsD. This is opposed to sending the counter each time it is changed
// If config.resetOnFlush is false, the counters will be cumulative. Otherwise, they're reset to 0 on each flush.
metrics.flushPeriodically(60000); // in Milliseconds. Flush every 60 secondsConfiguration
Abacus supports 2 configuration methods. It's compatable with node-config, so if you're using node-config in your parent project you can set an abacus property in your configuration object and abacus will pick it up automatically.
Alternatively, you can pass a configuration object directly to abacus on instantiation: new abacus(config);. See usage example.
StatsD
Abacus can be configured to send its counters to an instance of StatsD. You can configure the StatsD connection as shown in the example.
Logging
This module uses debug, and therefore obeys the same output control scheme. You can see all output from abacus by setting the environment variable DEBUG=*
Sub-sections of debug output can be controlled by setting for e.g. DEBUG=abacus:abacus. Read debug's documentation for more on output control.