Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Added newrelic
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika committed Jun 22, 2017
1 parent 02ee5e4 commit 88c0f67
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 13 deletions.
10 changes: 8 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
var config = require('./config/default.js');

if (config.newrelic_enabled) {
require('newrelic');
require('@newrelic/native-metrics');
}

var http = require('http'),
mongoose = require('./server/db/index.js'),
morgan = require('morgan'),
Expand All @@ -12,8 +19,7 @@ var http = require('http'),
csrfProtection = csrf(),
apiRouter = require('./server/routes/api.js'),
indexRouter = require('./server/routes/index.js'),
config = require('./config/default.js'),
sharedsession = require("express-socket.io-session");
sharedsession = require('express-socket.io-session');

// Force https
app.use(function(req, res, next) {
Expand Down
5 changes: 4 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ module.exports = {
only_one_chat_client: process.env.ONLY_ONE_CHAT_CLIENT || true,
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID || '',
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || '',
AWS_BUCKET_NAME: process.env.AWS_BUCKET_NAME || 'mhacks-nano'
AWS_BUCKET_NAME: process.env.AWS_BUCKET_NAME || 'mhacks-nano',
newrelic_enabled: process.env.NEWRELIC_ENABLED || false,
newrelic_license_key: process.env.NEWRELIC_LICENSE_KEY || '',
newrelic_app_name: process.env.NEWRELIC_APP_NAME || 'mhacks-web'
};
3 changes: 3 additions & 0 deletions deploy/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ services:
- DEPLOYMENT_SECRET
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- NEWRELIC_ENABLED
- NEWRELIC_APP_NAME
- NEWRELIC_LICENSE_KEY
links:
- mhacks_db
27 changes: 27 additions & 0 deletions newrelic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';
var localConfig = require('./config/default.js');

/**
* New Relic agent configuration.
*
* See lib/config.default.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: [localConfig.newrelic_app_name],
/**
* Your New Relic license key.
*/
license_key: localConfig.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: 'info'
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"prettier": "ci/prettier.sh"
},
"dependencies": {
"@newrelic/native-metrics": "^2.1.1",
"autoprefixer": "^6.7.7",
"aws-sdk": "^2.67.0",
"babel-core": "^6.24.0",
Expand Down Expand Up @@ -54,6 +55,7 @@
"morgan": "^1.8.1",
"multer": "^1.3.0",
"multer-s3": "^2.7.0",
"newrelic": "^1.40.0",
"node-ssh": "^4.2.2",
"postcss-loader": "^1.3.3",
"prettier": "^1.3.1",
Expand Down
48 changes: 38 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# yarn lockfile v1


"@newrelic/native-metrics@^2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@newrelic/native-metrics/-/native-metrics-2.1.1.tgz#2a7abd87373e46b3c957a08124a72c0c41968dc8"
dependencies:
nan "^2.4.0"

abbrev@1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f"
Expand Down Expand Up @@ -47,6 +53,10 @@ [email protected]:
version "0.8.2"
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"

agent-base@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-1.0.2.tgz#6890d3fb217004b62b70f8928e0fae5f8952a706"

ajv-keywords@^1.0.0, ajv-keywords@^1.1.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"
Expand Down Expand Up @@ -1596,6 +1606,12 @@ date-now@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"

debug@2, [email protected], debug@^2.2.0, debug@^2.6.8, debug@~2.6.4, debug@~2.6.6:
version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies:
ms "2.0.0"

[email protected]:
version "2.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.3.3.tgz#40c453e67e6e13c901ddec317af8986cda9eff8c"
Expand All @@ -1608,12 +1624,6 @@ [email protected], debug@^2.1.1, debug@~2.6.0:
dependencies:
ms "2.0.0"

[email protected], debug@^2.2.0, debug@^2.6.8, debug@~2.6.4, debug@~2.6.6:
version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies:
ms "2.0.0"

debug@~2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
Expand Down Expand Up @@ -2219,7 +2229,7 @@ express@^4.13.3, express@^4.15.2:
utils-merge "1.0.0"
vary "~1.1.1"

extend@~3.0.0:
extend@3, extend@~3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"

Expand Down Expand Up @@ -2755,6 +2765,14 @@ [email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82"

https-proxy-agent@^0.3.5:
version "0.3.6"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-0.3.6.tgz#713fa38e5d353f50eb14a342febe29033ed1619b"
dependencies:
agent-base "~1.0.1"
debug "2"
extend "3"

hyphenate-style-name@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.2.tgz#31160a36930adaf1fc04c6074f7eb41465d4ec4b"
Expand Down Expand Up @@ -3172,7 +3190,7 @@ json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1:
dependencies:
jsonify "~0.0.0"

json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
json-stringify-safe@^5.0.0, json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"

Expand Down Expand Up @@ -3627,7 +3645,7 @@ [email protected]:
version "2.5.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8"

nan@^2.3.0, nan@latest:
nan@^2.3.0, nan@^2.4.0, nan@latest:
version "2.6.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"

Expand All @@ -3653,6 +3671,16 @@ [email protected]:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"

newrelic@^1.40.0:
version "1.40.0"
resolved "https://registry.yarnpkg.com/newrelic/-/newrelic-1.40.0.tgz#2548df14c441ebfc9d3b8eb989d137f7b69a1d6f"
dependencies:
concat-stream "^1.5.0"
https-proxy-agent "^0.3.5"
json-stringify-safe "^5.0.0"
readable-stream "^1.1.13"
semver "^5.3.0"

no-case@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.1.tgz#7aeba1c73a52184265554b7dc03baf720df80081"
Expand Down Expand Up @@ -4743,7 +4771,7 @@ [email protected]:
isarray "0.0.1"
string_decoder "~0.10.x"

[email protected]:
[email protected], readable-stream@^1.1.13:
version "1.1.14"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
dependencies:
Expand Down

0 comments on commit 88c0f67

Please sign in to comment.