This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Description
In order to be able to gain more control on what is being logged, the sendStats function should be configurable.
In my case, I want to log more info than status_code and response_time.
Also, the default client Lynx exposes methods like decrement ,gauge and set that a user may want to use.
My proposal is that the lib allows me to do something like this:
var expressStatsd = require('express-statsd')
var statsd = expressStatsd({
host: 'localhost',
port: 8125,
sendStatus: function (req, res, client, options) {
var key = req.myKey || req[options.requestKey];
metrics.increment(key + '.node_test.int');
metrics.decrement(key + '.node_test.int');
metrics.timing(key + '.node_test.some_service.task.time', 500); // time in ms
metrics.gauge(key + '.gauge.one', 100);
metrics.set(key + '.set.one', 10);
}
})
app.use(statsd)
app.get('/hello', function (req, res) {
req.myKey = 'hello'
// ... snip ...
})