Skip to content
Snippets Groups Projects

added staging tags via vanilla node-statsd

Closed Andrew Newdigate requested to merge staging-tags into master
2 files
+ 6
5
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 5
4
@@ -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);
});
}
Loading