statsdc
A tiny statsd client that supports timing, counters and gauges.
Installation
NPM
npm install statsdc
GitHub
npm install https://github.com/martinrue/statsdc/tarball/master
Usage
var stats = ; stats;
Config
The following config options are supported:
// required: hostname of statsd server host: 'localhost' // required: statsd server port port: 8125 // optional: prefix to attach to all metrics prefix: 'my-app' // optional: show stats on console debug: true
Notes
If host
is set to a hostname rather than an IP address, a single DNS lookup is performed and cached during init.
If prefix
is set, it'll be attached to all outgoing metrics. E.g. with { ... , prefix: 'my-app' }
, a call to stats.c('some-counter', 1);
will add 1
to the counter named my-app.some-counter
.
If you need to shut down the client, stats.close()
will gracefully unbind the UDP socket.
Metrics are submitted to statsd on every respective call via UDP. A single UDP socket is created during init and reused.
License
MIT