diff --git a/lib/stats.js b/lib/stats.js index 83036896111e4df620538dc045af2b74d9a9de6a..eb8a47e9c9efdd522d925ddc49e2e35721a1129c 100644 --- a/lib/stats.js +++ b/lib/stats.js @@ -98,13 +98,14 @@ exports.create = function(options) { if (statsdEnabled) { var StatsD = require('node-statsd').StatsD; var statsdClient = new StatsD({ prefix: config.get('stats:statsd:prefix'), host: '127.0.0.1' }); + var tags = config.get('STAGING') ? ['staging'] : []; statsdClient.socket.on('error', function(error) { return emergencyLog("Error in statsd socket: " + error, { exception: error }); }); statsHandlers.event.push(function(eventName) { - statsdClient.increment(eventName); + statsdClient.increment(eventName, null, null, tags); }); statsHandlers.eventHF.push(function(eventName, count, frequency) { @@ -112,18 +113,18 @@ exports.create = function(options) { if(!frequency) frequency = 0.1; /* Only send to the server one tenth of the time */ - statsdClient.increment(eventName, count, frequency); + statsdClient.increment(eventName, count, frequency, tags); }); statsHandlers.gaugeHF.push(function(gaugeName, value, frequency) { if(!frequency) frequency = 0.1; /* Only send to the server one tenth of the time */ - statsdClient.gauge(gaugeName, value, frequency); + statsdClient.gauge(gaugeName, value, frequency, tags); }); statsHandlers.responseTime.push(function(timerName, duration) { - statsdClient.timing(timerName, duration); + statsdClient.timing(timerName, duration, null, tags); }); } diff --git a/package.json b/package.json index 295faf409c593d96ecb4a82f054ac756af1ca8cb..f73aa7d870f8111eff18f559600dc503aa951e09 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "redis-sentinel-client": "^0.1.5", "raven": "^0.6.3", "cube": "^0.2.12", - "node-statsd": "0.0.7", + "node-statsd": "sivy/node-statsd", "mixpanel": "0.0.20", "underscore": "^1.6.0", "clockout": "0.0.1",