@coralogix/browser 2.8.2 โ 2.8.4
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 +20 -0
- package/README.md +10 -3
- package/index.esm2.js +96 -91
- package/package.json +1 -1
- package/src/constants.d.ts +1 -5
- package/src/custom-spans/custom-spans.utils.d.ts +1 -1
- package/src/helpers.d.ts +2 -1
- package/src/instrumentations/instrumentation.model.d.ts +2 -5
- package/src/types.d.ts +9 -1
- package/src/utils/all.d.ts +2 -8
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 2.8.4 (2025-05-29)
|
|
2
|
+
|
|
3
|
+
### ๐ฉน Fixes & Improvements
|
|
4
|
+
|
|
5
|
+
๐ Custom Spans
|
|
6
|
+
|
|
7
|
+
- Traceparent propagation: XHR and Fetch requests now correctly include the global span traceId when using custom spans.
|
|
8
|
+
- Improved span creation: Enhanced the logic for generating custom child spans for more accurate trace hierarchy.
|
|
9
|
+
- Interaction tracing: User interaction instrumentation is now correctly linked to the global span context.
|
|
10
|
+
|
|
11
|
+
๐งน Logging
|
|
12
|
+
|
|
13
|
+
- Switched internal warning logs to debug level to reduce noise in production environments.
|
|
14
|
+
|
|
15
|
+
## 2.8.3 (2025-05-22)
|
|
16
|
+
|
|
17
|
+
### ๐ฅ Performance
|
|
18
|
+
|
|
19
|
+
- Optimize user agent parsing.
|
|
20
|
+
|
|
1
21
|
## 2.8.2 (2025-05-21)
|
|
2
22
|
|
|
3
23
|
### ๐ฉน Fixes
|
package/README.md
CHANGED
|
@@ -779,9 +779,16 @@ Labels can be added during span creation for additional context.
|
|
|
779
779
|
const customTracer = CoralogixRum.getCustomTracer();
|
|
780
780
|
const globalSpan = customTracer.startGlobalSpan('global-span', { page: 'posts' });
|
|
781
781
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
782
|
+
// Easily create custom spans for specific operations in your application.
|
|
783
|
+
globalSpan.startCustomSpan('submit-button', { action: 'click' }).endSpan();
|
|
784
|
+
|
|
785
|
+
// You can also use the with context method to modeling a specific flow in your application.
|
|
786
|
+
globalSpan.withContext(async () => {
|
|
787
|
+
globalSpan.startCustomSpan('get-data-btn', { action: 'click' }).endSpan();
|
|
788
|
+
const res = await fetch('my-api-endpoint');
|
|
789
|
+
globalSpan.startCustomSpan('click-on-first-row', { action: 'click' }).endSpan();
|
|
790
|
+
|
|
791
|
+
// ... your code
|
|
785
792
|
});
|
|
786
793
|
|
|
787
794
|
// note: End the global span only after the operation is complete.
|
package/index.esm2.js
CHANGED
|
@@ -48,6 +48,46 @@ function generateUUID(placeholder) {
|
|
|
48
48
|
: "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g, generateUUID);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
var CoralogixEventType;
|
|
52
|
+
(function (CoralogixEventType) {
|
|
53
|
+
CoralogixEventType["ERROR"] = "error";
|
|
54
|
+
CoralogixEventType["NETWORK_REQUEST"] = "network-request";
|
|
55
|
+
CoralogixEventType["LOG"] = "log";
|
|
56
|
+
CoralogixEventType["USER_INTERACTION"] = "user-interaction";
|
|
57
|
+
CoralogixEventType["WEB_VITALS"] = "web-vitals";
|
|
58
|
+
CoralogixEventType["LONG_TASK"] = "longtask";
|
|
59
|
+
CoralogixEventType["RESOURCES"] = "resources";
|
|
60
|
+
CoralogixEventType["INTERNAL"] = "internal";
|
|
61
|
+
CoralogixEventType["DOM"] = "dom";
|
|
62
|
+
CoralogixEventType["CUSTOM_MEASUREMENT"] = "custom-measurement";
|
|
63
|
+
CoralogixEventType["MEMORY_USAGE"] = "memory-usage";
|
|
64
|
+
CoralogixEventType["SCREENSHOT"] = "screenshot";
|
|
65
|
+
CoralogixEventType["CUSTOM_SPAN"] = "custom-span";
|
|
66
|
+
CoralogixEventType["WORKER"] = "web-worker";
|
|
67
|
+
})(CoralogixEventType || (CoralogixEventType = {}));
|
|
68
|
+
var PerformanceTypes;
|
|
69
|
+
(function (PerformanceTypes) {
|
|
70
|
+
PerformanceTypes["Resource"] = "resource";
|
|
71
|
+
PerformanceTypes["LongTask"] = "longtask";
|
|
72
|
+
PerformanceTypes["Navigation"] = "navigation";
|
|
73
|
+
PerformanceTypes["SoftNavigation"] = "soft-navigation";
|
|
74
|
+
})(PerformanceTypes || (PerformanceTypes = {}));
|
|
75
|
+
var OtelNetworkAttrs;
|
|
76
|
+
(function (OtelNetworkAttrs) {
|
|
77
|
+
OtelNetworkAttrs["METHOD"] = "http.method";
|
|
78
|
+
OtelNetworkAttrs["URL"] = "http.url";
|
|
79
|
+
OtelNetworkAttrs["STATUS_CODE"] = "http.status_code";
|
|
80
|
+
OtelNetworkAttrs["HOST"] = "http.host";
|
|
81
|
+
OtelNetworkAttrs["SCHEME"] = "http.scheme";
|
|
82
|
+
OtelNetworkAttrs["STATUS_TEXT"] = "http.status_text";
|
|
83
|
+
OtelNetworkAttrs["RESPONSE_CONTENT_LENGTH"] = "http.response_content_length";
|
|
84
|
+
})(OtelNetworkAttrs || (OtelNetworkAttrs = {}));
|
|
85
|
+
var UrlType;
|
|
86
|
+
(function (UrlType) {
|
|
87
|
+
UrlType["PAGE"] = "page";
|
|
88
|
+
UrlType["NETWORK_REQUEST"] = "network_request";
|
|
89
|
+
})(UrlType || (UrlType = {}));
|
|
90
|
+
|
|
51
91
|
function isFunction(funktion) {
|
|
52
92
|
return typeof funktion === 'function';
|
|
53
93
|
}
|
|
@@ -151,45 +191,6 @@ shimmer.unwrap = unwrap;
|
|
|
151
191
|
shimmer.massUnwrap = massUnwrap;
|
|
152
192
|
var shimmer_1 = shimmer;
|
|
153
193
|
|
|
154
|
-
var CoralogixEventType;
|
|
155
|
-
(function (CoralogixEventType) {
|
|
156
|
-
CoralogixEventType["ERROR"] = "error";
|
|
157
|
-
CoralogixEventType["NETWORK_REQUEST"] = "network-request";
|
|
158
|
-
CoralogixEventType["LOG"] = "log";
|
|
159
|
-
CoralogixEventType["USER_INTERACTION"] = "user-interaction";
|
|
160
|
-
CoralogixEventType["WEB_VITALS"] = "web-vitals";
|
|
161
|
-
CoralogixEventType["LONG_TASK"] = "longtask";
|
|
162
|
-
CoralogixEventType["RESOURCES"] = "resources";
|
|
163
|
-
CoralogixEventType["INTERNAL"] = "internal";
|
|
164
|
-
CoralogixEventType["DOM"] = "dom";
|
|
165
|
-
CoralogixEventType["CUSTOM_MEASUREMENT"] = "custom-measurement";
|
|
166
|
-
CoralogixEventType["MEMORY_USAGE"] = "memory-usage";
|
|
167
|
-
CoralogixEventType["SCREENSHOT"] = "screenshot";
|
|
168
|
-
CoralogixEventType["CUSTOM_SPAN"] = "custom-span";
|
|
169
|
-
})(CoralogixEventType || (CoralogixEventType = {}));
|
|
170
|
-
var PerformanceTypes;
|
|
171
|
-
(function (PerformanceTypes) {
|
|
172
|
-
PerformanceTypes["Resource"] = "resource";
|
|
173
|
-
PerformanceTypes["LongTask"] = "longtask";
|
|
174
|
-
PerformanceTypes["Navigation"] = "navigation";
|
|
175
|
-
PerformanceTypes["SoftNavigation"] = "soft-navigation";
|
|
176
|
-
})(PerformanceTypes || (PerformanceTypes = {}));
|
|
177
|
-
var OtelNetworkAttrs;
|
|
178
|
-
(function (OtelNetworkAttrs) {
|
|
179
|
-
OtelNetworkAttrs["METHOD"] = "http.method";
|
|
180
|
-
OtelNetworkAttrs["URL"] = "http.url";
|
|
181
|
-
OtelNetworkAttrs["STATUS_CODE"] = "http.status_code";
|
|
182
|
-
OtelNetworkAttrs["HOST"] = "http.host";
|
|
183
|
-
OtelNetworkAttrs["SCHEME"] = "http.scheme";
|
|
184
|
-
OtelNetworkAttrs["STATUS_TEXT"] = "http.status_text";
|
|
185
|
-
OtelNetworkAttrs["RESPONSE_CONTENT_LENGTH"] = "http.response_content_length";
|
|
186
|
-
})(OtelNetworkAttrs || (OtelNetworkAttrs = {}));
|
|
187
|
-
var UrlType;
|
|
188
|
-
(function (UrlType) {
|
|
189
|
-
UrlType["PAGE"] = "page";
|
|
190
|
-
UrlType["NETWORK_REQUEST"] = "network_request";
|
|
191
|
-
})(UrlType || (UrlType = {}));
|
|
192
|
-
|
|
193
194
|
var CoralogixLogSeverity;
|
|
194
195
|
(function (CoralogixLogSeverity) {
|
|
195
196
|
CoralogixLogSeverity[CoralogixLogSeverity["Debug"] = 1] = "Debug";
|
|
@@ -278,6 +279,9 @@ function getSessionRecorder() {
|
|
|
278
279
|
function getSdkConfig() {
|
|
279
280
|
return CxGlobal[SDK_CONFIG_KEY];
|
|
280
281
|
}
|
|
282
|
+
function getUserAgentData() {
|
|
283
|
+
return CxGlobal[USER_AGENT_KEY];
|
|
284
|
+
}
|
|
281
285
|
|
|
282
286
|
var GLOBAL_SPAN_KEY = '__globalSpan__';
|
|
283
287
|
var CUSTOM_TRACER_KEY = '__customTracer__';
|
|
@@ -295,7 +299,7 @@ function clearGlobalSpan() {
|
|
|
295
299
|
function setCustomTracer(customTracer) {
|
|
296
300
|
CxGlobal[CUSTOM_TRACER_KEY] = customTracer;
|
|
297
301
|
}
|
|
298
|
-
function
|
|
302
|
+
function getActiveCustomTracer() {
|
|
299
303
|
return CxGlobal[CUSTOM_TRACER_KEY];
|
|
300
304
|
}
|
|
301
305
|
function setCustomTracerIgnoredInstruments(ignoredInstruments) {
|
|
@@ -310,13 +314,8 @@ function shouldAttachSpanToGlobalSpan(instrumentationType) {
|
|
|
310
314
|
!((_a = getCustomTracerIgnoredInstruments()) === null || _a === void 0 ? void 0 : _a.includes(instrumentationType)));
|
|
311
315
|
}
|
|
312
316
|
function attachChildSpanToGlobalSpan(name) {
|
|
313
|
-
var span;
|
|
314
317
|
var globalSpan = getGlobalSpan();
|
|
315
|
-
globalSpan.
|
|
316
|
-
var childSpan = globalSpan.startCustomSpan(name);
|
|
317
|
-
span = childSpan.span;
|
|
318
|
-
});
|
|
319
|
-
return span;
|
|
318
|
+
return globalSpan.startCustomSpan(name).span;
|
|
320
319
|
}
|
|
321
320
|
|
|
322
321
|
var IS_OTEL_READY = 'otelReady';
|
|
@@ -2081,10 +2080,10 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
|
2081
2080
|
this.handler = function (e) {
|
|
2082
2081
|
var span;
|
|
2083
2082
|
if (shouldAttachSpanToGlobalSpan(CoralogixEventType.USER_INTERACTION)) {
|
|
2084
|
-
span = attachChildSpanToGlobalSpan(
|
|
2083
|
+
span = attachChildSpanToGlobalSpan(CoralogixEventType.USER_INTERACTION);
|
|
2085
2084
|
}
|
|
2086
2085
|
else {
|
|
2087
|
-
span = _this.tracer.startSpan(
|
|
2086
|
+
span = _this.tracer.startSpan(CoralogixEventType.USER_INTERACTION);
|
|
2088
2087
|
}
|
|
2089
2088
|
var eventTarget = e.target;
|
|
2090
2089
|
var config = getSdkConfig();
|
|
@@ -2514,6 +2513,7 @@ var REQUIRED_CONFIG_KEYS = [
|
|
|
2514
2513
|
'coralogixDomain',
|
|
2515
2514
|
];
|
|
2516
2515
|
var SDK_CONFIG_KEY = 'sdkConfig';
|
|
2516
|
+
var USER_AGENT_KEY = 'userAgent';
|
|
2517
2517
|
var ID_MASK_KEY = '{id}';
|
|
2518
2518
|
var UUID_REGEX = /[0-9a-fA-F-]{36}/g;
|
|
2519
2519
|
var NANOID_REGEX = /^[a-zA-Z0-9-_]{21}$/;
|
|
@@ -2602,45 +2602,42 @@ var INSTRUMENTATIONS = [
|
|
|
2602
2602
|
},
|
|
2603
2603
|
{
|
|
2604
2604
|
Instrument: CoralogixInternalInstrumentation,
|
|
2605
|
-
confKey:
|
|
2605
|
+
confKey: CoralogixEventType.INTERNAL,
|
|
2606
2606
|
disable: false,
|
|
2607
2607
|
},
|
|
2608
2608
|
{
|
|
2609
2609
|
Instrument: CoralogixDOMInstrumentation,
|
|
2610
|
-
confKey:
|
|
2610
|
+
confKey: CoralogixEventType.DOM,
|
|
2611
2611
|
disable: false,
|
|
2612
2612
|
},
|
|
2613
2613
|
{
|
|
2614
2614
|
Instrument: CoralogixCustomMeasurementInstrumentation,
|
|
2615
|
-
confKey:
|
|
2615
|
+
confKey: CoralogixEventType.CUSTOM_MEASUREMENT,
|
|
2616
2616
|
disable: false,
|
|
2617
2617
|
},
|
|
2618
2618
|
{
|
|
2619
2619
|
Instrument: CoralogixMemoryUsageInstrumentation,
|
|
2620
|
-
confKey:
|
|
2620
|
+
confKey: CoralogixEventType.MEMORY_USAGE,
|
|
2621
2621
|
disable: false,
|
|
2622
2622
|
},
|
|
2623
2623
|
{
|
|
2624
2624
|
Instrument: CoralogixScreenshotInstrumentation,
|
|
2625
|
-
confKey:
|
|
2625
|
+
confKey: CoralogixEventType.SCREENSHOT,
|
|
2626
2626
|
disable: false,
|
|
2627
2627
|
},
|
|
2628
2628
|
{
|
|
2629
2629
|
Instrument: CoralogixWorkerInstrumentation,
|
|
2630
|
-
confKey:
|
|
2630
|
+
confKey: CoralogixEventType.WORKER,
|
|
2631
2631
|
disable: false,
|
|
2632
2632
|
},
|
|
2633
2633
|
];
|
|
2634
2634
|
var CoralogixAttributes = {
|
|
2635
|
-
USER_AGENT: 'user_agent',
|
|
2636
|
-
LOCATION_HREF: 'location_href',
|
|
2637
2635
|
EVENT_TYPE: 'event_type',
|
|
2638
2636
|
SEVERITY: 'severity',
|
|
2639
2637
|
APPLICATION_CONTEXT: 'application_context',
|
|
2640
2638
|
USER_CONTEXT: 'user_context',
|
|
2641
2639
|
CUSTOM_MEASUREMENT_CONTEXT: 'custom_measurement_context',
|
|
2642
2640
|
MEMORY_USAGE_CONTEXT: 'memory_usage_context',
|
|
2643
|
-
COUNTRY: 'country',
|
|
2644
2641
|
SOURCE: 'source',
|
|
2645
2642
|
ERROR: ErrorAttributes,
|
|
2646
2643
|
LOG: 'cx_log',
|
|
@@ -2648,10 +2645,8 @@ var CoralogixAttributes = {
|
|
|
2648
2645
|
ENVIRONMENT: 'environment',
|
|
2649
2646
|
INTERACTION_EVENT_NAME: 'interaction_event_name',
|
|
2650
2647
|
ELEMENT_INNER_TEXT: 'element_inner_text',
|
|
2651
|
-
ELEMENT_INNER_HTML: 'element_inner_html',
|
|
2652
2648
|
ELEMENT_ID: 'element_id',
|
|
2653
2649
|
ELEMENT_CLASSES: 'element_classes',
|
|
2654
|
-
TARGET_XPATH: 'target_xpath',
|
|
2655
2650
|
TARGET_ELEMENT: 'target_element',
|
|
2656
2651
|
TARGET_ELEMENT_TYPE: 'target_element_type',
|
|
2657
2652
|
TIMESTAMP: 'timestamp',
|
|
@@ -2987,7 +2982,6 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
|
2987
2982
|
};
|
|
2988
2983
|
CoralogixSpanAttributesProcessor.prototype.onStart = function (span) {
|
|
2989
2984
|
span.setAttribute(CoralogixAttributes.TIMESTAMP, getNowTime());
|
|
2990
|
-
span.setAttribute(CoralogixAttributes.USER_AGENT, navigator.userAgent);
|
|
2991
2985
|
span.setAttributes(this.labels);
|
|
2992
2986
|
};
|
|
2993
2987
|
CoralogixSpanAttributesProcessor.prototype.onEnd = function () { };
|
|
@@ -3814,20 +3808,16 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3814
3808
|
var _a;
|
|
3815
3809
|
var instrumentationsCompatibility = (_a = {},
|
|
3816
3810
|
_a[XHR_INSTRUMENTATION_NAME] = {
|
|
3817
|
-
browsers: [
|
|
3818
|
-
{ name: 'Chrome', minVersion: 43 }
|
|
3819
|
-
],
|
|
3811
|
+
browsers: [{ name: 'Chrome', minVersion: 43 }],
|
|
3820
3812
|
warningText: 'XHR',
|
|
3821
3813
|
},
|
|
3822
3814
|
_a[SESSION_RECORDING_INSTRUMENTATION_NAME] = {
|
|
3823
|
-
browsers: [
|
|
3824
|
-
{ name: 'Chrome', minVersion: 45 },
|
|
3825
|
-
],
|
|
3815
|
+
browsers: [{ name: 'Chrome', minVersion: 45 }],
|
|
3826
3816
|
warningText: 'Session Recording',
|
|
3827
3817
|
},
|
|
3828
3818
|
_a);
|
|
3829
3819
|
function isInstrumentationCompatible(confKey) {
|
|
3830
|
-
var _a =
|
|
3820
|
+
var _a = getUserAgentData(), browserVersion = _a.browserVersion, browser = _a.browser;
|
|
3831
3821
|
var majorVersion = parseInt(browserVersion.split('.')[0]);
|
|
3832
3822
|
var compatibility = instrumentationsCompatibility[confKey];
|
|
3833
3823
|
if (!compatibility)
|
|
@@ -4127,17 +4117,28 @@ var CxPropagator = /** @class */ (function () {
|
|
|
4127
4117
|
};
|
|
4128
4118
|
CxPropagator.prototype.inject = function (context, carrier, setter) {
|
|
4129
4119
|
var _a, _b;
|
|
4120
|
+
function checkSpanContextChanges() {
|
|
4121
|
+
if (shouldAttachSpanToGlobalSpan(CoralogixEventType.NETWORK_REQUEST)) {
|
|
4122
|
+
var globalSpan = getGlobalSpan();
|
|
4123
|
+
var currentSpanContext = trace.getSpanContext(context);
|
|
4124
|
+
var globalTraceId = globalSpan.span.spanContext().traceId;
|
|
4125
|
+
if (currentSpanContext) {
|
|
4126
|
+
currentSpanContext.traceId = globalTraceId;
|
|
4127
|
+
context = trace.setSpanContext(context, currentSpanContext);
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4130
4131
|
var allowedUrls = (_b = (_a = this.config.traceParentInHeader) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.allowedTracingUrls;
|
|
4132
|
+
var shouldInjectContext = true;
|
|
4131
4133
|
if (allowedUrls) {
|
|
4132
4134
|
var span = trace.getSpan(context);
|
|
4133
4135
|
var url = span.attributes[OtelNetworkAttrs.URL];
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4136
|
+
shouldInjectContext = isPatternMatch(url, allowedUrls, 'allowedTracingUrls');
|
|
4137
|
+
}
|
|
4138
|
+
if (shouldInjectContext) {
|
|
4139
|
+
checkSpanContextChanges();
|
|
4140
|
+
this.internalPropagator.inject(context, carrier, setter);
|
|
4139
4141
|
}
|
|
4140
|
-
this.internalPropagator.inject(context, carrier, setter);
|
|
4141
4142
|
};
|
|
4142
4143
|
return CxPropagator;
|
|
4143
4144
|
}());
|
|
@@ -4216,7 +4217,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4216
4217
|
return resolvedUrlBlueprinters;
|
|
4217
4218
|
}
|
|
4218
4219
|
|
|
4219
|
-
var SDK_VERSION = '2.8.
|
|
4220
|
+
var SDK_VERSION = '2.8.4';
|
|
4220
4221
|
|
|
4221
4222
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4222
4223
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4360,7 +4361,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4360
4361
|
hasRecording: prevSessionHasRecording,
|
|
4361
4362
|
hasScreenshot: prevSessionHasScreenshot,
|
|
4362
4363
|
}
|
|
4363
|
-
: undefined, hasRecording: sessionHasRecording, hasScreenshot: sessionHasScreenshot, user_agent:
|
|
4364
|
+
: undefined, hasRecording: sessionHasRecording, hasScreenshot: sessionHasScreenshot, user_agent: navigator.userAgent }), getUserAgentData()), { onlyWithErrorMode: onlySessionWithErrorMode }), page_context: span[CoralogixAttributes.PAGE_CONTEXT], isNavigationEvent: !!span[CoralogixAttributes.IS_NAVIGATION_EVENT], event_context: {
|
|
4364
4365
|
type: eventType,
|
|
4365
4366
|
source: attributes[CoralogixAttributes.SOURCE],
|
|
4366
4367
|
severity: severity,
|
|
@@ -4735,8 +4736,8 @@ var CoralogixRum = {
|
|
|
4735
4736
|
var _this = this;
|
|
4736
4737
|
try {
|
|
4737
4738
|
// Check if CoralogixRum already inited.
|
|
4738
|
-
if (isInited) {
|
|
4739
|
-
console.
|
|
4739
|
+
if (isInited && (options === null || options === void 0 ? void 0 : options.debug)) {
|
|
4740
|
+
console.debug('CoralogixRum already initialized, skipping init');
|
|
4740
4741
|
return;
|
|
4741
4742
|
}
|
|
4742
4743
|
// Abort if not in browser environment.
|
|
@@ -4753,6 +4754,7 @@ var CoralogixRum = {
|
|
|
4753
4754
|
if (!resolvedOptions_1) {
|
|
4754
4755
|
return;
|
|
4755
4756
|
}
|
|
4757
|
+
CxGlobal[USER_AGENT_KEY] = parseUserAgent(navigator.userAgent);
|
|
4756
4758
|
CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
|
|
4757
4759
|
var sampler = getResolvedSampler(resolvedOptions_1);
|
|
4758
4760
|
// Check if not in debug mode & no auth token.
|
|
@@ -4774,7 +4776,7 @@ var CoralogixRum = {
|
|
|
4774
4776
|
if (pluginConf) {
|
|
4775
4777
|
var instrumentation = void 0;
|
|
4776
4778
|
switch (confKey) {
|
|
4777
|
-
case
|
|
4779
|
+
case CoralogixEventType.WORKER: {
|
|
4778
4780
|
if (resolvedOptions_1.workerSupport) {
|
|
4779
4781
|
instrumentation = new Instrument(pluginConf, errorsInstrumentation, _this);
|
|
4780
4782
|
}
|
|
@@ -4797,12 +4799,12 @@ var CoralogixRum = {
|
|
|
4797
4799
|
instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls_1, traceParentInHeader: traceParentInHeader_1 }));
|
|
4798
4800
|
break;
|
|
4799
4801
|
}
|
|
4800
|
-
case
|
|
4802
|
+
case CoralogixEventType.INTERNAL: {
|
|
4801
4803
|
instrumentation = new Instrument(pluginConf);
|
|
4802
4804
|
saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
|
|
4803
4805
|
break;
|
|
4804
4806
|
}
|
|
4805
|
-
case
|
|
4807
|
+
case CoralogixEventType.SCREENSHOT: {
|
|
4806
4808
|
if ((_c = resolvedOptions_1.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
4807
4809
|
instrumentation = new Instrument(pluginConf);
|
|
4808
4810
|
screenshotInstrumentation =
|
|
@@ -4810,7 +4812,7 @@ var CoralogixRum = {
|
|
|
4810
4812
|
}
|
|
4811
4813
|
break;
|
|
4812
4814
|
}
|
|
4813
|
-
case
|
|
4815
|
+
case CoralogixEventType.MEMORY_USAGE: {
|
|
4814
4816
|
if (resolvedOptions_1.memoryUsageConfig.enabled &&
|
|
4815
4817
|
isMeasureUserAgentSpecificMemoryAllowed()) {
|
|
4816
4818
|
instrumentation = new Instrument(pluginConf);
|
|
@@ -4877,7 +4879,7 @@ var CoralogixRum = {
|
|
|
4877
4879
|
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
4878
4880
|
isInited = true;
|
|
4879
4881
|
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4880
|
-
console.
|
|
4882
|
+
console.debug('Coralogix Browser SDK - initialization has completed');
|
|
4881
4883
|
}
|
|
4882
4884
|
reportInternalEvent('init');
|
|
4883
4885
|
}
|
|
@@ -4895,7 +4897,7 @@ var CoralogixRum = {
|
|
|
4895
4897
|
console.debug('Coralogix Browser SDK - TraceParentInHeader is not enabled');
|
|
4896
4898
|
return;
|
|
4897
4899
|
}
|
|
4898
|
-
if (
|
|
4900
|
+
if (getActiveCustomTracer()) {
|
|
4899
4901
|
console.warn('Coralogix Browser SDK - Custom tracer already exists');
|
|
4900
4902
|
return;
|
|
4901
4903
|
}
|
|
@@ -4904,7 +4906,7 @@ var CoralogixRum = {
|
|
|
4904
4906
|
return {
|
|
4905
4907
|
startGlobalSpan: function (name, labels) {
|
|
4906
4908
|
if (getGlobalSpan()) {
|
|
4907
|
-
console.warn('Coralogix Browser SDK
|
|
4909
|
+
console.warn('Coralogix Browser SDK - Global span already exists');
|
|
4908
4910
|
return;
|
|
4909
4911
|
}
|
|
4910
4912
|
setCustomTracerIgnoredInstruments((ignoredList === null || ignoredList === void 0 ? void 0 : ignoredList.ignoredInstruments) || []);
|
|
@@ -4925,13 +4927,16 @@ var CoralogixRum = {
|
|
|
4925
4927
|
clearGlobalSpan();
|
|
4926
4928
|
},
|
|
4927
4929
|
startCustomSpan: function (name, labels) {
|
|
4928
|
-
var customSpan
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4930
|
+
var customSpan;
|
|
4931
|
+
context.with(trace.setSpan(context.active(), globalSpan), function () {
|
|
4932
|
+
customSpan = tracer.startSpan(name);
|
|
4933
|
+
customSpan[CoralogixAttributes.EVENT_TYPE] =
|
|
4934
|
+
CoralogixEventType.CUSTOM_SPAN;
|
|
4935
|
+
if (labels) {
|
|
4936
|
+
setCustomLabelsForSpan(customSpan, labels);
|
|
4937
|
+
}
|
|
4938
|
+
markSpanAsOtelToSend(customSpan);
|
|
4939
|
+
});
|
|
4935
4940
|
return {
|
|
4936
4941
|
span: customSpan,
|
|
4937
4942
|
endSpan: function () {
|
package/package.json
CHANGED
package/src/constants.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const MAX_CHARACTERS = 1024;
|
|
|
8
8
|
export declare const SCHEDULE_DELAY_MILLIS: number;
|
|
9
9
|
export declare const REQUIRED_CONFIG_KEYS: Array<keyof CoralogixBrowserSdkConfig>;
|
|
10
10
|
export declare const SDK_CONFIG_KEY = "sdkConfig";
|
|
11
|
+
export declare const USER_AGENT_KEY = "userAgent";
|
|
11
12
|
export declare const ID_MASK_KEY = "{id}";
|
|
12
13
|
export declare const UUID_REGEX: RegExp;
|
|
13
14
|
export declare const NANOID_REGEX: RegExp;
|
|
@@ -24,15 +25,12 @@ export declare const OPTIONS_DEFAULTS: Partial<CoralogixBrowserSdkConfig>;
|
|
|
24
25
|
*/
|
|
25
26
|
export declare const INSTRUMENTATIONS: readonly InternalInstrumentationConfig[];
|
|
26
27
|
export declare const CoralogixAttributes: {
|
|
27
|
-
USER_AGENT: string;
|
|
28
|
-
LOCATION_HREF: string;
|
|
29
28
|
EVENT_TYPE: string;
|
|
30
29
|
SEVERITY: string;
|
|
31
30
|
APPLICATION_CONTEXT: string;
|
|
32
31
|
USER_CONTEXT: string;
|
|
33
32
|
CUSTOM_MEASUREMENT_CONTEXT: string;
|
|
34
33
|
MEMORY_USAGE_CONTEXT: string;
|
|
35
|
-
COUNTRY: string;
|
|
36
34
|
SOURCE: string;
|
|
37
35
|
ERROR: {
|
|
38
36
|
TYPE: string;
|
|
@@ -45,10 +43,8 @@ export declare const CoralogixAttributes: {
|
|
|
45
43
|
ENVIRONMENT: string;
|
|
46
44
|
INTERACTION_EVENT_NAME: string;
|
|
47
45
|
ELEMENT_INNER_TEXT: string;
|
|
48
|
-
ELEMENT_INNER_HTML: string;
|
|
49
46
|
ELEMENT_ID: string;
|
|
50
47
|
ELEMENT_CLASSES: string;
|
|
51
|
-
TARGET_XPATH: string;
|
|
52
48
|
TARGET_ELEMENT: string;
|
|
53
49
|
TARGET_ELEMENT_TYPE: string;
|
|
54
50
|
TIMESTAMP: string;
|
|
@@ -5,7 +5,7 @@ export declare function setGlobalSpan(globalSpan: GlobalSpan): void;
|
|
|
5
5
|
export declare function getGlobalSpan(): GlobalSpan;
|
|
6
6
|
export declare function clearGlobalSpan(): void;
|
|
7
7
|
export declare function setCustomTracer(customTracer: Tracer): void;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function getActiveCustomTracer(): Tracer;
|
|
9
9
|
export declare function clearCustomTracer(): void;
|
|
10
10
|
export declare function setCustomTracerIgnoredInstruments(ignoredInstruments: CustomTracerIgnoredInstruments[]): void;
|
|
11
11
|
export declare function getCustomTracerIgnoredInstruments(): CustomTracerIgnoredInstruments[];
|
package/src/helpers.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SessionManager } from './session/sessionManager';
|
|
2
2
|
import { SessionRecorder } from './session/sessionRecorder';
|
|
3
|
-
import { CoralogixBrowserSdkConfig } from './types';
|
|
3
|
+
import { CoralogixBrowserSdkConfig, UserAgentData } from './types';
|
|
4
4
|
import { SnapshotManager } from './snapshot/snapshotManager';
|
|
5
5
|
export declare function getSnapshotManager(): SnapshotManager;
|
|
6
6
|
export declare function getSessionManager(): SessionManager;
|
|
7
7
|
export declare function getSessionRecorder(): SessionRecorder | undefined;
|
|
8
8
|
export declare function getSdkConfig(): CoralogixBrowserSdkConfig;
|
|
9
|
+
export declare function getUserAgentData(): UserAgentData;
|
|
9
10
|
export declare function clearMemoryFrom(keys: string[]): void;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
|
-
import {
|
|
3
|
-
import { MEMORY_USAGE_INSTRUMENTATION_NAME } from './memory-usage';
|
|
4
|
-
import { SCREENSHOT_INSTRUMENTATION_NAME } from './screenshot/screenshot.utils';
|
|
5
|
-
import { CoralogixOtelWebOptionsInstrumentations } from '../types';
|
|
2
|
+
import { CoralogixEventType, CoralogixOtelWebOptionsInstrumentations } from '../types';
|
|
6
3
|
export interface CoralogixWebVitalsMetrics {
|
|
7
4
|
lcp: boolean;
|
|
8
5
|
fid: boolean;
|
|
@@ -34,6 +31,6 @@ export declare enum ResourceInitiatorTypes {
|
|
|
34
31
|
}
|
|
35
32
|
export type InternalInstrumentationConfig = {
|
|
36
33
|
Instrument: any;
|
|
37
|
-
confKey: keyof CoralogixOtelWebOptionsInstrumentations |
|
|
34
|
+
confKey: keyof CoralogixOtelWebOptionsInstrumentations | CoralogixEventType;
|
|
38
35
|
disable: boolean;
|
|
39
36
|
};
|
package/src/types.d.ts
CHANGED
|
@@ -45,7 +45,8 @@ export declare enum CoralogixEventType {
|
|
|
45
45
|
CUSTOM_MEASUREMENT = "custom-measurement",
|
|
46
46
|
MEMORY_USAGE = "memory-usage",
|
|
47
47
|
SCREENSHOT = "screenshot",
|
|
48
|
-
CUSTOM_SPAN = "custom-span"
|
|
48
|
+
CUSTOM_SPAN = "custom-span",
|
|
49
|
+
WORKER = "web-worker"
|
|
49
50
|
}
|
|
50
51
|
export declare enum PerformanceTypes {
|
|
51
52
|
Resource = "resource",
|
|
@@ -444,6 +445,13 @@ export declare enum OtelNetworkAttrs {
|
|
|
444
445
|
export type Browser = 'Chrome' | 'Edge' | 'Firefox' | 'Safari' | 'Opera' | 'IE' | 'Unknown';
|
|
445
446
|
export type OS = 'Windows' | 'MacOS' | 'Linux' | 'iOS' | 'Android' | 'Tizen' | 'webOS' | 'Unknown';
|
|
446
447
|
export type Device = 'Mobile' | 'Tablet' | 'Desktop' | 'Smart-TV' | 'Unknown';
|
|
448
|
+
export type UserAgentData = {
|
|
449
|
+
browser: Browser;
|
|
450
|
+
browserVersion: string;
|
|
451
|
+
os: OS;
|
|
452
|
+
osVersion: string;
|
|
453
|
+
device: Device;
|
|
454
|
+
};
|
|
447
455
|
export type EventName = keyof HTMLElementEventMap;
|
|
448
456
|
export interface PatternReplacement {
|
|
449
457
|
pattern: RegExp;
|
package/src/utils/all.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PageContext, PatternReplacement, UrlBlueprinter, UserAgentData, WebVitalsRating } from '../types';
|
|
2
2
|
import { Attributes } from '@opentelemetry/api';
|
|
3
3
|
export declare const supportedPerformanceTypes: Set<string>;
|
|
4
4
|
export declare function valueEndWithOrInclude(value: string, extensions: string[]): boolean;
|
|
@@ -6,13 +6,7 @@ export declare function getInstrumentationConfig<T>(value: T | boolean | undefin
|
|
|
6
6
|
export declare const hrTimeToMilliseconds: ([seconds, nanoseconds]: [number, number]) => number;
|
|
7
7
|
export declare const isNetworkError: (status?: number) => boolean;
|
|
8
8
|
export declare const getUrlFragments: (url: string) => string;
|
|
9
|
-
export declare function parseUserAgent(userAgent: string):
|
|
10
|
-
browser: Browser;
|
|
11
|
-
browserVersion: string;
|
|
12
|
-
os: OS;
|
|
13
|
-
osVersion: string;
|
|
14
|
-
device: Device;
|
|
15
|
-
};
|
|
9
|
+
export declare function parseUserAgent(userAgent: string): UserAgentData;
|
|
16
10
|
export declare function calculateTotalBlockingTime(list: PerformanceEntry[]): number;
|
|
17
11
|
export declare function generateWebVitalUniqueID(): string;
|
|
18
12
|
export declare function rateForTBTMetricValue(value: number): WebVitalsRating;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.8.
|
|
1
|
+
export declare const SDK_VERSION = "2.8.4";
|