@coralogix/browser 2.12.0 → 2.13.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,15 @@
1
+ ## 2.13.0 (2025-12-07)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **traces-exporter:** improve trace metadata encoding
6
+
1
7
  ## 2.12.0 (2025-11-30)
2
8
 
3
9
  ### 🚀 Features
4
10
 
5
11
  - Introduced the tracesExporter callback, enabling custom processing or exporting of collected trace events.
6
12
 
7
-
8
13
  ## 2.11.1 (2025-11-24)
9
14
 
10
15
  ### 🩹 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 `TracesExporterPayload` object containing all trace data that the SDK has collected.
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
@@ -3427,16 +3427,6 @@ function timestampToNanosString(timestamp) {
3427
3427
  var nanosPart = String(nanos).padStart(9, '0');
3428
3428
  return secondsPart + nanosPart;
3429
3429
  }
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
3430
  function mapStatusCodeToOtlp(code) {
3441
3431
  var _a;
3442
3432
  if (code == null)
@@ -3514,12 +3504,9 @@ function mapCxSpanToOtlpSpan(span) {
3514
3504
  }
3515
3505
  return null;
3516
3506
  }
3517
- var ids = encodeSpanIds(span);
3518
- if (!ids)
3519
- return null;
3520
3507
  var startUnixNano = timestampToNanosString(span.startTime);
3521
3508
  var endUnixNano = timestampToNanosString(span.endTime);
3522
- return __assign(__assign(__assign({ trace_id: ids.traceIdB64, span_id: ids.spanIdB64 }, (ids.parentSpanIdB64 ? { parentSpanId: ids.parentSpanIdB64 } : {})), { 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) } : {}));
3509
+ 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
3510
  }
3524
3511
  function mapEntryToOtlpResource(entry, extra) {
3525
3512
  var _a;
@@ -3538,15 +3525,6 @@ function mapEntryToOtlpResource(entry, extra) {
3538
3525
  var attributes = toOtlpAttributes(merged);
3539
3526
  return attributes.length ? { attributes: attributes } : {};
3540
3527
  }
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
3528
 
3551
3529
  function buildCustomTraces(logs) {
3552
3530
  var tracesPayload = buildExporterPayload(logs);
@@ -4152,7 +4130,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4152
4130
  return resolvedUrlBlueprinters;
4153
4131
  }
4154
4132
 
4155
- var SDK_VERSION = '2.12.0';
4133
+ var SDK_VERSION = '2.13.0';
4156
4134
 
4157
4135
  function shouldDropEvent(cxRumEvent, options) {
4158
4136
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -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.12.0";
1
+ export declare const SDK_VERSION = "2.13.0";