From c7ed96abcd0f9e73925aca88f18312c70b087f2d Mon Sep 17 00:00:00 2001 From: Thabo Date: Wed, 8 Apr 2015 16:31:08 -0700 Subject: [PATCH 1/2] disable getChallengeAnalyze endpoint (causing high DB CPU) --- routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes.js b/routes.js index e797691c1..e58a61de4 100755 --- a/routes.js +++ b/routes.js @@ -333,7 +333,7 @@ exports.routes = { { path: "/:apiVersion/download/document/:docId", action: "downloadDocument" }, - { path: "/:apiVersion/reports/analyze", action: "getChallengeAnalyze" }, + //{ path: "/:apiVersion/reports/analyze", action: "getChallengeAnalyze" }, { path: "/:apiVersion/reports/client/costs", action: "getClientChallengeCosts" }, { path: "/:apiVersion/reports/client/challenges", action: "clientChallengeCosts" }, { path: "/:apiVersion/reports/client/activeChallenges", action: "getClientActiveChallengeCosts" }, From fff741f8a4cfb3d6d69523ba64fc25affffef43d Mon Sep 17 00:00:00 2001 From: Thabo Date: Wed, 8 Apr 2015 16:41:03 -0700 Subject: [PATCH 2/2] include new relic middleware to show action hero actions for all transactions --- initializers/nrmid.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 initializers/nrmid.js diff --git a/initializers/nrmid.js b/initializers/nrmid.js new file mode 100644 index 000000000..f5a06ac2f --- /dev/null +++ b/initializers/nrmid.js @@ -0,0 +1,18 @@ +var newrelic = require("newrelic"); + +var fixTransactionName = function(connection, actionTemplate, next) { + if(connection.type === 'web'){ + newrelic.setControllerName(actionTemplate.name); + } + next(connection, true); +} + +var reportException = function(type, err, extraMessages, severity){ + newrelic.noticeError(err); +} + +exports.nrmid = function(api, next){ + api.actions.preProcessors.push(fixTransactionName); + api.exceptionHandlers.reporters.push(reportException); + next(); +}; \ No newline at end of file