Skip to content

Commit

Permalink
fix(new-relic): Better error messages when there is no New Relic conf…
Browse files Browse the repository at this point in the history
…ig, but NR features are enabled

Fixes #863
  • Loading branch information
Göran Sander committed Aug 20, 2024
1 parent c2b1579 commit d937208
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/lib/post-to-new-relic.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ export async function postHealthMetricsToNewRelic(_host, body, tags) {
// Send data to all New Relic accounts that are enabled for this metric/event
//
// Get New Relic accounts
const nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
let nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
if (nrAccounts === null) {
nrAccounts = [];
}

globals.logger.debug(
`HEALTH METRICS NEW RELIC: Complete New Relic config=${JSON.stringify(nrAccounts)}`
);
Expand Down Expand Up @@ -438,7 +442,10 @@ export async function postProxySessionsToNewRelic(userSessions) {
// Send data to all New Relic accounts that are enabled for this metric/event
//
// Get New Relic accounts
const nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
let nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
if (nrAccounts === null) {
nrAccounts = [];
}
globals.logger.debug(
`PROXY SESSIONS NEW RELIC: Complete New Relic config=${JSON.stringify(nrAccounts)}`
);
Expand Down Expand Up @@ -602,7 +609,10 @@ export async function postButlerSOSUptimeToNewRelic(fields) {
// Send data to all New Relic accounts that are enabled for this metric/event
//
// Get New Relic accounts
const nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
let nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
if (nrAccounts === null) {
nrAccounts = [];
}
globals.logger.debug(
`UPTIME NEW RELIC: Complete New Relic config=${JSON.stringify(nrAccounts)}`
);
Expand Down Expand Up @@ -748,7 +758,10 @@ export async function postUserEventToNewRelic(msg) {
// Send data to all New Relic accounts that are enabled for this metric/event
//
// Get New Relic accounts
const nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
let nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
if (nrAccounts === null) {
nrAccounts = [];
}
globals.logger.debug(
`USER EVENT NEW RELIC: Complete New Relic config=${JSON.stringify(nrAccounts)}`
);
Expand Down Expand Up @@ -1027,7 +1040,10 @@ export async function postLogEventToNewRelic(msg) {
// Send data to all New Relic accounts that are enabled for this metric/event
//
// Get New Relic accounts
const nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
let nrAccounts = globals.config.get('Butler-SOS.thirdPartyToolsCredentials.newRelic');
if (nrAccounts === null) {
nrAccounts = [];
}
globals.logger.debug(
`LOG EVENT NEW RELIC: Complete New Relic config=${JSON.stringify(nrAccounts)}`
);
Expand Down

0 comments on commit d937208

Please sign in to comment.