@coralogix/browser 3.5.0 → 3.5.1
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/CHANGELOG.md +6 -0
- package/README.md +33 -17
- package/index.esm2.js +39 -22
- package/package.json +1 -1
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +4 -1
- package/src/otel/rum-span-attributes.types.d.ts +1 -0
- package/src/types.d.ts +1 -0
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -25,33 +25,34 @@
|
|
|
25
25
|
11. [Multi Page Application](#multi-page-application)
|
|
26
26
|
12. [Ignore Errors](#ignore-errors)
|
|
27
27
|
13. [Ignore URLs](#ignore-urls)
|
|
28
|
-
14. [
|
|
29
|
-
15. [
|
|
30
|
-
16. [
|
|
31
|
-
17. [
|
|
28
|
+
14. [Stack Trace Limit](#stack-trace-limit)
|
|
29
|
+
15. [Mask Elements](#mask-elements)
|
|
30
|
+
16. [Label Providers](#label-providers)
|
|
31
|
+
17. [URL Blueprinters](#url-blueprinters)
|
|
32
|
+
18. [Traces](#traces)
|
|
32
33
|
|
|
33
34
|
- [Propagate Trace Header for CORS URLs](#propagatetraceheadercorsurls)
|
|
34
35
|
- [Allowed Tracing URLs](#allowedtracingurls)
|
|
35
36
|
- [Extra Propagators (B3 / AWS X-Ray)](#b3--aws-x-ray-propagation)
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
19. [Before Send](#before-send)
|
|
39
|
+
20. [Proxy URL](#proxy-url)
|
|
40
|
+
21. [Collect IP Data](#collect-ip-data)
|
|
41
|
+
22. [Custom Measurement](#custom-measurement)
|
|
42
|
+
23. [Add Timing](#add-timing)
|
|
43
|
+
24. [Custom Time Measurement](#custom-time-measurement)
|
|
44
|
+
25. [Microfrontend Support](#microfrontend-support)
|
|
44
45
|
|
|
45
46
|
- [Pre Requisites](#pre-requisites)
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
26. [Custom Spans](#custom-spans)
|
|
48
49
|
|
|
49
50
|
- [Ignored Instruments](#ignored-instruments)
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
27. [Soft Navigations (Experimental)](#soft-navigations--experimental)
|
|
53
|
+
28. [Memory Usage (Experimental)](#memory-usage---experimental)
|
|
54
|
+
29. [Angular Zone.js Configuration](#angular-zonejs-configuration)
|
|
55
|
+
30. [CDN](#cdn)
|
|
55
56
|
|
|
56
57
|
- [Specific Version](#specific-version-recommended)
|
|
57
58
|
- [Add the CDN Script to Your Application](#add-the-cdn-script-to-your-application)
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
- [Via JS File](#via-js-file)
|
|
60
61
|
- [Via TS File](#via-ts-file)
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
31. [Flutter Web](#flutter-web)
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
@@ -495,6 +496,21 @@ CoralogixRum.init({
|
|
|
495
496
|
});
|
|
496
497
|
```
|
|
497
498
|
|
|
499
|
+
### Stack Trace Limit
|
|
500
|
+
|
|
501
|
+
Browsers typically capture 10 stack frames by default. If your error stack traces are being truncated and you need to see deeper into the call stack, you can increase this limit using the `stackTraceLimit` option.
|
|
502
|
+
|
|
503
|
+
```javascript
|
|
504
|
+
import { CoralogixRum } from '@coralogix/browser';
|
|
505
|
+
|
|
506
|
+
CoralogixRum.init({
|
|
507
|
+
// ...
|
|
508
|
+
stackTraceLimit: 50,
|
|
509
|
+
});
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
> **Note:** Higher values may have a performance impact, as the browser needs to capture more frames each time an error is created.
|
|
513
|
+
|
|
498
514
|
### Mask elements
|
|
499
515
|
|
|
500
516
|
User interactions capture text from clickable elements only (button, label, link, input, option).
|
package/index.esm2.js
CHANGED
|
@@ -369,7 +369,8 @@ function getCustomMergedLabels(labels) {
|
|
|
369
369
|
|
|
370
370
|
var CACHED_METADATA_KEY = '__cx_metadata__';
|
|
371
371
|
var ERROR_INSTRUMENTATION_VERSION = '1';
|
|
372
|
-
var
|
|
372
|
+
var STACK_FRAME_LIMIT = 50;
|
|
373
|
+
var STACK_LINE_LIMIT = 1024;
|
|
373
374
|
var MESSAGE_LIMIT = 1024;
|
|
374
375
|
var MFE_PATH_PATTERN = /https?:\/\/.*\//;
|
|
375
376
|
function extractMfePath(fileName) {
|
|
@@ -393,29 +394,42 @@ var ErrorSource;
|
|
|
393
394
|
ErrorSource["CAPTURED"] = "captured";
|
|
394
395
|
ErrorSource["WEB_WORKER"] = "web_worker";
|
|
395
396
|
})(ErrorSource || (ErrorSource = {}));
|
|
397
|
+
function parseStackFrames(err) {
|
|
398
|
+
var stack = err.stack, message = err.message, name = err.name;
|
|
399
|
+
if (!stack) {
|
|
400
|
+
return [];
|
|
401
|
+
}
|
|
402
|
+
var sanitizedStack = stack
|
|
403
|
+
.split('\n')
|
|
404
|
+
.map(function (line) { return line.slice(0, STACK_LINE_LIMIT); })
|
|
405
|
+
.join('\n');
|
|
406
|
+
return ErrorStackParser.parse({
|
|
407
|
+
stack: sanitizedStack,
|
|
408
|
+
message: message,
|
|
409
|
+
name: name,
|
|
410
|
+
})
|
|
411
|
+
.slice(0, STACK_FRAME_LIMIT)
|
|
412
|
+
.map(function (_a) {
|
|
413
|
+
var fileName = _a.fileName, columnNumber = _a.columnNumber, lineNumber = _a.lineNumber, functionName = _a.functionName;
|
|
414
|
+
return ({
|
|
415
|
+
fileName: fileName,
|
|
416
|
+
columnNumber: columnNumber,
|
|
417
|
+
lineNumber: lineNumber,
|
|
418
|
+
functionName: functionName,
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
}
|
|
396
422
|
function buildStacktrace(span, err) {
|
|
397
423
|
return __awaiter(this, void 0, void 0, function () {
|
|
398
|
-
var
|
|
424
|
+
var stackFrames, supportMfe;
|
|
399
425
|
return __generator(this, function (_a) {
|
|
400
426
|
switch (_a.label) {
|
|
401
427
|
case 0:
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
428
|
+
stackFrames = parseStackFrames(err);
|
|
429
|
+
if (stackFrames.length === 0) {
|
|
430
|
+
return [2];
|
|
431
|
+
}
|
|
405
432
|
supportMfe = getSdkConfig().supportMfe;
|
|
406
|
-
stackFrames = ErrorStackParser.parse({
|
|
407
|
-
stack: stack.substring(0, STACK_LIMIT),
|
|
408
|
-
message: message,
|
|
409
|
-
name: name,
|
|
410
|
-
}).map(function (_a) {
|
|
411
|
-
var fileName = _a.fileName, columnNumber = _a.columnNumber, lineNumber = _a.lineNumber, functionName = _a.functionName;
|
|
412
|
-
return ({
|
|
413
|
-
fileName: fileName,
|
|
414
|
-
columnNumber: columnNumber,
|
|
415
|
-
lineNumber: lineNumber,
|
|
416
|
-
functionName: functionName,
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
433
|
if (!supportMfe) return [3, 2];
|
|
420
434
|
return [4, handleMFE(stackFrames, span)];
|
|
421
435
|
case 1:
|
|
@@ -423,8 +437,7 @@ function buildStacktrace(span, err) {
|
|
|
423
437
|
_a.label = 2;
|
|
424
438
|
case 2:
|
|
425
439
|
span[ErrorAttributes.STACK] = stackFrames;
|
|
426
|
-
|
|
427
|
-
case 3: return [2];
|
|
440
|
+
return [2];
|
|
428
441
|
}
|
|
429
442
|
});
|
|
430
443
|
});
|
|
@@ -551,6 +564,10 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
551
564
|
}
|
|
552
565
|
CoralogixErrorInstrumentation.prototype.init = function () { };
|
|
553
566
|
CoralogixErrorInstrumentation.prototype.enable = function () {
|
|
567
|
+
var stackTraceLimit = getSdkConfig().stackTraceLimit;
|
|
568
|
+
if (stackTraceLimit) {
|
|
569
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
570
|
+
}
|
|
554
571
|
shimmer_1.wrap(console, 'error', _consoleErrorHandler(this));
|
|
555
572
|
CxGlobal.addEventListener('error', _errorListener(this));
|
|
556
573
|
CxGlobal.addEventListener('unhandledrejection', _unhandledRejectionListener(this));
|
|
@@ -4207,7 +4224,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4207
4224
|
return resolvedUrlBlueprinters;
|
|
4208
4225
|
}
|
|
4209
4226
|
|
|
4210
|
-
var SDK_VERSION = '3.5.
|
|
4227
|
+
var SDK_VERSION = '3.5.1';
|
|
4211
4228
|
|
|
4212
4229
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4213
4230
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4318,7 +4335,7 @@ function flattenToAttributes(obj, prefix) {
|
|
|
4318
4335
|
function buildRumContextAttributes(cxRumEvent, resolvedLabels) {
|
|
4319
4336
|
var session_context = cxRumEvent.session_context, page_context = cxRumEvent.page_context, event_context = cxRumEvent.event_context, error_context = cxRumEvent.error_context, network_request_context = cxRumEvent.network_request_context;
|
|
4320
4337
|
var prefixedLabels = flattenToAttributes(resolvedLabels, 'cx_rum.labels.');
|
|
4321
|
-
return buildCxRumSpanAttributes(__assign(__assign({ 'cx_rum.browser_sdk.version': cxRumEvent.browser_sdk.version, 'cx_rum.platform': cxRumEvent.platform, 'cx_rum.environment': cxRumEvent.environment, 'cx_rum.version_metadata.app_name': cxRumEvent.version_metadata.app_name, 'cx_rum.version_metadata.app_version': cxRumEvent.version_metadata.app_version }, prefixedLabels), { 'cx_rum.session_context.os': session_context === null || session_context === void 0 ? void 0 : session_context.os, 'cx_rum.session_context.osVersion': session_context === null || session_context === void 0 ? void 0 : session_context.osVersion, 'cx_rum.session_context.browser': session_context === null || session_context === void 0 ? void 0 : session_context.browser, 'cx_rum.session_context.browserVersion': session_context === null || session_context === void 0 ? void 0 : session_context.browserVersion, 'cx_rum.session_context.device': session_context === null || session_context === void 0 ? void 0 : session_context.device, 'cx_rum.session_context.user_agent': session_context === null || session_context === void 0 ? void 0 : session_context.user_agent, 'cx_rum.session_context.user_email': session_context === null || session_context === void 0 ? void 0 : session_context.user_email, 'cx_rum.session_context.user_id': session_context === null || session_context === void 0 ? void 0 : session_context.user_id, 'cx_rum.session_context.user_name': session_context === null || session_context === void 0 ? void 0 : session_context.user_name, 'cx_rum.page_context.page_fragments': page_context === null || page_context === void 0 ? void 0 : page_context.page_fragments, 'cx_rum.page_context.page_url_blueprint': page_context === null || page_context === void 0 ? void 0 : page_context.page_url_blueprint, 'cx_rum.event_context.type': event_context === null || event_context === void 0 ? void 0 : event_context.type, 'cx_rum.event_context.severity': event_context === null || event_context === void 0 ? void 0 : event_context.severity, 'cx_rum.error_context.error_type': error_context === null || error_context === void 0 ? void 0 : error_context.error_type, 'cx_rum.error_context.error_message': error_context === null || error_context === void 0 ? void 0 : error_context.error_message, 'cx_rum.network_request_context.fragments': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.fragments, 'cx_rum.network_request_context.url': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.url, 'cx_rum.network_request_context.status_code': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.status_code, 'cx_rum.network_request_context.method': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.method }));
|
|
4338
|
+
return buildCxRumSpanAttributes(__assign(__assign({ 'cx_rum.browser_sdk.version': cxRumEvent.browser_sdk.version, 'cx_rum.platform': cxRumEvent.platform, 'cx_rum.environment': cxRumEvent.environment, 'cx_rum.version_metadata.app_name': cxRumEvent.version_metadata.app_name, 'cx_rum.version_metadata.app_version': cxRumEvent.version_metadata.app_version }, prefixedLabels), { 'cx_rum.session_context.session_id': session_context === null || session_context === void 0 ? void 0 : session_context.session_id, 'cx_rum.session_context.os': session_context === null || session_context === void 0 ? void 0 : session_context.os, 'cx_rum.session_context.osVersion': session_context === null || session_context === void 0 ? void 0 : session_context.osVersion, 'cx_rum.session_context.browser': session_context === null || session_context === void 0 ? void 0 : session_context.browser, 'cx_rum.session_context.browserVersion': session_context === null || session_context === void 0 ? void 0 : session_context.browserVersion, 'cx_rum.session_context.device': session_context === null || session_context === void 0 ? void 0 : session_context.device, 'cx_rum.session_context.user_agent': session_context === null || session_context === void 0 ? void 0 : session_context.user_agent, 'cx_rum.session_context.user_email': session_context === null || session_context === void 0 ? void 0 : session_context.user_email, 'cx_rum.session_context.user_id': session_context === null || session_context === void 0 ? void 0 : session_context.user_id, 'cx_rum.session_context.user_name': session_context === null || session_context === void 0 ? void 0 : session_context.user_name, 'cx_rum.page_context.page_fragments': page_context === null || page_context === void 0 ? void 0 : page_context.page_fragments, 'cx_rum.page_context.page_url_blueprint': page_context === null || page_context === void 0 ? void 0 : page_context.page_url_blueprint, 'cx_rum.event_context.type': event_context === null || event_context === void 0 ? void 0 : event_context.type, 'cx_rum.event_context.severity': event_context === null || event_context === void 0 ? void 0 : event_context.severity, 'cx_rum.error_context.error_type': error_context === null || error_context === void 0 ? void 0 : error_context.error_type, 'cx_rum.error_context.error_message': error_context === null || error_context === void 0 ? void 0 : error_context.error_message, 'cx_rum.network_request_context.fragments': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.fragments, 'cx_rum.network_request_context.url': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.url, 'cx_rum.network_request_context.status_code': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.status_code, 'cx_rum.network_request_context.method': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.method }));
|
|
4322
4339
|
}
|
|
4323
4340
|
|
|
4324
4341
|
var CoralogixSpanMapProcessor = (function () {
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
|
-
import { CoralogixRumLabels } from '../types';
|
|
2
|
+
import { CoralogixRumLabels, CxStackFrame } from '../types';
|
|
3
|
+
export declare const STACK_FRAME_LIMIT = 50;
|
|
4
|
+
export declare const STACK_LINE_LIMIT = 1024;
|
|
3
5
|
export declare function extractMfePath(fileName: string): string | undefined;
|
|
4
6
|
export declare const ERROR_INSTRUMENTATION_NAME = "errors";
|
|
5
7
|
export declare const ErrorAttributes: {
|
|
@@ -19,6 +21,7 @@ export declare enum ErrorSource {
|
|
|
19
21
|
interface CoralogixErrorInstrumentationConfig extends InstrumentationConfig {
|
|
20
22
|
ignoreErrors?: Array<string | RegExp>;
|
|
21
23
|
}
|
|
24
|
+
export declare function parseStackFrames(err: Error): CxStackFrame[];
|
|
22
25
|
export declare class CoralogixErrorInstrumentation extends InstrumentationBase {
|
|
23
26
|
constructor(config: CoralogixErrorInstrumentationConfig);
|
|
24
27
|
protected init(): void;
|
|
@@ -6,6 +6,7 @@ export interface CxRumSpanAttributes extends Attributes {
|
|
|
6
6
|
'cx_rum.environment'?: string;
|
|
7
7
|
'cx_rum.version_metadata.app_name'?: string;
|
|
8
8
|
'cx_rum.version_metadata.app_version'?: string;
|
|
9
|
+
'cx_rum.session_context.session_id'?: string;
|
|
9
10
|
'cx_rum.session_context.os'?: string;
|
|
10
11
|
'cx_rum.session_context.osVersion'?: string;
|
|
11
12
|
'cx_rum.session_context.browser'?: string;
|
package/src/types.d.ts
CHANGED
|
@@ -138,6 +138,7 @@ export interface CoralogixBrowserSdkConfig {
|
|
|
138
138
|
labels?: CoralogixRumLabels;
|
|
139
139
|
ignoreUrls?: Array<string | RegExp>;
|
|
140
140
|
ignoreErrors?: Array<string | RegExp>;
|
|
141
|
+
stackTraceLimit?: number;
|
|
141
142
|
instrumentations?: CoralogixOtelWebOptionsInstrumentations;
|
|
142
143
|
traceParentInHeader?: TraceHeaderConfiguration;
|
|
143
144
|
environment?: string;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.5.
|
|
1
|
+
export declare const SDK_VERSION = "3.5.1";
|