Skip to content

ELE-4208 Hook up instana to error logging #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-logger-angular",
"version": "2.2.1",
"version": "3.0.0",
"main": "./js/logging.js",
"description": "Client side logging sent to the server",
"repository": {
Expand Down
18 changes: 11 additions & 7 deletions js/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ loggingModule.factory(
return false;
}

if (LOGGING_CONFIG.FORWARD_TO_NEWRELIC && $window.NREUM && $window.NREUM.noticeError) {
$window.NREUM.noticeError(exception, { url: $window.location.href });
if (LOGGING_CONFIG.FORWARD_TO_INSTANA && typeof ineum !== undefined && ineum) {
ineum('reportError', exception);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all a bit academic as we're the only ones who use this library, but I still wonder if these changes should be in addition to NewRelic support instead of as a replacement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as it's just us and we hopefully wont be using it be the end of the year, I'm going to leave it as is :)


// check if the config says we should log to the remote, and also if a remote endpoint was specified
Expand Down Expand Up @@ -123,7 +123,7 @@ loggingModule.factory(
return (iRequestedLevel >= iLoggingThreshold);
};

var log = function (severity, message, desc, sendToNewRelic) {
var log = function (severity, message, desc, sendToInstana) {
if (!isLoggingEnabledForSeverity(severity)) {
return;
}
Expand All @@ -148,8 +148,12 @@ loggingModule.factory(
return false;
}

if (sendToNewRelic && $window.NREUM && $window.NREUM.noticeError) {
$window.NREUM.noticeError(message, { desc: desc, url: $window.location.href });
if (sendToInstana) {
ineum('reportError', message, {
meta: {
errorDescription: JSON.stringify(desc)
}
});
}

// check if the config says we should log to the remote, and also if a remote endpoint was specified
Expand Down Expand Up @@ -190,8 +194,8 @@ loggingModule.factory(
log('warn', message, desc);
},
error: function (message, desc) {
var sendToNewRelic = LOGGING_CONFIG.FORWARD_TO_NEWRELIC && $window.NREUM && $window.NREUM.noticeError;
log('error', message, desc, sendToNewRelic);
var sendToInstana = LOGGING_CONFIG.FORWARD_TO_INSTANA && typeof ineum !== undefined && ineum;
log('error', message, desc, sendToInstana);
},
setLoggingThreshold: function (level) {
/*
Expand Down