Skip to content
Snippets Groups Projects
Commit b54ae961 authored by Andy Trevorah's avatar Andy Trevorah
Browse files

added staging tags via vanilla node-statsd

parent 8c721201
No related branches found
No related tags found
1 merge request!1added staging tags via vanilla node-statsd
Loading
Loading
@@ -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) {
Loading
Loading
@@ -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
Loading
Loading
Loading
@@ -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",
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment