rollbar 3.0.0-beta.5 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.git-blame-ignore-revs +3 -1
- package/AGENTS.md +21 -0
- package/CONTRIBUTING.md +68 -73
- package/babel.config.json +7 -0
- package/bower.json +1 -1
- package/dist/plugins/jquery.min.js +1 -1
- package/dist/rollbar.cjs +2216 -2022
- package/dist/rollbar.js +6098 -5886
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.cjs +1 -1
- package/dist/rollbar.min.cjs.LICENSE.txt +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +6097 -5886
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +6097 -5886
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.js +8123 -7924
- package/dist/rollbar.replay.js.map +1 -1
- package/dist/rollbar.replay.min.js +1 -1
- package/dist/rollbar.replay.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.min.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.js +8122 -7924
- package/dist/rollbar.replay.noconflict.umd.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.umd.js +8122 -7924
- package/dist/rollbar.replay.umd.js.map +1 -1
- package/dist/rollbar.replay.umd.min.js +1 -1
- package/dist/rollbar.replay.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +6097 -5886
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/eslint.config.js +151 -0
- package/index.d.ts +45 -13
- package/package.json +26 -6
- package/src/api.js +130 -136
- package/src/apiUtility.js +2 -2
- package/src/browser/bundles/rollbar.snippet.js +1 -0
- package/src/browser/core.js +31 -42
- package/src/browser/domUtility.js +11 -17
- package/src/browser/globalSetup.js +3 -3
- package/src/browser/replay/checkoutWatchdog.js +104 -0
- package/src/browser/replay/recorder.d.ts +5 -2
- package/src/browser/replay/recorder.js +22 -4
- package/src/browser/replay/replay.js +8 -4
- package/src/browser/replay/replayPredicates.js +1 -1
- package/src/browser/rollbar.js +5 -4
- package/src/browser/rollbarReplay.js +6 -5
- package/src/browser/rollbarWrapper.js +2 -2
- package/src/browser/shim.js +15 -15
- package/src/browser/telemetry.js +26 -22
- package/src/browser/transforms.js +4 -4
- package/src/browser/transport/xhr.js +4 -4
- package/src/browser/transport.js +9 -10
- package/src/browser/wrapGlobals.js +3 -4
- package/src/defaults.js +1 -1
- package/src/errorParser.js +1 -1
- package/src/logger.js +1 -0
- package/src/notifier.js +102 -100
- package/src/predicates.js +3 -4
- package/src/rateLimiter.js +107 -104
- package/src/react-native/rollbar.js +9 -10
- package/src/react-native/transforms.js +4 -5
- package/src/react-native/transport.js +7 -7
- package/src/rollbar.js +7 -4
- package/src/scrub.js +16 -20
- package/src/server/locals.js +7 -7
- package/src/server/parser.js +9 -6
- package/src/server/rollbar.js +54 -49
- package/src/server/sourceMap/stackTrace.js +7 -6
- package/src/server/telemetry/urlHelpers.js +2 -1
- package/src/server/telemetry.js +10 -10
- package/src/server/transforms.js +10 -6
- package/src/server/transport.js +8 -7
- package/src/telemetry.js +22 -25
- package/src/tracing/tracer.js +2 -2
- package/src/tracing/tracing.js +2 -2
- package/src/truncation.js +6 -6
- package/src/utility/headers.js +4 -2
- package/src/utility/traverse.js +1 -1
- package/src/utility.js +111 -33
- package/tsconfig.json +16 -0
- package/tsconfig.test.json +10 -0
- package/{web-test-runner.config.mjs → web-test-runner.config.js} +10 -0
- package/{webpack.config.cjs → webpack.config.js} +39 -27
- package/.eslintrc +0 -27
- package/eslint.config.mjs +0 -33
- package/src/merge.js +0 -61
package/src/server/rollbar.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import util from 'util';
|
|
2
1
|
import os from 'os';
|
|
3
|
-
|
|
4
|
-
import Client from '../rollbar.js';
|
|
5
|
-
import * as _ from '../utility.js';
|
|
6
|
-
import API from '../api.js';
|
|
7
|
-
import logger from '../logger.js';
|
|
8
|
-
import * as serverDefaults from './defaults.js';
|
|
9
|
-
import { version, reportLevel } from '../defaults.js';
|
|
10
|
-
|
|
11
|
-
import Transport from './transport.js';
|
|
12
2
|
import urllib from 'url';
|
|
3
|
+
import util from 'util';
|
|
4
|
+
|
|
13
5
|
import jsonBackup from 'json-stringify-safe';
|
|
14
6
|
|
|
7
|
+
import API from '../api.js';
|
|
8
|
+
import { version, reportLevel } from '../defaults.js';
|
|
9
|
+
import logger from '../logger.js';
|
|
10
|
+
import * as sharedPredicates from '../predicates.js';
|
|
11
|
+
import Client from '../rollbar.js';
|
|
15
12
|
import Telemeter from '../telemetry.js';
|
|
16
|
-
import Instrumenter from './telemetry.js';
|
|
17
|
-
import * as transforms from './transforms.js';
|
|
18
13
|
import * as sharedTransforms from '../transforms.js';
|
|
19
|
-
import * as sharedPredicates from '../predicates.js';
|
|
20
14
|
import truncation from '../truncation.js';
|
|
15
|
+
import * as _ from '../utility.js';
|
|
16
|
+
|
|
17
|
+
import * as serverDefaults from './defaults.js';
|
|
18
|
+
import Instrumenter from './telemetry.js';
|
|
19
|
+
import * as transforms from './transforms.js';
|
|
20
|
+
import Transport from './transport.js';
|
|
21
21
|
|
|
22
22
|
function Rollbar(options, client) {
|
|
23
23
|
if (_.isType(options, 'string')) {
|
|
@@ -341,86 +341,91 @@ Rollbar.prototype.lambdaHandler = function (handler, timeoutHandler) {
|
|
|
341
341
|
};
|
|
342
342
|
|
|
343
343
|
Rollbar.prototype.asyncLambdaHandler = function (handler, timeoutHandler) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var custom = {
|
|
344
|
+
const _timeoutHandler = (event, context) => {
|
|
345
|
+
const message = 'Function timed out';
|
|
346
|
+
const custom = {
|
|
348
347
|
originalEvent: event,
|
|
349
348
|
originalRequestId: context.awsRequestId,
|
|
350
349
|
};
|
|
351
|
-
|
|
350
|
+
this.error(message, custom);
|
|
352
351
|
};
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
352
|
+
|
|
353
|
+
const shouldReportTimeouts = this.options.captureLambdaTimeouts;
|
|
354
|
+
|
|
355
|
+
const rollbarAsyncLambdaHandler = (event, context) => {
|
|
356
|
+
return new Promise((resolve, reject) => {
|
|
357
|
+
this.lambdaContext = context;
|
|
357
358
|
if (shouldReportTimeouts) {
|
|
358
|
-
|
|
359
|
+
const timeoutCb = (timeoutHandler || _timeoutHandler).bind(
|
|
359
360
|
null,
|
|
360
361
|
event,
|
|
361
362
|
context,
|
|
362
363
|
);
|
|
363
|
-
|
|
364
|
+
this.lambdaTimeoutHandle = setTimeout(
|
|
364
365
|
timeoutCb,
|
|
365
366
|
context.getRemainingTimeInMillis() - 1000,
|
|
366
367
|
);
|
|
367
368
|
}
|
|
368
369
|
handler(event, context)
|
|
369
|
-
.then(
|
|
370
|
-
|
|
371
|
-
clearTimeout(
|
|
370
|
+
.then((resp) => {
|
|
371
|
+
this.wait(() => {
|
|
372
|
+
clearTimeout(this.lambdaTimeoutHandle);
|
|
372
373
|
resolve(resp);
|
|
373
374
|
});
|
|
374
375
|
})
|
|
375
|
-
.catch(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
clearTimeout(
|
|
376
|
+
.catch((err) => {
|
|
377
|
+
this.error(err);
|
|
378
|
+
this.wait(() => {
|
|
379
|
+
clearTimeout(this.lambdaTimeoutHandle);
|
|
379
380
|
reject(err);
|
|
380
381
|
});
|
|
381
382
|
});
|
|
382
383
|
});
|
|
383
384
|
};
|
|
385
|
+
|
|
386
|
+
return rollbarAsyncLambdaHandler;
|
|
384
387
|
};
|
|
388
|
+
|
|
385
389
|
Rollbar.prototype.syncLambdaHandler = function (handler, timeoutHandler) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
var custom = {
|
|
390
|
+
const _timeoutHandler = (event, context, _cb) => {
|
|
391
|
+
const message = 'Function timed out';
|
|
392
|
+
const custom = {
|
|
390
393
|
originalEvent: event,
|
|
391
394
|
originalRequestId: context.awsRequestId,
|
|
392
395
|
};
|
|
393
|
-
|
|
396
|
+
this.error(message, custom);
|
|
394
397
|
};
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
+
|
|
399
|
+
const shouldReportTimeouts = this.options.captureLambdaTimeouts;
|
|
400
|
+
|
|
401
|
+
return (event, context, callback) => {
|
|
402
|
+
this.lambdaContext = context;
|
|
398
403
|
if (shouldReportTimeouts) {
|
|
399
|
-
|
|
404
|
+
const timeoutCb = (timeoutHandler || _timeoutHandler).bind(
|
|
400
405
|
null,
|
|
401
406
|
event,
|
|
402
407
|
context,
|
|
403
408
|
callback,
|
|
404
409
|
);
|
|
405
|
-
|
|
410
|
+
this.lambdaTimeoutHandle = setTimeout(
|
|
406
411
|
timeoutCb,
|
|
407
412
|
context.getRemainingTimeInMillis() - 1000,
|
|
408
413
|
);
|
|
409
414
|
}
|
|
410
415
|
try {
|
|
411
|
-
handler(event, context,
|
|
416
|
+
handler(event, context, (err, resp) => {
|
|
412
417
|
if (err) {
|
|
413
|
-
|
|
418
|
+
this.error(err);
|
|
414
419
|
}
|
|
415
|
-
|
|
416
|
-
clearTimeout(
|
|
420
|
+
this.wait(() => {
|
|
421
|
+
clearTimeout(this.lambdaTimeoutHandle);
|
|
417
422
|
callback(err, resp);
|
|
418
423
|
});
|
|
419
424
|
});
|
|
420
425
|
} catch (err) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
clearTimeout(
|
|
426
|
+
this.error(err);
|
|
427
|
+
this.wait(() => {
|
|
428
|
+
clearTimeout(this.lambdaTimeoutHandle);
|
|
424
429
|
throw err;
|
|
425
430
|
});
|
|
426
431
|
}
|
|
@@ -646,7 +651,7 @@ Rollbar.prototype.setupUnhandledCapture = function () {
|
|
|
646
651
|
};
|
|
647
652
|
|
|
648
653
|
Rollbar.prototype.handleUncaughtExceptions = function () {
|
|
649
|
-
var exitOnUncaught =
|
|
654
|
+
var exitOnUncaught = Boolean(this.options.exitOnUncaughtException);
|
|
650
655
|
delete this.options.exitOnUncaughtException;
|
|
651
656
|
|
|
652
657
|
addOrReplaceRollbarHandler(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SourceMapConsumer } from 'source-map';
|
|
2
|
-
import path from 'path';
|
|
3
1
|
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import { SourceMapConsumer } from 'source-map';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Uses Node source-map to map transpiled JS stack locations to original
|
|
@@ -46,7 +47,7 @@ function retrieveFile(path) {
|
|
|
46
47
|
if (fs.existsSync(path)) {
|
|
47
48
|
contents = fs.readFileSync(path, 'utf8');
|
|
48
49
|
}
|
|
49
|
-
} catch (
|
|
50
|
+
} catch (_er) {
|
|
50
51
|
/* ignore any errors */
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -58,10 +59,10 @@ function retrieveFile(path) {
|
|
|
58
59
|
function supportRelativeURL(file, url) {
|
|
59
60
|
if (!file) return url;
|
|
60
61
|
var dir = path.dirname(file);
|
|
61
|
-
var match = /^\w+:\/\/[
|
|
62
|
+
var match = /^\w+:\/\/[^/]*/.exec(dir);
|
|
62
63
|
var protocol = match ? match[0] : '';
|
|
63
64
|
var startPath = dir.slice(protocol.length);
|
|
64
|
-
if (protocol && /^\/\w
|
|
65
|
+
if (protocol && /^\/\w:/.test(startPath)) {
|
|
65
66
|
// handle file:///C:/ paths
|
|
66
67
|
protocol += '/';
|
|
67
68
|
return (
|
|
@@ -78,7 +79,7 @@ function retrieveSourceMapURL(source) {
|
|
|
78
79
|
// Get the URL of the source map
|
|
79
80
|
fileData = retrieveFile(source);
|
|
80
81
|
var re =
|
|
81
|
-
/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([
|
|
82
|
+
/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;
|
|
82
83
|
// Keep executing the search to find the *last* sourceMappingURL to avoid
|
|
83
84
|
// picking up sourceMappingURLs from comments, strings, etc.
|
|
84
85
|
var lastMatch, match;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { URL } from 'url';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { merge } from '../../utility.js';
|
|
3
4
|
|
|
4
5
|
// This function replicates the relevant logic in node/lib/http.js as closely
|
|
5
6
|
// as possible in order to produce the same result. Therefore, the code is
|
package/src/server/telemetry.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import https from 'https';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import replace from '../utility/replace.js';
|
|
5
|
+
import * as _ from '../utility.js';
|
|
6
|
+
|
|
5
7
|
import * as urlHelpers from './telemetry/urlHelpers.js';
|
|
6
8
|
|
|
7
9
|
var defaults = {
|
|
@@ -87,9 +89,9 @@ Instrumenter.prototype.instrumentNetwork = function () {
|
|
|
87
89
|
|
|
88
90
|
function networkRequestWrapper(orig) {
|
|
89
91
|
var telemeter = this.telemeter;
|
|
90
|
-
var self = this;
|
|
91
92
|
|
|
92
|
-
return
|
|
93
|
+
return (...args) => {
|
|
94
|
+
const [url, options, cb] = args;
|
|
93
95
|
var mergedOptions = urlHelpers.mergeOptions(url, options, cb);
|
|
94
96
|
|
|
95
97
|
var metadata = {
|
|
@@ -100,23 +102,21 @@ function networkRequestWrapper(orig) {
|
|
|
100
102
|
end_time_ms: null,
|
|
101
103
|
};
|
|
102
104
|
|
|
103
|
-
if (
|
|
105
|
+
if (this.autoInstrument.networkRequestHeaders) {
|
|
104
106
|
metadata.request_headers = mergedOptions.options.headers;
|
|
105
107
|
}
|
|
106
108
|
telemeter.captureNetwork(metadata, 'http');
|
|
107
109
|
|
|
108
|
-
// Call the original method with the original arguments and wrapped callback.
|
|
109
|
-
var wrappedArgs = Array.from(arguments);
|
|
110
110
|
var wrappedCallback = responseCallbackWrapper(
|
|
111
|
-
|
|
111
|
+
this.autoInstrument,
|
|
112
112
|
metadata,
|
|
113
113
|
mergedOptions.cb,
|
|
114
114
|
);
|
|
115
115
|
if (mergedOptions.cb) {
|
|
116
|
-
|
|
116
|
+
args.pop();
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
var req = orig.apply(https,
|
|
118
|
+
args.push(wrappedCallback);
|
|
119
|
+
var req = orig.apply(https, args);
|
|
120
120
|
|
|
121
121
|
req.on('error', (err) => {
|
|
122
122
|
metadata.status_code = 0;
|
package/src/server/transforms.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import url from 'url';
|
|
2
|
+
|
|
1
3
|
import async from 'async';
|
|
2
|
-
import * as parser from './parser.js';
|
|
3
4
|
import requestIp from 'request-ip';
|
|
4
|
-
|
|
5
|
-
import * as _ from '../utility.js';
|
|
5
|
+
|
|
6
6
|
import scrub from '../scrub.js';
|
|
7
|
+
import * as _ from '../utility.js';
|
|
8
|
+
|
|
9
|
+
import * as parser from './parser.js';
|
|
7
10
|
|
|
8
11
|
function baseData(item, options, callback) {
|
|
9
12
|
var environment =
|
|
@@ -17,6 +20,7 @@ function baseData(item, options, callback) {
|
|
|
17
20
|
uuid: item.uuid,
|
|
18
21
|
notifier: JSON.parse(JSON.stringify(options.notifier)),
|
|
19
22
|
custom: item.custom,
|
|
23
|
+
attributes: item.data?.attributes,
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
if (options.codeVersion) {
|
|
@@ -27,7 +31,7 @@ function baseData(item, options, callback) {
|
|
|
27
31
|
|
|
28
32
|
var props = Object.getOwnPropertyNames(item.custom || {});
|
|
29
33
|
props.forEach(function (name) {
|
|
30
|
-
if (!
|
|
34
|
+
if (!_.hasOwn(data, name)) {
|
|
31
35
|
data[name] = item.custom[name];
|
|
32
36
|
}
|
|
33
37
|
});
|
|
@@ -141,7 +145,7 @@ function addRequestData(item, options, callback) {
|
|
|
141
145
|
routePath = req.app._router.matchRequest(req).path;
|
|
142
146
|
item.data.context =
|
|
143
147
|
baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
|
|
144
|
-
} catch (
|
|
148
|
+
} catch (_ignore) {
|
|
145
149
|
// Ignored
|
|
146
150
|
}
|
|
147
151
|
}
|
|
@@ -311,7 +315,7 @@ function _buildRequestData(req) {
|
|
|
311
315
|
var bodyParams = {};
|
|
312
316
|
if (_.isIterable(body)) {
|
|
313
317
|
for (var k in body) {
|
|
314
|
-
if (
|
|
318
|
+
if (_.hasOwn(body, k)) {
|
|
315
319
|
bodyParams[k] = body[k];
|
|
316
320
|
}
|
|
317
321
|
}
|
package/src/server/transport.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import * as _ from '../utility.js';
|
|
2
|
-
import truncation from '../truncation.js';
|
|
3
|
-
import logger from '../logger.js';
|
|
4
|
-
|
|
5
1
|
import http from 'http';
|
|
6
2
|
import https from 'https';
|
|
3
|
+
|
|
7
4
|
import jsonBackup from 'json-stringify-safe';
|
|
8
5
|
|
|
6
|
+
import logger from '../logger.js';
|
|
7
|
+
import truncation from '../truncation.js';
|
|
8
|
+
import * as _ from '../utility.js';
|
|
9
|
+
|
|
9
10
|
var MAX_RATE_LIMIT_INTERVAL = 60;
|
|
10
11
|
|
|
11
12
|
/*
|
|
@@ -37,7 +38,7 @@ Transport.prototype.get = function (
|
|
|
37
38
|
) {
|
|
38
39
|
var t;
|
|
39
40
|
if (!callback || !_.isFunction(callback)) {
|
|
40
|
-
callback =
|
|
41
|
+
callback = () => {};
|
|
41
42
|
}
|
|
42
43
|
options = options || {};
|
|
43
44
|
_.addParamsAndAccessTokenToPath(accessToken, options, params);
|
|
@@ -74,7 +75,7 @@ Transport.prototype.post = function ({
|
|
|
74
75
|
}) {
|
|
75
76
|
var t;
|
|
76
77
|
if (!callback || !_.isFunction(callback)) {
|
|
77
|
-
callback =
|
|
78
|
+
callback = () => {};
|
|
78
79
|
}
|
|
79
80
|
if (_currentTime() < this.rateLimitExpires) {
|
|
80
81
|
return callback(new Error('Exceeded rate limit'));
|
|
@@ -154,7 +155,7 @@ function _headers(accessToken, options, data) {
|
|
|
154
155
|
if (data) {
|
|
155
156
|
try {
|
|
156
157
|
headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|
157
|
-
} catch (
|
|
158
|
+
} catch (_e) {
|
|
158
159
|
logger.error('Could not get the content length of the data');
|
|
159
160
|
}
|
|
160
161
|
}
|
package/src/telemetry.js
CHANGED
|
@@ -40,7 +40,7 @@ class Telemeter {
|
|
|
40
40
|
events.splice(i, 1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
} catch (
|
|
43
|
+
} catch (_e) {
|
|
44
44
|
this.options.filterTelemetry = null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -49,7 +49,9 @@ class Telemeter {
|
|
|
49
49
|
events = events.filter((e) => e.type !== 'connectivity');
|
|
50
50
|
|
|
51
51
|
// Remove internal keys from output
|
|
52
|
-
events = events.map(
|
|
52
|
+
events = events.map(
|
|
53
|
+
({ otelAttributes: _otelAttributes, ...event }) => event,
|
|
54
|
+
);
|
|
53
55
|
|
|
54
56
|
return events;
|
|
55
57
|
}
|
|
@@ -90,7 +92,7 @@ class Telemeter {
|
|
|
90
92
|
) {
|
|
91
93
|
return false;
|
|
92
94
|
}
|
|
93
|
-
} catch (
|
|
95
|
+
} catch (_exc) {
|
|
94
96
|
this.options.filterTelemetry = null;
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -132,29 +134,16 @@ class Telemeter {
|
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
captureLog(message, level, rollbarUUID, timestamp) {
|
|
135
|
-
|
|
137
|
+
const event = rollbarUUID
|
|
138
|
+
? 'rollbar-occurrence-event'
|
|
139
|
+
: 'rollbar-log-event';
|
|
140
|
+
const otelAttributes = {
|
|
141
|
+
message,
|
|
142
|
+
level,
|
|
143
|
+
...(rollbarUUID ? { type: 'message', uuid: rollbarUUID } : {}),
|
|
144
|
+
};
|
|
136
145
|
|
|
137
|
-
|
|
138
|
-
if (rollbarUUID) {
|
|
139
|
-
((otelAttributes = {
|
|
140
|
-
message,
|
|
141
|
-
level,
|
|
142
|
-
type: 'message',
|
|
143
|
-
uuid: rollbarUUID,
|
|
144
|
-
}),
|
|
145
|
-
this.telemetrySpan?.addEvent(
|
|
146
|
-
'rollbar-occurrence-event',
|
|
147
|
-
otelAttributes,
|
|
148
|
-
fromMillis(timestamp),
|
|
149
|
-
));
|
|
150
|
-
} else {
|
|
151
|
-
otelAttributes = { message, level };
|
|
152
|
-
this.telemetrySpan?.addEvent(
|
|
153
|
-
'rollbar-log-event',
|
|
154
|
-
otelAttributes,
|
|
155
|
-
fromMillis(timestamp),
|
|
156
|
-
);
|
|
157
|
-
}
|
|
146
|
+
this.telemetrySpan?.addEvent(event, otelAttributes, fromMillis(timestamp));
|
|
158
147
|
|
|
159
148
|
return this.capture(
|
|
160
149
|
'log',
|
|
@@ -183,6 +172,14 @@ class Telemeter {
|
|
|
183
172
|
'response.headers': JSON.stringify(metadata.response?.headers || {}),
|
|
184
173
|
'response.timeUnixNano': endTimeNano.toString(),
|
|
185
174
|
};
|
|
175
|
+
const requestBody = metadata.request;
|
|
176
|
+
const responseBody = metadata.response?.body;
|
|
177
|
+
if (requestBody) {
|
|
178
|
+
otelAttributes['request.body'] = JSON.stringify(requestBody);
|
|
179
|
+
}
|
|
180
|
+
if (responseBody) {
|
|
181
|
+
otelAttributes['response.body'] = JSON.stringify(responseBody);
|
|
182
|
+
}
|
|
186
183
|
|
|
187
184
|
this.telemetrySpan?.addEvent(
|
|
188
185
|
'rollbar-network-event',
|
package/src/tracing/tracer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Span } from './span.js';
|
|
2
1
|
import id from './id.js';
|
|
2
|
+
import { Span } from './span.js';
|
|
3
3
|
|
|
4
4
|
export class Tracer {
|
|
5
5
|
constructor(tracing, spanProcessor) {
|
|
@@ -39,7 +39,7 @@ export class Tracer {
|
|
|
39
39
|
const span = new Span({
|
|
40
40
|
resource: resource,
|
|
41
41
|
scope: this.tracing.scope,
|
|
42
|
-
session: this.tracing.session
|
|
42
|
+
session: this.tracing.session?.session,
|
|
43
43
|
context,
|
|
44
44
|
spanContext,
|
|
45
45
|
name,
|
package/src/tracing/tracing.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContextManager, createContextKey } from './contextManager.js';
|
|
2
|
-
import { Session } from './session.js';
|
|
3
2
|
import { SpanExporter } from './exporter.js';
|
|
3
|
+
import id from './id.js';
|
|
4
|
+
import { Session } from './session.js';
|
|
4
5
|
import { SpanProcessor } from './spanProcessor.js';
|
|
5
6
|
import { Tracer } from './tracer.js';
|
|
6
|
-
import id from './id.js';
|
|
7
7
|
|
|
8
8
|
const SPAN_KEY = createContextKey('Rollbar Context Key SPAN');
|
|
9
9
|
|
package/src/truncation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as _ from './utility.js';
|
|
2
1
|
import traverse from './utility/traverse.js';
|
|
2
|
+
import * as _ from './utility.js';
|
|
3
3
|
|
|
4
4
|
function raw(payload, jsonBackup) {
|
|
5
5
|
return [payload, _.stringify(payload, jsonBackup)];
|
|
@@ -19,10 +19,10 @@ function truncateFrames(payload, jsonBackup, range) {
|
|
|
19
19
|
var frames;
|
|
20
20
|
if (body.trace_chain) {
|
|
21
21
|
var chain = body.trace_chain;
|
|
22
|
-
for (
|
|
23
|
-
frames =
|
|
22
|
+
for (const trace of chain) {
|
|
23
|
+
frames = trace.frames;
|
|
24
24
|
frames = selectFrames(frames, range);
|
|
25
|
-
|
|
25
|
+
trace.frames = frames;
|
|
26
26
|
}
|
|
27
27
|
} else if (body.trace) {
|
|
28
28
|
frames = body.trace.frames;
|
|
@@ -74,8 +74,8 @@ function minBody(payload, jsonBackup) {
|
|
|
74
74
|
var body = payload.data.body;
|
|
75
75
|
if (body.trace_chain) {
|
|
76
76
|
var chain = body.trace_chain;
|
|
77
|
-
for (
|
|
78
|
-
chain[
|
|
77
|
+
for (const [index, trace] of chain.entries()) {
|
|
78
|
+
chain[index] = truncateTraceData(trace);
|
|
79
79
|
}
|
|
80
80
|
} else if (body.trace) {
|
|
81
81
|
body.trace = truncateTraceData(body.trace);
|
package/src/utility/headers.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { hasOwn } from '../utility.js';
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* headers - Detect when fetch Headers are undefined and use a partial polyfill.
|
|
3
5
|
*
|
|
@@ -72,12 +74,12 @@ FetchHeaders.prototype.get = function (name) {
|
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
FetchHeaders.prototype.has = function (name) {
|
|
75
|
-
return this.map
|
|
77
|
+
return hasOwn(this.map, normalizeName(name));
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
FetchHeaders.prototype.forEach = function (callback, thisArg) {
|
|
79
81
|
for (var name in this.map) {
|
|
80
|
-
if (this.map
|
|
82
|
+
if (hasOwn(this.map, name)) {
|
|
81
83
|
callback.call(thisArg, this.map[name], name, this);
|
|
82
84
|
}
|
|
83
85
|
}
|