Skip to content

Commit

Permalink
#33 Add New Relic to performance monitor Node
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed Nov 17, 2014
1 parent 6ae7806 commit 86c7342
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 3 deletions.
5 changes: 5 additions & 0 deletions config/env/development.js
Expand Up @@ -112,5 +112,10 @@ module.exports = {
pass: process.env.MAILER_PASSWORD || 'MAILER_PASSWORD'
}
}
},
newrelic: {
app_name: process.env.NEWRELIC_APP || ['Trustroots'],
license_key: process.env.NEWRELIC_KEY || 'NEWRELIC_KEY',
logging_level: process.env.NEWRELIC_LOGGING_LEVEL || 'info',
}
};
5 changes: 5 additions & 0 deletions config/env/production.js
Expand Up @@ -86,5 +86,10 @@ module.exports = {
pass: process.env.MAILER_PASSWORD || 'MAILER_PASSWORD'
}
}
},
newrelic: {
app_name: process.env.NEWRELIC_APP || ['Trustroots'],
license_key: process.env.NEWRELIC_KEY || 'NEWRELIC_KEY',
logging_level: process.env.NEWRELIC_LOGGING_LEVEL || 'info',
}
};
2 changes: 1 addition & 1 deletion config/init.js
Expand Up @@ -37,4 +37,4 @@ module.exports = function() {
require.extensions['.server.controller.js'] = require.extensions['.js'];
require.extensions['.server.model.js'] = require.extensions['.js'];
require.extensions['.server.routes.js'] = require.extensions['.js'];
};
};
5 changes: 5 additions & 0 deletions config/secret/_template.js
Expand Up @@ -56,5 +56,10 @@ module.exports = {
pass: 'MAILER_PASSWORD'
}
}
},
newrelic: {
app_name: ['Trustroots'],
license_key: 'NEWRELIC_KEY',
logging_level: 'info'
}
};
22 changes: 22 additions & 0 deletions newrelic.js
@@ -0,0 +1,22 @@
/**
* New Relic agent configuration.
* @link https://www.newrelic.com
*
* See ./node_modules/newrelic/lib/config.defaults.js in the agent distribution for a more complete
* description of configuration variables and their potential values.
*/

var config = require('./config/config');

exports.config = {
app_name : config.newrelic.app_name, // Array of application names
license_key : config.newrelic.license_key,
logging : {
/**
* Level at which to log. 'trace' is most useful to New Relic when diagnosing
* issues with the agent, 'info' and higher will impose the least overhead on
* production applications.
*/
level : config.newrelic.logging_level
}
};
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -35,6 +35,7 @@
"method-override": "~2.3.0",
"mongoose": "~3.8.19",
"morgan": "~1.5.0",
"newrelic": "^1.13.3",
"nodemailer": "~1.3.0",
"passport": "~0.2.1",
"passport-facebook": "~1.0.3",
Expand Down
9 changes: 7 additions & 2 deletions server.js
@@ -1,10 +1,15 @@
'use strict';

/**
* Module dependencies.
*/
if(process.env.NODE_ENV === 'production') {
var newrelic = require('newrelic');
}

var init = require('./config/init')(),
config = require('./config/config'),
mongoose = require('mongoose');
config = require('./config/config'),
mongoose = require('mongoose');

/**
* Main application entry file.
Expand Down

0 comments on commit 86c7342

Please sign in to comment.