@coralogix/browser 2.12.0 → 2.14.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
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
## 2.14.0 (2025-12-07)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **errors:** add stack traces to console error logs
|
|
6
|
+
|
|
7
|
+
## 2.13.0 (2025-12-07)
|
|
8
|
+
|
|
9
|
+
### 🩹 Fixes
|
|
10
|
+
|
|
11
|
+
- **traces-exporter:** improve trace metadata encoding
|
|
12
|
+
|
|
1
13
|
## 2.12.0 (2025-11-30)
|
|
2
14
|
|
|
3
15
|
### 🚀 Features
|
|
4
16
|
|
|
5
17
|
- Introduced the tracesExporter callback, enabling custom processing or exporting of collected trace events.
|
|
6
18
|
|
|
7
|
-
|
|
8
19
|
## 2.11.1 (2025-11-24)
|
|
9
20
|
|
|
10
21
|
### 🩹 Fixes
|
package/README.md
CHANGED
|
@@ -660,6 +660,7 @@ CoralogixRum.init({
|
|
|
660
660
|
```
|
|
661
661
|
|
|
662
662
|
#### Custom Propagation
|
|
663
|
+
|
|
663
664
|
```javascript
|
|
664
665
|
CoralogixRum.init({
|
|
665
666
|
// ...
|
|
@@ -773,8 +774,10 @@ CoralogixRum.init({
|
|
|
773
774
|
```
|
|
774
775
|
|
|
775
776
|
#### ignoreProxyUrlParams
|
|
777
|
+
|
|
776
778
|
If you want the SDK to ignore the cxforward parameter and always send data to the proxy URL directly, you can use the ignoreProxyUrlParams option.
|
|
777
779
|
By default, this option is disabled.
|
|
780
|
+
|
|
778
781
|
```javascript
|
|
779
782
|
CoralogixRum.init({
|
|
780
783
|
// ...
|
|
@@ -904,7 +907,7 @@ const customTracer = CoralogixRum.getCustomTracer({
|
|
|
904
907
|
### Traces Exporter
|
|
905
908
|
|
|
906
909
|
The `tracesExporter` callback gives you full control over how collected trace events are handled.
|
|
907
|
-
It receives a `
|
|
910
|
+
It receives a `TraceExporterData` object containing all trace data that the SDK has collected.
|
|
908
911
|
|
|
909
912
|
```ts
|
|
910
913
|
CoralogixRum.init({
|
|
@@ -917,12 +920,10 @@ CoralogixRum.init({
|
|
|
917
920
|
},
|
|
918
921
|
body: JSON.stringify(data),
|
|
919
922
|
});
|
|
920
|
-
|
|
921
923
|
},
|
|
922
924
|
});
|
|
923
925
|
```
|
|
924
926
|
|
|
925
|
-
|
|
926
927
|
### Soft Navigations — Experimental
|
|
927
928
|
|
|
928
929
|
Soft navigations are navigations that do not trigger a full page reload, such as SPA navigations. Defaults to false.
|
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);
|
|
@@ -3427,16 +3435,6 @@ function timestampToNanosString(timestamp) {
|
|
|
3427
3435
|
var nanosPart = String(nanos).padStart(9, '0');
|
|
3428
3436
|
return secondsPart + nanosPart;
|
|
3429
3437
|
}
|
|
3430
|
-
function hexToBase64(hex) {
|
|
3431
|
-
if (!hex)
|
|
3432
|
-
return '';
|
|
3433
|
-
var binary = '';
|
|
3434
|
-
for (var i = 0; i < hex.length; i += 2) {
|
|
3435
|
-
var byte = Number.parseInt(hex.slice(i, i + 2), 16);
|
|
3436
|
-
binary += String.fromCharCode(byte);
|
|
3437
|
-
}
|
|
3438
|
-
return btoa(binary);
|
|
3439
|
-
}
|
|
3440
3438
|
function mapStatusCodeToOtlp(code) {
|
|
3441
3439
|
var _a;
|
|
3442
3440
|
if (code == null)
|
|
@@ -3514,12 +3512,9 @@ function mapCxSpanToOtlpSpan(span) {
|
|
|
3514
3512
|
}
|
|
3515
3513
|
return null;
|
|
3516
3514
|
}
|
|
3517
|
-
var ids = encodeSpanIds(span);
|
|
3518
|
-
if (!ids)
|
|
3519
|
-
return null;
|
|
3520
3515
|
var startUnixNano = timestampToNanosString(span.startTime);
|
|
3521
3516
|
var endUnixNano = timestampToNanosString(span.endTime);
|
|
3522
|
-
return __assign(__assign(__assign({ trace_id:
|
|
3517
|
+
return __assign(__assign(__assign({ trace_id: span.traceId, span_id: span.spanId }, (span.parentSpanId ? { parentSpanId: span.parentSpanId } : {})), { name: (_a = span.name) !== null && _a !== void 0 ? _a : '', kind: 'SPAN_KIND_CLIENT', start_time_unix_nano: startUnixNano, end_time_unix_nano: endUnixNano, attributes: toOtlpAttributes(span.attributes) }), (span.status ? { status: toOtlpStatus(span.status) } : {}));
|
|
3523
3518
|
}
|
|
3524
3519
|
function mapEntryToOtlpResource(entry, extra) {
|
|
3525
3520
|
var _a;
|
|
@@ -3538,15 +3533,6 @@ function mapEntryToOtlpResource(entry, extra) {
|
|
|
3538
3533
|
var attributes = toOtlpAttributes(merged);
|
|
3539
3534
|
return attributes.length ? { attributes: attributes } : {};
|
|
3540
3535
|
}
|
|
3541
|
-
function encodeSpanIds(span) {
|
|
3542
|
-
return {
|
|
3543
|
-
traceIdB64: hexToBase64(span.traceId),
|
|
3544
|
-
spanIdB64: hexToBase64(span.spanId),
|
|
3545
|
-
parentSpanIdB64: span.parentSpanId
|
|
3546
|
-
? hexToBase64(span.parentSpanId)
|
|
3547
|
-
: undefined,
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
3536
|
|
|
3551
3537
|
function buildCustomTraces(logs) {
|
|
3552
3538
|
var tracesPayload = buildExporterPayload(logs);
|
|
@@ -4152,7 +4138,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4152
4138
|
return resolvedUrlBlueprinters;
|
|
4153
4139
|
}
|
|
4154
4140
|
|
|
4155
|
-
var SDK_VERSION = '2.
|
|
4141
|
+
var SDK_VERSION = '2.14.0';
|
|
4156
4142
|
|
|
4157
4143
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4158
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;
|
|
@@ -4,7 +4,6 @@ export declare function toOtlpKeyValue(key: string, value: unknown): OtlpKeyValu
|
|
|
4
4
|
export declare function toOtlpAttributes(attributes?: Record<string, unknown>): OtlpKeyValueJson[];
|
|
5
5
|
export declare function timestampToNanosNumber(timestamp: CustomTimestamp): number;
|
|
6
6
|
export declare function timestampToNanosString(timestamp: CustomTimestamp): string;
|
|
7
|
-
export declare function hexToBase64(hex: string): string;
|
|
8
7
|
export declare function mapStatusCodeToOtlp(code?: SpanStatusCode | number): OtlpStatusCodeJson | undefined;
|
|
9
8
|
export declare function toOtlpStatus(spanStatus?: CxSpanOtelSpan['status']): OtlpStatusJson | undefined;
|
|
10
9
|
export declare function isWithinAllowedWindow(start: number, now: number): boolean;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.14.0";
|