@coralogix/browser 2.13.0 → 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/CHANGELOG.md +35 -0
- package/README.md +18 -0
- package/index.esm2.js +18 -10
- package/package.json +1 -1
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +1 -1
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
# 3.0.0 (2025-12-25)
|
|
2
|
+
|
|
3
|
+
### 🔥 Performance
|
|
4
|
+
|
|
5
|
+
- ⚠️ **browser:** disable TBT metric by default to reduce overhead.
|
|
6
|
+
|
|
7
|
+
### ⚠️ Breaking Changes
|
|
8
|
+
|
|
9
|
+
- TBT web-vitals metric is no longer collected by default. Enable it explicitly via config.
|
|
10
|
+
|
|
11
|
+
**For example**:
|
|
12
|
+
|
|
13
|
+
**Before**
|
|
14
|
+
All Web Vitals instrumentation metrics are enabled by default.
|
|
15
|
+
|
|
16
|
+
**After**
|
|
17
|
+
To enable the **TBT** metric, explicitly configure it as shown below:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"instrumentations": {
|
|
22
|
+
"web_vitals": {
|
|
23
|
+
"metrics": {
|
|
24
|
+
"tbt": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
## 2.14.0 (2025-12-07)
|
|
31
|
+
|
|
32
|
+
### 🚀 Features
|
|
33
|
+
|
|
34
|
+
- **errors:** add stack traces to console error logs
|
|
35
|
+
|
|
1
36
|
## 2.13.0 (2025-12-07)
|
|
2
37
|
|
|
3
38
|
### 🩹 Fixes
|
package/README.md
CHANGED
|
@@ -242,6 +242,24 @@ CoralogixRum.init({
|
|
|
242
242
|
});
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
+
##### Web Vitals: TBT metric
|
|
246
|
+
|
|
247
|
+
By default, the **TBT** (Total Blocking Time) metric is disabled.
|
|
248
|
+
To enable it, explicitly configure it as shown below:
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"instrumentations": {
|
|
253
|
+
"web_vitals": {
|
|
254
|
+
"enabled": true,
|
|
255
|
+
"metrics": {
|
|
256
|
+
"tbt": true
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
245
263
|
### Manually Capture Errors
|
|
246
264
|
|
|
247
265
|
You can pass an Error object to capture it as an event.<br>
|
package/index.esm2.js
CHANGED
|
@@ -503,7 +503,8 @@ var _consoleErrorHandler = function (errorInstrumentation) {
|
|
|
503
503
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
504
504
|
args[_i] = arguments[_i];
|
|
505
505
|
}
|
|
506
|
-
|
|
506
|
+
var stackContextError = new Error();
|
|
507
|
+
errorInstrumentation.report(ErrorSource.CONSOLE, args, stackContextError);
|
|
507
508
|
return original.apply(console, args);
|
|
508
509
|
};
|
|
509
510
|
};
|
|
@@ -555,7 +556,7 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
555
556
|
CxGlobal.removeEventListener('unhandledrejection', _unhandledRejectionListener(this));
|
|
556
557
|
document.documentElement.removeEventListener('error', _documentErrorListener(this), { capture: true });
|
|
557
558
|
};
|
|
558
|
-
CoralogixErrorInstrumentation.prototype.report = function (source, arg) {
|
|
559
|
+
CoralogixErrorInstrumentation.prototype.report = function (source, arg, stackContextError) {
|
|
559
560
|
var _this = this;
|
|
560
561
|
if (arg instanceof Array) {
|
|
561
562
|
if (arg.length === 0) {
|
|
@@ -573,7 +574,7 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
573
574
|
this.reportEvent(source, arg);
|
|
574
575
|
break;
|
|
575
576
|
case typeof arg === 'string':
|
|
576
|
-
this.reportString(source, arg);
|
|
577
|
+
this.reportString(source, arg, stackContextError);
|
|
577
578
|
break;
|
|
578
579
|
case arg instanceof Array: {
|
|
579
580
|
var firstError = arg.find(function (x) { return x instanceof Error; });
|
|
@@ -582,7 +583,8 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
582
583
|
return typeof msg === 'string' ? msg : _this.parseErrorObject(msg);
|
|
583
584
|
})
|
|
584
585
|
.join(' ');
|
|
585
|
-
|
|
586
|
+
var stackSourceError = firstError !== null && firstError !== void 0 ? firstError : stackContextError;
|
|
587
|
+
this.reportString(source, message, stackSourceError);
|
|
586
588
|
break;
|
|
587
589
|
}
|
|
588
590
|
default:
|
|
@@ -617,7 +619,7 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
617
619
|
});
|
|
618
620
|
});
|
|
619
621
|
};
|
|
620
|
-
CoralogixErrorInstrumentation.prototype.reportString = function (source, message,
|
|
622
|
+
CoralogixErrorInstrumentation.prototype.reportString = function (source, message, stackError) {
|
|
621
623
|
return __awaiter(this, void 0, void 0, function () {
|
|
622
624
|
var span;
|
|
623
625
|
return __generator(this, function (_a) {
|
|
@@ -627,8 +629,8 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
627
629
|
addErrorDefaultAttributes(span);
|
|
628
630
|
span.setAttribute(CoralogixAttributes.SOURCE, source);
|
|
629
631
|
span.setAttribute(ErrorAttributes.MESSAGE, message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT));
|
|
630
|
-
if (!
|
|
631
|
-
return [4, buildStacktrace(span,
|
|
632
|
+
if (!stackError) return [3, 2];
|
|
633
|
+
return [4, buildStacktrace(span, stackError)];
|
|
632
634
|
case 1:
|
|
633
635
|
_a.sent();
|
|
634
636
|
_a.label = 2;
|
|
@@ -947,6 +949,9 @@ var CoralogixFetchInstrumentation = (function (_super) {
|
|
|
947
949
|
return __generator(this, function (_b) {
|
|
948
950
|
switch (_b.label) {
|
|
949
951
|
case 0:
|
|
952
|
+
if (!span.isRecording()) {
|
|
953
|
+
return [2];
|
|
954
|
+
}
|
|
950
955
|
status = response.status;
|
|
951
956
|
networkExtraConfig = getSdkConfig().networkExtraConfig;
|
|
952
957
|
url = span.attributes['http.url'] ||
|
|
@@ -1083,6 +1088,9 @@ var CoralogixXhrInstrumentation = (function (_super) {
|
|
|
1083
1088
|
}
|
|
1084
1089
|
CoralogixXhrInstrumentation.prototype.setNetworkSpanAttributes = function (span, xhr) {
|
|
1085
1090
|
var _a;
|
|
1091
|
+
if (!span.isRecording()) {
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1086
1094
|
var status = xhr.status;
|
|
1087
1095
|
var networkExtraConfig = getSdkConfig().networkExtraConfig;
|
|
1088
1096
|
var resolvedConfig = this.networkDataManager.resolveConfigForUrl(xhr.responseURL, networkExtraConfig);
|
|
@@ -1231,7 +1239,7 @@ var ALL_WEB_VITALS_METRICS = {
|
|
|
1231
1239
|
fcp: true,
|
|
1232
1240
|
inp: true,
|
|
1233
1241
|
ttfb: true,
|
|
1234
|
-
tbt:
|
|
1242
|
+
tbt: false,
|
|
1235
1243
|
lt: true,
|
|
1236
1244
|
};
|
|
1237
1245
|
var LONGTASK_DURATION = 50;
|
|
@@ -1569,7 +1577,7 @@ var CoralogixWebVitalsInstrumentation = (function (_super) {
|
|
|
1569
1577
|
};
|
|
1570
1578
|
_this.metrics = isEmpty(config.metrics)
|
|
1571
1579
|
? ALL_WEB_VITALS_METRICS
|
|
1572
|
-
: config.metrics;
|
|
1580
|
+
: __assign(__assign({}, ALL_WEB_VITALS_METRICS), config.metrics);
|
|
1573
1581
|
if (!isPerformanceObserverSupported()) {
|
|
1574
1582
|
return _this;
|
|
1575
1583
|
}
|
|
@@ -4130,7 +4138,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4130
4138
|
return resolvedUrlBlueprinters;
|
|
4131
4139
|
}
|
|
4132
4140
|
|
|
4133
|
-
var SDK_VERSION = '
|
|
4141
|
+
var SDK_VERSION = '3.0.0';
|
|
4134
4142
|
|
|
4135
4143
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4136
4144
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export declare class CoralogixErrorInstrumentation extends InstrumentationBase {
|
|
|
23
23
|
protected init(): void;
|
|
24
24
|
enable(): void;
|
|
25
25
|
disable(): void;
|
|
26
|
-
report(source: ErrorSource, arg: string | Error | Event | ErrorEvent | Array<any
|
|
26
|
+
report(source: ErrorSource, arg: string | Error | Event | ErrorEvent | Array<any>, stackContextError?: Error): void;
|
|
27
27
|
parseErrorObject: (obj: any) => string;
|
|
28
28
|
reportError(source: ErrorSource, err: Error, customData?: unknown, labels?: CoralogixRumLabels): Promise<void>;
|
|
29
29
|
private reportString;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "3.0.0";
|