Skip to content
Snippets Groups Projects
Commit 3e486db6 authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

Include nodejs versions in tags sent to statsd for some stats

parent 10e1bd15
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -11,7 +11,8 @@ exports.create = function(options) {
function installBlocked() {
 
var statsdClient = require('./stats-client').create({
config: config
config: config,
includeNodeVersionTags: true
});
 
blocked(function(ms) {
Loading
Loading
Loading
Loading
@@ -28,7 +28,11 @@ exports.create = function(configDirectory) {
function createErrorReporterMiddleware() {
var statsPrefix = config.get('stats:statsd:prefix');
 
var statsClient = require('./stats-client').create({ config: config, prefix: statsPrefix });
var statsClient = require('./stats-client').create({
config: config,
prefix: statsPrefix,
includeNodeVersionTags: true
});
return errorReporterMiddleware.create({ config: config, logger: logger, statsClient: statsClient, errorReporter: errorReporter});
}
 
Loading
Loading
@@ -53,7 +57,9 @@ exports.create = function(configDirectory) {
Object.defineProperty(middlewares, 'accessLogger', {
enumerable: true,
get: function() {
return accessLogger.create({ config: config });
return accessLogger.create({
config: config
});
}
});
 
Loading
Loading
@@ -63,7 +69,12 @@ exports.create = function(configDirectory) {
errorReporter: errorReporter,
stats: stats,
createStatsClient: function createStatsClient(options) {
return require('./stats-client').create({ config: config, prefix: options && options.prefix, tags: options && options.tags });
return require('./stats-client').create({
config: config,
prefix: options && options.prefix,
tags: options && options.tags,
includeNodeVersionTags: options && options.includeNodeVersionTags,
});
},
 
installUncaughtExceptionHandler: function() {
Loading
Loading
Loading
Loading
@@ -42,7 +42,8 @@ exports.create = function(options) {
var config = options.config;
 
var statsdClient = require('../stats-client').create({
config: config
config: config,
includeNodeVersionTags: true
});
 
return responseTime(function (req, res, time) {
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ module.exports = function mongooseConnectionConfigurer(options) {
 
/* Install dogstats */
mongoDogStats.install(mongoose.mongo, {
statsClient: env.createStatsClient(),
statsClient: env.createStatsClient({ includeNodeVersionTags: true }),
sampleRate: 0.5
});
 
Loading
Loading
Loading
Loading
@@ -8,6 +8,7 @@ function emergencyLog() {
 
exports.create = function(options) {
var StatsD = require('node-statsd').StatsD;
var statsdNodeJsVersionTags = require('./statsd-nodejs-version-tags');
var path = require('path');
 
// Stats requires a logger and logger requires stats, so
Loading
Loading
@@ -34,6 +35,10 @@ exports.create = function(options) {
 
if (tags) globalTags = globalTags.concat(tags);
 
if (options.includeNodeVersionTags) {
globalTags = globalTags.concat(statsdNodeJsVersionTags());
}
var upstartJob = process.env.UPSTART_JOB || process.env.JOB;
if (upstartJob) {
upstartJob = upstartJob.replace(/\-\d*$/,''); // gitter-webapp-1 becomes gitter-webapp
Loading
Loading
'use strict';
module.exports = function() {
var tags = [];
var nodeFullVersion = process.versions.node;
if (nodeFullVersion) {
tags.push('node_ver:' + nodeFullVersion);
var nodeMinorVersion = nodeFullVersion.replace(/^(\d+)\.(\d+)\..*/, '$1.$2');
if (nodeMinorVersion) {
tags.push('node_minor_ver:' + nodeMinorVersion);
}
}
return tags;
};
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