Skip to content

Commit

Permalink
add configuration for node perf monitoring (enabled on heroku only)
Browse files Browse the repository at this point in the history
  • Loading branch information
btouellette committed May 1, 2014
1 parent f2c7629 commit 8305ab9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
24 changes: 24 additions & 0 deletions newrelic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* 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.
*/
exports.config = {
/**
* Array of application names.
*/
app_name : ['My Application'],
/**
* Your New Relic license key.
*/
license_key : 'license key here',
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'
}
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"connect": "~2.14.3",
"q": "~1.0.1",
"moniker": "~0.1.2",
"connect-mongo": "~0.4.0"
"connect-mongo": "~0.4.0",
"nodetime": "~0.8.15",
"newrelic": "~1.5.2"
}
}
22 changes: 17 additions & 5 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
//TODO: consider setting up logging via winston (https://github.com/flatiron/winston)

// set up ======================================================================

// if this is a c9 project configure appropriately
if(process.env.C9_PROJECT) {
require('./config/c9');
}

// if configured to use nodetime or newrelic connect to it
if(process.env.NEW_RELIC_LICENSE_KEY) {
require('newrelic')
}
if(process.env.NODETIME_ACCOUNT_KEY) {
require('nodetime').profile({
accountKey: process.env.NODETIME_ACCOUNT_KEY,
appName: 'Concarneau'
});
}

// if we're behind an http proxy set up all requests to go through it
if(process.env.HTTP_PROXY) {
var parsedURL = require('url').parse(process.env.HTTP_PROXY);
Expand All @@ -11,11 +28,6 @@ if(process.env.HTTP_PROXY) {
require('./config/proxy')(host, port);
}

// if this is a c9 project configure appropriately
if(process.env.C9_PROJECT) {
require('./config/c9');
}

var port = process.env.PORT || 8080;

// get all the tools we need
Expand Down

0 comments on commit 8305ab9

Please sign in to comment.