Skip to content

Commit 415bf8c

Browse files
authored
Merge pull request #16 from talis/ELE-4208-forwardErrorsToInstana
ELE-4208 Hook up instana to error logging
2 parents 2f0d34a + 95c8ab0 commit 415bf8c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "app-logger-angular",
3-
"version": "2.2.1",
3+
"version": "3.0.0",
44
"main": "./js/logging.js",
55
"description": "Client side logging sent to the server",
66
"repository": {

js/logging.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ loggingModule.factory(
5353
return false;
5454
}
5555

56-
if (LOGGING_CONFIG.FORWARD_TO_NEWRELIC && $window.NREUM && $window.NREUM.noticeError) {
57-
$window.NREUM.noticeError(exception, { url: $window.location.href });
56+
if (LOGGING_CONFIG.FORWARD_TO_INSTANA && typeof ineum !== undefined && ineum) {
57+
ineum('reportError', exception);
5858
}
5959

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

126-
var log = function (severity, message, desc, sendToNewRelic) {
126+
var log = function (severity, message, desc, sendToInstana) {
127127
if (!isLoggingEnabledForSeverity(severity)) {
128128
return;
129129
}
@@ -148,8 +148,12 @@ loggingModule.factory(
148148
return false;
149149
}
150150

151-
if (sendToNewRelic && $window.NREUM && $window.NREUM.noticeError) {
152-
$window.NREUM.noticeError(message, { desc: desc, url: $window.location.href });
151+
if (sendToInstana) {
152+
ineum('reportError', message, {
153+
meta: {
154+
errorDescription: JSON.stringify(desc)
155+
}
156+
});
153157
}
154158

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

0 commit comments

Comments
 (0)