diff --git a/.gitignore b/.gitignore index a7d8e7d2e6..ef989eaea0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ npm-debug.log lib public/bower_components build +newrelic_agent.log src/*/*.map src/*/*/*.map diff --git a/.nodemonignore b/.nodemonignore index 216c52f8b0..f4e0b53926 100644 --- a/.nodemonignore +++ b/.nodemonignore @@ -6,3 +6,4 @@ Gruntfile.js CHANGELOG.md .idea* .git* +newrelic_agent.log diff --git a/newrelic.js b/newrelic.js new file mode 100644 index 0000000000..48127ad3bc --- /dev/null +++ b/newrelic.js @@ -0,0 +1,25 @@ +/** + * New Relic agent configuration. + * + * See lib/config.defaults.js in the agent distribution for a more complete + * description of configuration variables and their potential values. + */ +var nconf = require('nconf') +exports.config = { + /** + * Array of application names. + */ + app_name : ['HabitRPG'], + /** + * Your New Relic license key. + */ + license_key : nconf.get('NEWRELIC'), + 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 : 'trace' + } +}; diff --git a/package.json b/package.json index 2ecac913bc..9e3e9a52d4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "domain-middleware": "~0.1.0", "swagger-node-express": "git://github.com/lefnire/swagger-node-express#habitrpg", "passport": "~0.1.18", - "passport-facebook": "~1.0.2" + "passport-facebook": "~1.0.2", + "newrelic": "~1.3.0" }, "private": true, "subdomain": "habitrpg", diff --git a/src/server.js b/src/server.js index a5013dcc44..5ad08abe4b 100644 --- a/src/server.js +++ b/src/server.js @@ -17,6 +17,8 @@ var server; // ------------ Setup configurations ------------ utils.setupConfig(); +if (nconf.get('NODE_ENV') === 'production') + require('newrelic'); // ------------ MongoDB Configuration ------------ mongoose = require('mongoose');