@coralogix/browser 2.9.0 → 2.11.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 +18 -0
- package/README.md +88 -0
- package/index.esm2.js +23 -10
- package/package.json +1 -1
- package/src/Request.d.ts +1 -0
- package/src/types.d.ts +3 -1
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 2.11.0 (2025-11-23)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **trace:** allow custom propagator
|
|
6
|
+
|
|
7
|
+
## 2.10.1 (2025-11-17)
|
|
8
|
+
|
|
9
|
+
### 🩹 Fixes
|
|
10
|
+
|
|
11
|
+
- **url-fragments:** Fix URL encoding of template placeholders in page_fragments. Template placeholders like `{id}`, `{lbid}` etc. added by URL blueprinters are now preserved in `page_fragments` instead of being percent-encoded to `%7Bid%7D`, `%7Blbid%7D`. This ensures consistency between `page_url_blueprint` and `page_fragments`.
|
|
12
|
+
|
|
13
|
+
## 2.10.0 (2025-09-14)
|
|
14
|
+
|
|
15
|
+
### 🚀 Features
|
|
16
|
+
|
|
17
|
+
- **ignoreProxyUrlParams:** Added ignoreProxyUrlParams, which provides the ability to skip appending the Coralogix endpoint to the proxy URL.
|
|
18
|
+
|
|
1
19
|
## 2.9.0 (2025-08-18)
|
|
2
20
|
|
|
3
21
|
### 🚀 Features
|
package/README.md
CHANGED
|
@@ -657,6 +657,82 @@ CoralogixRum.init({
|
|
|
657
657
|
},
|
|
658
658
|
},
|
|
659
659
|
});
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
#### Custom Propagation
|
|
663
|
+
```javascript
|
|
664
|
+
CoralogixRum.init({
|
|
665
|
+
// ...
|
|
666
|
+
traceParentInHeader: {
|
|
667
|
+
enabled: true,
|
|
668
|
+
options: {
|
|
669
|
+
// ...
|
|
670
|
+
/* for Custom propagation */
|
|
671
|
+
propagateCustomTraceHeader: new CustomPropagator()
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
// Example of CustomPropagator, Converts the 128-bit OpenTelemetry trace/span IDs into 64-bit decimal IDs
|
|
677
|
+
|
|
678
|
+
import {
|
|
679
|
+
TextMapGetter,
|
|
680
|
+
TextMapSetter,
|
|
681
|
+
TextMapPropagator,
|
|
682
|
+
Context,
|
|
683
|
+
trace,
|
|
684
|
+
} from '@opentelemetry/api';
|
|
685
|
+
|
|
686
|
+
export class CustomPropagator implements TextMapPropagator {
|
|
687
|
+
inject(context: Context, carrier: any, setter: TextMapSetter) {
|
|
688
|
+
const span = trace.getSpan(context);
|
|
689
|
+
if (!span) return;
|
|
690
|
+
|
|
691
|
+
const spanContext = span.spanContext();
|
|
692
|
+
if (!spanContext) return;
|
|
693
|
+
|
|
694
|
+
// Custom trace ID = last 64 bits of OTel trace ID
|
|
695
|
+
const customTraceId = BigInt(
|
|
696
|
+
'0x' + spanContext.traceId.slice(16)
|
|
697
|
+
).toString();
|
|
698
|
+
const customParentId = BigInt('0x' + spanContext.spanId).toString();
|
|
699
|
+
|
|
700
|
+
setter.set(carrier, 'my-custom-trace-id', customTraceId);
|
|
701
|
+
setter.set(carrier, 'my-custom-parent-id', customParentId);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
extract(context: Context, carrier: any, getter: TextMapGetter): Context {
|
|
705
|
+
const traceIdHeader = getter.get(carrier, 'my-custom-trace-id');
|
|
706
|
+
const parentIdHeader = getter.get(carrier, 'my-custom-parent-id');
|
|
707
|
+
|
|
708
|
+
if (!traceIdHeader || !parentIdHeader) return context;
|
|
709
|
+
|
|
710
|
+
const traceId = BigInt(traceIdHeader as string)
|
|
711
|
+
.toString(16)
|
|
712
|
+
.padStart(32, '0');
|
|
713
|
+
|
|
714
|
+
const spanId = BigInt(parentIdHeader as string)
|
|
715
|
+
.toString(16)
|
|
716
|
+
.padStart(16, '0');
|
|
717
|
+
|
|
718
|
+
return trace.setSpan(
|
|
719
|
+
context,
|
|
720
|
+
trace.wrapSpanContext({
|
|
721
|
+
traceId,
|
|
722
|
+
spanId,
|
|
723
|
+
traceFlags: 1,
|
|
724
|
+
isRemote: true,
|
|
725
|
+
})
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
fields(): string[] {
|
|
730
|
+
return ['my-custom-trace-id', 'my-custom-parent-id'];
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
660
736
|
```
|
|
661
737
|
|
|
662
738
|
### Before Send
|
|
@@ -696,6 +772,18 @@ CoralogixRum.init({
|
|
|
696
772
|
});
|
|
697
773
|
```
|
|
698
774
|
|
|
775
|
+
#### ignoreProxyUrlParams
|
|
776
|
+
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
|
+
By default, this option is disabled.
|
|
778
|
+
```javascript
|
|
779
|
+
CoralogixRum.init({
|
|
780
|
+
// ...
|
|
781
|
+
coralogixDomain: 'EU1',
|
|
782
|
+
proxyUrl: 'https://proxy.mycompany.com/rum',
|
|
783
|
+
ignoreProxyUrlParams: true,
|
|
784
|
+
});
|
|
785
|
+
```
|
|
786
|
+
|
|
699
787
|
### Collect IP Data
|
|
700
788
|
|
|
701
789
|
Determines whether the SDK should collect the user's IP address and corresponding geolocation data. Defaults to true.
|
package/index.esm2.js
CHANGED
|
@@ -2660,7 +2660,7 @@ var getUrlFragments = function (url) {
|
|
|
2660
2660
|
if (url.startsWith('blob:')) {
|
|
2661
2661
|
return url;
|
|
2662
2662
|
}
|
|
2663
|
-
return new URL(url).pathname.substring(1) || BASE_PATH;
|
|
2663
|
+
return decodeURIComponent(new URL(url).pathname.substring(1)) || BASE_PATH;
|
|
2664
2664
|
}
|
|
2665
2665
|
catch (err) {
|
|
2666
2666
|
console.warn('Coralogix Browser SDK - Error parsing URL', err);
|
|
@@ -3262,13 +3262,23 @@ var Request = (function () {
|
|
|
3262
3262
|
this.resolvedHeaders = {};
|
|
3263
3263
|
this.init();
|
|
3264
3264
|
}
|
|
3265
|
+
Request.prototype.getResolvedUrl = function (config) {
|
|
3266
|
+
var coralogixDomain = config.coralogixDomain, proxyUrl = config.proxyUrl, ignoreProxyUrlParams = config.ignoreProxyUrlParams;
|
|
3267
|
+
var cxEndpoint = "".concat(CoralogixDomainsApiUrlMap[coralogixDomain]).concat(this.requestConfig.suffix);
|
|
3268
|
+
if (!proxyUrl)
|
|
3269
|
+
return cxEndpoint;
|
|
3270
|
+
if (ignoreProxyUrlParams)
|
|
3271
|
+
return proxyUrl;
|
|
3272
|
+
return "".concat(proxyUrl, "?").concat(PROXY_CX_FORWARD_PARAMETER, "=").concat(encodeURIComponent(cxEndpoint));
|
|
3273
|
+
};
|
|
3265
3274
|
Request.prototype.init = function () {
|
|
3266
|
-
var _a = getSdkConfig(), proxyUrl = _a.proxyUrl, coralogixDomain = _a.coralogixDomain, public_key = _a.public_key;
|
|
3267
|
-
var
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
:
|
|
3275
|
+
var _a = getSdkConfig(), proxyUrl = _a.proxyUrl, ignoreProxyUrlParams = _a.ignoreProxyUrlParams, coralogixDomain = _a.coralogixDomain, public_key = _a.public_key;
|
|
3276
|
+
var headers = this.requestConfig.headers;
|
|
3277
|
+
this.resolvedUrl = this.getResolvedUrl({
|
|
3278
|
+
proxyUrl: proxyUrl,
|
|
3279
|
+
ignoreProxyUrlParams: ignoreProxyUrlParams,
|
|
3280
|
+
coralogixDomain: coralogixDomain,
|
|
3281
|
+
});
|
|
3272
3282
|
if (public_key) {
|
|
3273
3283
|
headers['Authorization'] = "Bearer ".concat(public_key);
|
|
3274
3284
|
}
|
|
@@ -3809,12 +3819,12 @@ var reportInternalEvent = function (event, message) {
|
|
|
3809
3819
|
|
|
3810
3820
|
function handlePropagators(config, tracerProvider) {
|
|
3811
3821
|
return __awaiter(this, void 0, void 0, function () {
|
|
3812
|
-
var propagators, _a, propagateB3TraceHeader, propagateAwsXrayTraceHeader, singleHeader, multiHeader;
|
|
3822
|
+
var propagators, _a, propagateB3TraceHeader, propagateAwsXrayTraceHeader, propagateCustomTraceHeader, singleHeader, multiHeader;
|
|
3813
3823
|
var _b, _c;
|
|
3814
3824
|
return __generator(this, function (_d) {
|
|
3815
3825
|
if ((_b = config.traceParentInHeader) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
3816
3826
|
propagators = [];
|
|
3817
|
-
_a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader;
|
|
3827
|
+
_a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader, propagateCustomTraceHeader = _a.propagateCustomTraceHeader;
|
|
3818
3828
|
if (!propagateAwsXrayTraceHeader && !propagateB3TraceHeader) {
|
|
3819
3829
|
propagators = __spreadArray(__spreadArray([], __read$1(propagators), false), [
|
|
3820
3830
|
new W3CBaggagePropagator(),
|
|
@@ -3833,6 +3843,9 @@ function handlePropagators(config, tracerProvider) {
|
|
|
3833
3843
|
propagators.push(new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }));
|
|
3834
3844
|
}
|
|
3835
3845
|
}
|
|
3846
|
+
if (propagateCustomTraceHeader) {
|
|
3847
|
+
propagators.push(propagateCustomTraceHeader);
|
|
3848
|
+
}
|
|
3836
3849
|
tracerProvider.register({
|
|
3837
3850
|
propagator: new CxPropagator(config, new CompositePropagator({
|
|
3838
3851
|
propagators: propagators,
|
|
@@ -3955,7 +3968,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
3955
3968
|
return resolvedUrlBlueprinters;
|
|
3956
3969
|
}
|
|
3957
3970
|
|
|
3958
|
-
var SDK_VERSION = '2.
|
|
3971
|
+
var SDK_VERSION = '2.11.0';
|
|
3959
3972
|
|
|
3960
3973
|
function shouldDropEvent(cxRumEvent, options) {
|
|
3961
3974
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
package/package.json
CHANGED
package/src/Request.d.ts
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Attributes } from '@opentelemetry/api';
|
|
1
|
+
import { Attributes, TextMapPropagator } from '@opentelemetry/api';
|
|
2
2
|
import { CoralogixDomainsApiUrlMap } from './constants';
|
|
3
3
|
import { CoralogixLogSeverity } from './types-external';
|
|
4
4
|
import { ErrorSource } from './instrumentations/CoralogixErrorInstrumentation';
|
|
@@ -88,6 +88,7 @@ export interface TraceHeaderConfiguration {
|
|
|
88
88
|
singleHeader?: boolean;
|
|
89
89
|
multiHeader?: boolean;
|
|
90
90
|
};
|
|
91
|
+
propagateCustomTraceHeader?: TextMapPropagator;
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
export interface CoralogixOtelWebOptionsInstrumentations {
|
|
@@ -149,6 +150,7 @@ export interface CoralogixBrowserSdkConfig {
|
|
|
149
150
|
maskClass?: string | RegExp;
|
|
150
151
|
beforeSend?: (event: EditableCxRumEvent) => BeforeSendResult;
|
|
151
152
|
proxyUrl?: string;
|
|
153
|
+
ignoreProxyUrlParams?: boolean;
|
|
152
154
|
collectIPData?: boolean;
|
|
153
155
|
trackSoftNavigations?: boolean;
|
|
154
156
|
memoryUsageConfig?: MemoryUsageConfig;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.11.0";
|