Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit b15ad07

Browse files
committed
fix newrelic.coffee
The Newrelic script didn't work (at least on our new hubot). Afaict this was happening because of variables being referenced out of scope. This fixed it for us.
1 parent ba70dc5 commit b15ad07

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/scripts/newrelic.coffee

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
# Author:
2323
# briandoll
2424

25+
Parser = require("xml2js").Parser
26+
2527
module.exports = (robot) ->
26-
fetchData = (appId) ->
28+
fetchData = (accountId, appId, apiKey, msg) ->
2729
msg.http("https://rpm.newrelic.com/accounts/#{accountId}/applications/#{appId}/threshold_values?api_key=#{apiKey}")
2830
.get() (err, res, body) ->
2931
if err
@@ -41,6 +43,5 @@ module.exports = (robot) ->
4143
accountId = process.env.HUBOT_NEWRELIC_ACCOUNT_ID
4244
appIds = process.env.HUBOT_NEWRELIC_APP_ID.split(',')
4345
apiKey = process.env.HUBOT_NEWRELIC_API_KEY
44-
Parser = require("xml2js").Parser
45-
fetchData(appId) for appId in appIds
46+
fetchData(accountId, appId, apiKey, msg) for appId in appIds
4647

0 commit comments

Comments
 (0)