@coralogix/browser 1.4.11 → 1.4.19
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/README.md +146 -30
- package/package.json +1 -1
- package/src/constants.d.ts +3 -2
- package/src/constants.js +2 -2
- package/src/constants.js.map +1 -1
- package/src/custom-spans/custom-spans.consts.d.ts +3 -0
- package/src/custom-spans/custom-spans.consts.js +4 -0
- package/src/custom-spans/custom-spans.consts.js.map +1 -0
- package/src/custom-spans/custom-spans.types.d.ts +15 -0
- package/src/custom-spans/custom-spans.types.js +2 -0
- package/src/custom-spans/custom-spans.types.js.map +1 -0
- package/src/custom-spans/custom-spans.utils.d.ts +13 -0
- package/src/custom-spans/custom-spans.utils.js +40 -0
- package/src/custom-spans/custom-spans.utils.js.map +1 -0
- package/src/custom-spans/index.d.ts +3 -0
- package/src/custom-spans/index.js +4 -0
- package/src/custom-spans/index.js.map +1 -0
- package/src/index.js +71 -8
- package/src/index.js.map +1 -1
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +4 -1
- package/src/instrumentations/CoralogixErrorInstrumentation.js +24 -7
- package/src/instrumentations/CoralogixErrorInstrumentation.js.map +1 -1
- package/src/instrumentations/network/CoralogixFetchInstrumentation.js +4 -0
- package/src/instrumentations/network/CoralogixFetchInstrumentation.js.map +1 -1
- package/src/instrumentations/network/CoralogixXhrInstrumentation.js +4 -0
- package/src/instrumentations/network/CoralogixXhrInstrumentation.js.map +1 -1
- package/src/instrumentations/network/network.utils.d.ts +2 -0
- package/src/instrumentations/network/network.utils.js +11 -0
- package/src/instrumentations/network/network.utils.js.map +1 -0
- package/src/instrumentations/user-interaction/CoralogixUserInteractionInstrumentation.js +8 -1
- package/src/instrumentations/user-interaction/CoralogixUserInteractionInstrumentation.js.map +1 -1
- package/src/labels/index.d.ts +1 -0
- package/src/labels/index.js +2 -0
- package/src/labels/index.js.map +1 -0
- package/src/labels/labels.utils.d.ts +4 -0
- package/src/labels/labels.utils.js +11 -0
- package/src/labels/labels.utils.js.map +1 -0
- package/src/otel/index.d.ts +2 -0
- package/src/otel/index.js +3 -0
- package/src/otel/index.js.map +1 -0
- package/src/otel/otel.consts.d.ts +18 -0
- package/src/otel/otel.consts.js +20 -0
- package/src/otel/otel.consts.js.map +1 -0
- package/src/otel/otel.utils.d.ts +7 -0
- package/src/otel/otel.utils.js +14 -0
- package/src/otel/otel.utils.js.map +1 -0
- package/src/processors/CoralogixSpanMapProcessor.js +12 -5
- package/src/processors/CoralogixSpanMapProcessor.js.map +1 -1
- package/src/session/sessionManager.js +2 -0
- package/src/session/sessionManager.js.map +1 -1
- package/src/types.d.ts +18 -5
- package/src/types.js +1 -0
- package/src/types.js.map +1 -1
- package/src/version.d.ts +1 -1
- package/src/version.js +1 -1
- package/src/workers/session-recording-worker.js +7 -0
- package/src/workers/session-recording-worker.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
+
<details>
|
|
2
|
+
<summary><strong>Table of Contents</strong></summary>
|
|
3
|
+
|
|
4
|
+
1. [Official Coralogix SDK for Browsers](#official-coralogix-sdk-for-browsers)
|
|
5
|
+
2. [Links](#links)
|
|
6
|
+
3. [Supported Frameworks](#supported-frameworks)
|
|
7
|
+
4. [Usage](#usage)
|
|
8
|
+
5. [Sampling](#sampling)
|
|
9
|
+
|
|
10
|
+
- [Basic Sampling](#1-basic-sampling---sample--of-all-sessions)
|
|
11
|
+
- [Advanced Sampling](#2-advanced-sampling---sample--of-sessions-but-always-track-sessions-with-errors)
|
|
12
|
+
- [Only Sessions with Errors](#3-only-sessions-with-errors)
|
|
13
|
+
|
|
14
|
+
6. [Sending Custom Logs](#sending-custom-logs)
|
|
15
|
+
7. [Instrumentations](#instrumentations)
|
|
16
|
+
8. [Manually Capture Errors](#manually-capture-errors)
|
|
17
|
+
9. [Session Recording](#session-recording)
|
|
18
|
+
|
|
19
|
+
- [Recording Manually](#recording-manually)
|
|
20
|
+
- [Privacy & Security](#privacy--security)
|
|
21
|
+
- [Performance](#performance)
|
|
22
|
+
- [Worker URL](#worker-url)
|
|
23
|
+
- [Screenshots](#screenshots)
|
|
24
|
+
|
|
25
|
+
10. [Network Extra Configuration](#network-extra-configuration)
|
|
26
|
+
11. [Multi Page Application](#multi-page-application)
|
|
27
|
+
12. [Ignore Errors](#ignore-errors)
|
|
28
|
+
13. [Ignore URLs](#ignore-urls)
|
|
29
|
+
14. [Mask Elements](#mask-elements)
|
|
30
|
+
15. [Label Providers](#label-providers)
|
|
31
|
+
16. [URL Blueprinters](#url-blueprinters)
|
|
32
|
+
17. [Traces](#traces)
|
|
33
|
+
|
|
34
|
+
- [Propagate Trace Header for CORS URLs](#propagatetraceheadercorsurls)
|
|
35
|
+
- [Allowed Tracing URLs](#allowedtracingurls)
|
|
36
|
+
- [Extra Propagators (B3 / AWS X-Ray)](#b3--aws-x-ray-propagation)
|
|
37
|
+
|
|
38
|
+
18. [Before Send](#before-send)
|
|
39
|
+
19. [Proxy URL](#proxy-url)
|
|
40
|
+
20. [Collect IP Data](#collect-ip-data)
|
|
41
|
+
21. [Custom Measurement](#custom-measurement)
|
|
42
|
+
22. [Add Timing](#add-timing)
|
|
43
|
+
23. [Custom Time Measurement](#custom-time-measurement)
|
|
44
|
+
24. [Microfrontend Support](#microfrontend-support)
|
|
45
|
+
|
|
46
|
+
- [Pre Requisites](#pre-requisites)
|
|
47
|
+
|
|
48
|
+
25. [Custom Spans](#custom-spans)
|
|
49
|
+
|
|
50
|
+
- [Ignored Instruments](#ignored-instruments)
|
|
51
|
+
|
|
52
|
+
26. [Soft Navigations (Experimental)](#soft-navigations--experimental)
|
|
53
|
+
27. [Memory Usage (Experimental)](#memory-usage---experimental)
|
|
54
|
+
28. [CDN](#cdn)
|
|
55
|
+
|
|
56
|
+
- [Specific Version](#specific-version-recommended)
|
|
57
|
+
- [Latest Version](#latest-version)
|
|
58
|
+
- [Add the CDN Script to Your Application](#add-the-cdn-script-to-your-application)
|
|
59
|
+
- [Initialization](#initialization)
|
|
60
|
+
- [Via JS File](#via-js-file)
|
|
61
|
+
- [Via TS File](#via-ts-file)
|
|
62
|
+
|
|
63
|
+
29. [Flutter Web](#flutter-web)
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
</details>
|
|
68
|
+
|
|
1
69
|
# Official Coralogix SDK for Browsers
|
|
2
70
|
|
|
3
71
|
[](https://www.npmjs.com/package/@coralogix/browser)
|
|
@@ -69,6 +137,7 @@ CoralogixRum.setApplicationContext({
|
|
|
69
137
|
### Sampling
|
|
70
138
|
|
|
71
139
|
#### 1. Basic Sampling - sample % of all sessions
|
|
140
|
+
|
|
72
141
|
```javascript
|
|
73
142
|
CoralogixRum.init({
|
|
74
143
|
// ...
|
|
@@ -79,18 +148,21 @@ CoralogixRum.init({
|
|
|
79
148
|
```
|
|
80
149
|
|
|
81
150
|
#### 2. Advanced Sampling - sample % of sessions, but always track sessions with errors
|
|
151
|
+
|
|
82
152
|
This configuration will ensure all sessions with errors are tracked, and a percentage of sessions without errors are also tracked.
|
|
153
|
+
|
|
83
154
|
```javascript
|
|
84
155
|
CoralogixRum.init({
|
|
85
156
|
// ...
|
|
86
157
|
sessionConfig: {
|
|
87
158
|
sessionSampleRate: 50,
|
|
88
|
-
alwaysTrackSessionsWithErrors: true,
|
|
159
|
+
alwaysTrackSessionsWithErrors: true,
|
|
89
160
|
},
|
|
90
161
|
});
|
|
91
162
|
```
|
|
92
163
|
|
|
93
164
|
#### 3. Only Sessions with Errors
|
|
165
|
+
|
|
94
166
|
Track only sessions with errors, and send specific instrumentation data immediately even if error is not occurred.
|
|
95
167
|
From Session recording perspective, the SDK will record approximately 10–60s(according to maxRecordTime property) before the error occurred.
|
|
96
168
|
|
|
@@ -118,7 +190,6 @@ CoralogixRum.init({
|
|
|
118
190
|
});
|
|
119
191
|
```
|
|
120
192
|
|
|
121
|
-
|
|
122
193
|
### Sending Custom Logs
|
|
123
194
|
|
|
124
195
|
```javascript
|
|
@@ -155,13 +226,18 @@ CoralogixRum.init({
|
|
|
155
226
|
|
|
156
227
|
### Manually Capture Errors
|
|
157
228
|
|
|
158
|
-
You can pass an Error object to
|
|
229
|
+
You can pass an Error object to capture it as an event.<br>
|
|
230
|
+
Additionally, you can include custom data and labels with the event.
|
|
159
231
|
|
|
160
232
|
```javascript
|
|
161
233
|
try {
|
|
162
234
|
// Some code that might throw an error
|
|
163
235
|
} catch (error) {
|
|
164
236
|
CoralogixRum.captureError(error);
|
|
237
|
+
|
|
238
|
+
CoralogixRum.captureError(error, { custom_data: { id: '123' } }); // add custom data
|
|
239
|
+
|
|
240
|
+
CoralogixRum.captureError(error, { custom_data: { id: '123' } }, { label1: 'value1' }); // add custom data and labels
|
|
165
241
|
}
|
|
166
242
|
```
|
|
167
243
|
|
|
@@ -244,33 +320,35 @@ CoralogixRum.init({
|
|
|
244
320
|
```
|
|
245
321
|
|
|
246
322
|
#### Worker Url
|
|
323
|
+
|
|
247
324
|
By default, Session recording uses an inline web worker script to compress data before transmission. For added flexibility, you can host a custom worker script on your own domain. Simply host the following file on your server: [worker.min.js](https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/worker.min.js)
|
|
248
325
|
|
|
249
326
|
For a locally hosted worker file:
|
|
327
|
+
|
|
250
328
|
```javascript
|
|
251
329
|
CoralogixRum.init({
|
|
252
330
|
// ...
|
|
253
331
|
sessionRecordingConfig: {
|
|
254
332
|
// ...
|
|
255
|
-
workerUrl:
|
|
333
|
+
workerUrl: '/assets/worker.min.js',
|
|
256
334
|
},
|
|
257
335
|
});
|
|
258
|
-
|
|
259
336
|
```
|
|
260
337
|
|
|
261
338
|
For an externally hosted worker file:
|
|
339
|
+
|
|
262
340
|
```javascript
|
|
263
341
|
CoralogixRum.init({
|
|
264
342
|
// ...
|
|
265
343
|
sessionRecordingConfig: {
|
|
266
344
|
// ...
|
|
267
|
-
|
|
345
|
+
workerUrl: 'https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/worker.min.js',
|
|
268
346
|
},
|
|
269
347
|
});
|
|
270
|
-
|
|
271
348
|
```
|
|
272
349
|
|
|
273
350
|
#### Screenshots
|
|
351
|
+
|
|
274
352
|
Screenshot is a feature that allows you to capture a screenshot of the user's screen at the time of an error or based on specific custom logic triggers.<br>
|
|
275
353
|
Note that the Screenshot feature is a subset of session recording and shares the same configurations, including options like masking, sample rate and others.<br>
|
|
276
354
|
`sessionRecordingConfig` must be enabled to use this feature.<br>
|
|
@@ -284,14 +362,17 @@ CoralogixRum.init({
|
|
|
284
362
|
},
|
|
285
363
|
});
|
|
286
364
|
```
|
|
365
|
+
|
|
287
366
|
Capture a screenshot manually:
|
|
367
|
+
|
|
288
368
|
```javascript
|
|
289
369
|
CoralogixRum.screenshot();
|
|
290
370
|
// or with a description
|
|
291
371
|
CoralogixRum.screenshot('Screenshot after the user logged in');
|
|
292
|
-
|
|
372
|
+
```
|
|
293
373
|
|
|
294
374
|
Capture a screen automatically based on custom logic, using the beforeSend
|
|
375
|
+
|
|
295
376
|
```javascript
|
|
296
377
|
CoralogixRum.init({
|
|
297
378
|
// ...
|
|
@@ -303,11 +384,10 @@ CoralogixRum.init({
|
|
|
303
384
|
event.screenshotId = id;
|
|
304
385
|
}
|
|
305
386
|
|
|
306
|
-
return event
|
|
307
|
-
}
|
|
387
|
+
return event;
|
|
388
|
+
},
|
|
308
389
|
});
|
|
309
|
-
|
|
310
|
-
````
|
|
390
|
+
```
|
|
311
391
|
|
|
312
392
|
### Network Extra Configuration
|
|
313
393
|
|
|
@@ -317,19 +397,19 @@ The `networkExtraConfig` property is an array of configuration objects, each spe
|
|
|
317
397
|
CoralogixRum.init({
|
|
318
398
|
networkExtraConfig: [
|
|
319
399
|
{
|
|
320
|
-
url: 'http://example.com',
|
|
400
|
+
url: 'http://example.com', // Capture requests to this specific URL or regex pattern
|
|
321
401
|
reqHeaders: ['Authorization', 'Content-Type'], // Capture 'Authorization' and 'Content-Type' headers in requests
|
|
322
|
-
resHeaders: ['Cache-Control', 'Date'],
|
|
323
|
-
collectReqPayload: true,
|
|
324
|
-
collectResPayload: false
|
|
402
|
+
resHeaders: ['Cache-Control', 'Date'], // Capture 'Cache-Control' and 'Date' headers in responses
|
|
403
|
+
collectReqPayload: true, // Collect request payload
|
|
404
|
+
collectResPayload: false, // Do not collect response payload
|
|
325
405
|
},
|
|
326
406
|
],
|
|
327
407
|
});
|
|
328
408
|
```
|
|
329
|
-
#### Important Note
|
|
330
|
-
The server must explicitly permit access to specific headers by listing them in the `Access-Control-Expose-Headers` response header. Due to restrictions in the Fetch and XHR APIs, header retrieval operates on a best-effort basis, meaning that some headers may occasionally be unavailable in the events collected by this integration. Additionally, any large payloads exceeding the allowed size will be dropped.
|
|
331
409
|
|
|
410
|
+
#### Important Note
|
|
332
411
|
|
|
412
|
+
The server must explicitly permit access to specific headers by listing them in the `Access-Control-Expose-Headers` response header. Due to restrictions in the Fetch and XHR APIs, header retrieval operates on a best-effort basis, meaning that some headers may occasionally be unavailable in the events collected by this integration. Additionally, any large payloads exceeding the allowed size will be dropped.
|
|
333
413
|
|
|
334
414
|
### Multi Page Application
|
|
335
415
|
|
|
@@ -390,7 +470,9 @@ CoralogixRum.init({
|
|
|
390
470
|
maskClass: 'mask-me', // will mask any clickable element with class 'mask-me'
|
|
391
471
|
});
|
|
392
472
|
```
|
|
473
|
+
|
|
393
474
|
Examples of masked elements:
|
|
475
|
+
|
|
394
476
|
```javascript
|
|
395
477
|
<button class="cx-mask">
|
|
396
478
|
<span>Some Text</span>
|
|
@@ -402,7 +484,7 @@ Examples of masked elements:
|
|
|
402
484
|
|
|
403
485
|
<my-button-component class="cx-mask">
|
|
404
486
|
<button>Text</button>
|
|
405
|
-
</my-button-component>
|
|
487
|
+
</my-button-component>
|
|
406
488
|
|
|
407
489
|
```
|
|
408
490
|
|
|
@@ -485,6 +567,7 @@ CoralogixRum.init({
|
|
|
485
567
|
|
|
486
568
|
When the backend domain is different from the app domain, specifying backend domains is necessary. <br>
|
|
487
569
|
For example, if the app is hosted on `https://app.com` and the backend is hosted on `https://webapi.com`, you should specify the backend domain.
|
|
570
|
+
|
|
488
571
|
```javascript
|
|
489
572
|
CoralogixRum.init({
|
|
490
573
|
// ...
|
|
@@ -517,7 +600,9 @@ CoralogixRum.init({
|
|
|
517
600
|
```
|
|
518
601
|
|
|
519
602
|
### Extra Propagators
|
|
603
|
+
|
|
520
604
|
#### B3 / AWS X-Ray Propagation
|
|
605
|
+
|
|
521
606
|
```javascript
|
|
522
607
|
CoralogixRum.init({
|
|
523
608
|
// ...
|
|
@@ -526,7 +611,7 @@ CoralogixRum.init({
|
|
|
526
611
|
options: {
|
|
527
612
|
// ...
|
|
528
613
|
/* for B3 propagation */
|
|
529
|
-
propagateB3TraceHeader: {
|
|
614
|
+
propagateB3TraceHeader: {
|
|
530
615
|
singleHeader: true,
|
|
531
616
|
multiHeader: true,
|
|
532
617
|
},
|
|
@@ -537,8 +622,7 @@ CoralogixRum.init({
|
|
|
537
622
|
});
|
|
538
623
|
```
|
|
539
624
|
|
|
540
|
-
|
|
541
|
-
### beforeSend
|
|
625
|
+
### Before Send
|
|
542
626
|
|
|
543
627
|
Enable event access and modification before sending to Coralogix, supporting content modification, and event discarding.
|
|
544
628
|
|
|
@@ -601,9 +685,9 @@ The timing relates to the time between the page load and the moment the timing i
|
|
|
601
685
|
For example, you can add a timing for the first click event.
|
|
602
686
|
|
|
603
687
|
```javascript
|
|
604
|
-
window.addEventListener('click', function handler(){
|
|
688
|
+
window.addEventListener('click', function handler() {
|
|
605
689
|
window.removeEventListener('click', handler);
|
|
606
|
-
|
|
690
|
+
|
|
607
691
|
CoralogixRum.addTiming('first-click');
|
|
608
692
|
});
|
|
609
693
|
```
|
|
@@ -611,10 +695,11 @@ window.addEventListener('click', function handler(){
|
|
|
611
695
|
OR
|
|
612
696
|
|
|
613
697
|
You can provide your own timing.
|
|
698
|
+
|
|
614
699
|
```javascript
|
|
615
|
-
window.addEventListener('click', function handler(){
|
|
700
|
+
window.addEventListener('click', function handler() {
|
|
616
701
|
window.removeEventListener('click', handler);
|
|
617
|
-
|
|
702
|
+
|
|
618
703
|
CoralogixRum.addTiming('first-click', 1000);
|
|
619
704
|
});
|
|
620
705
|
```
|
|
@@ -640,6 +725,7 @@ This feature allows you to track multiple applications on the same page.<br>
|
|
|
640
725
|
<b>Only errors with stacktrace are supported.</b>
|
|
641
726
|
|
|
642
727
|
#### Pre Requisites
|
|
728
|
+
|
|
643
729
|
To support microfrontend, you need to install one of these plugins: [webpack](https://www.npmjs.com/package/@coralogix/webpack-plugin), [esbuild](https://www.npmjs.com/package/@coralogix/esbuild-plugin) and include them in your build process.<br>
|
|
644
730
|
Plugins for other bundlers are coming soon.
|
|
645
731
|
|
|
@@ -652,6 +738,36 @@ CoralogixRum.init({
|
|
|
652
738
|
});
|
|
653
739
|
```
|
|
654
740
|
|
|
741
|
+
### Custom Spans
|
|
742
|
+
|
|
743
|
+
Create your own custom spans to track specific operations in your application.<br>
|
|
744
|
+
Each span will share the same trace ID, which will allow you to create flows in your application and see them in the [Tracing view](https://coralogix.com/docs/user-guides/monitoring-and-insights/distributed-tracing/distributed-tracing/).<br>
|
|
745
|
+
Labels can be added during span creation for additional context.
|
|
746
|
+
|
|
747
|
+
```javascript
|
|
748
|
+
const customTracer = CoralogixRum.getCustomTracer();
|
|
749
|
+
const globalSpan = customTracer.startGlobalSpan('global-span', { page: 'posts' });
|
|
750
|
+
|
|
751
|
+
globalSpan.withContext(async () => {
|
|
752
|
+
const customSpan = globalSpan.startCustomSpan('custom-span', { action: 'scroll' });
|
|
753
|
+
customSpan.endSpan();
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
// note: End the global span only after the operation is complete.
|
|
757
|
+
globalSpan.endSpan();
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
#### Ignored Instruments
|
|
761
|
+
|
|
762
|
+
After creating a global span, some of the instrumented events (network, errors, interactions) will automatically share the same trace ID, unless specifically ignored.
|
|
763
|
+
|
|
764
|
+
```javascript
|
|
765
|
+
const customTracer = CoralogixRum.getCustomTracer({
|
|
766
|
+
ignoredInstruments: [CoralogixEventType.NETWORK_REQUEST, CoralogixEventType.ERROR, CoralogixEventType.USER_INTERACTION],
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
// ... your code
|
|
770
|
+
```
|
|
655
771
|
|
|
656
772
|
### Soft Navigations — Experimental
|
|
657
773
|
|
|
@@ -679,10 +795,10 @@ To enable the feature, your website needs to be in a [secure context](https://de
|
|
|
679
795
|
```javascript
|
|
680
796
|
CoralogixRum.init({
|
|
681
797
|
// ...
|
|
682
|
-
memoryUsageConfig:{
|
|
683
|
-
enabled:true,
|
|
684
|
-
interval: 300_000 // Defaults to 5 minutes
|
|
685
|
-
}
|
|
798
|
+
memoryUsageConfig: {
|
|
799
|
+
enabled: true,
|
|
800
|
+
interval: 300_000, // Defaults to 5 minutes
|
|
801
|
+
},
|
|
686
802
|
});
|
|
687
803
|
```
|
|
688
804
|
|
package/package.json
CHANGED
package/src/constants.d.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { CoralogixCustomLogInstrumentation } from './instrumentations/CoralogixC
|
|
|
6
6
|
import { CoralogixWebVitalsInstrumentation } from './instrumentations/CoralogixWebVitalsInstrumentation';
|
|
7
7
|
import { CoralogixLongTaskInstrumentation } from './instrumentations/CoralogixLongTaskInstrumentation';
|
|
8
8
|
import { CoralogixResourcesInstrumentation } from './instrumentations/CoralogixResourcesInstrumentation';
|
|
9
|
-
import { CoralogixInternalInstrumentation } from './instrumentations/CoralogixInternalInstrumentation';
|
|
10
|
-
import { CoralogixDOMInstrumentation } from './instrumentations/CoralogixDOMInstrumentation';
|
|
11
9
|
import { CoralogixUserInteractionInstrumentation } from './instrumentations/user-interaction/CoralogixUserInteractionInstrumentation';
|
|
12
10
|
import { CoralogixMemoryUsageInstrumentation } from './instrumentations/memory-usage';
|
|
13
11
|
import { CoralogixScreenshotInstrumentation } from './instrumentations/screenshot/CoralogixScreenshotInstrumentation';
|
|
14
12
|
import { CoralogixCustomMeasurementInstrumentation } from './instrumentations/custom-measurements';
|
|
13
|
+
import { CoralogixInternalInstrumentation } from './instrumentations/CoralogixInternalInstrumentation';
|
|
14
|
+
import { CoralogixDOMInstrumentation } from './instrumentations/CoralogixDOMInstrumentation';
|
|
15
15
|
export declare const CORALOGIX_LOGS_URL_SUFFIX = "/browser/v1beta/logs";
|
|
16
16
|
export declare const CORALOGIX_RECORDING_URL_SUFFIX = "/sessionrecording";
|
|
17
17
|
export declare const MAX_EXPORT_BATCH_SIZE = 50;
|
|
@@ -98,6 +98,7 @@ export declare const CoralogixAttributes: {
|
|
|
98
98
|
TYPE: string;
|
|
99
99
|
STACK: string;
|
|
100
100
|
MESSAGE: string;
|
|
101
|
+
DATA: string;
|
|
101
102
|
};
|
|
102
103
|
LOG: string;
|
|
103
104
|
CUSTOM_LABELS: string;
|
package/src/constants.js
CHANGED
|
@@ -8,13 +8,13 @@ import { CoralogixLongTaskInstrumentation } from './instrumentations/CoralogixLo
|
|
|
8
8
|
import { CoralogixResourcesInstrumentation } from './instrumentations/CoralogixResourcesInstrumentation';
|
|
9
9
|
import { replacePatternsInUrl } from './utils';
|
|
10
10
|
import { millisecondsPerSecond } from './utils/time';
|
|
11
|
-
import { CoralogixInternalInstrumentation } from './instrumentations/CoralogixInternalInstrumentation';
|
|
12
|
-
import { CoralogixDOMInstrumentation } from './instrumentations/CoralogixDOMInstrumentation';
|
|
13
11
|
import { CoralogixUserInteractionInstrumentation } from './instrumentations/user-interaction/CoralogixUserInteractionInstrumentation';
|
|
14
12
|
import { CoralogixMemoryUsageInstrumentation, MEMORY_USAGE_INSTRUMENTATION_NAME, } from './instrumentations/memory-usage';
|
|
15
13
|
import { CoralogixScreenshotInstrumentation } from './instrumentations/screenshot/CoralogixScreenshotInstrumentation';
|
|
16
14
|
import { SCREENSHOT_INSTRUMENTATION_NAME } from './instrumentations/screenshot/screenshot.utils';
|
|
17
15
|
import { CoralogixCustomMeasurementInstrumentation } from './instrumentations/custom-measurements';
|
|
16
|
+
import { CoralogixInternalInstrumentation } from './instrumentations/CoralogixInternalInstrumentation';
|
|
17
|
+
import { CoralogixDOMInstrumentation } from './instrumentations/CoralogixDOMInstrumentation';
|
|
18
18
|
export const CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
|
|
19
19
|
export const CORALOGIX_RECORDING_URL_SUFFIX = '/sessionrecording';
|
|
20
20
|
export const MAX_EXPORT_BATCH_SIZE = 50;
|
package/src/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../libs/browser/src/constants.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0DAA0D,CAAC;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AACrG,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EACL,uCAAuC,EACvC,wBAAwB,EACxB,6BAA6B,EAC7B,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../libs/browser/src/constants.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kDAAkD,CAAC;AAC1D,OA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AAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAC7B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-spans.consts.js","sourceRoot":"","sources":["../../../../../libs/browser/src/custom-spans/custom-spans.consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AACpD,MAAM,CAAC,MAAM,iCAAiC,GAC5C,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Span } from '@opentelemetry/api';
|
|
2
|
+
import { CoralogixEventType, CoralogixRumLabels } from '../types';
|
|
3
|
+
export interface GlobalSpan {
|
|
4
|
+
span: Span;
|
|
5
|
+
withContext: (fn: () => void) => void;
|
|
6
|
+
endSpan: () => void;
|
|
7
|
+
startCustomSpan: (name: string, labels?: CoralogixRumLabels) => {
|
|
8
|
+
span: Span;
|
|
9
|
+
endSpan: () => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface CustomTracer {
|
|
13
|
+
startGlobalSpan: (name: string, labels?: CoralogixRumLabels) => GlobalSpan | undefined;
|
|
14
|
+
}
|
|
15
|
+
export type CustomTracerIgnoredInstruments = CoralogixEventType.ERROR | CoralogixEventType.NETWORK_REQUEST | CoralogixEventType.USER_INTERACTION;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-spans.types.js","sourceRoot":"","sources":["../../../../../libs/browser/src/custom-spans/custom-spans.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CustomTracerIgnoredInstruments, GlobalSpan } from './custom-spans.types';
|
|
2
|
+
import { Tracer } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { Span } from '@opentelemetry/api';
|
|
4
|
+
export declare function setGlobalSpan(globalSpan: GlobalSpan): void;
|
|
5
|
+
export declare function getGlobalSpan(): GlobalSpan;
|
|
6
|
+
export declare function clearGlobalSpan(): void;
|
|
7
|
+
export declare function setCustomTracer(customTracer: Tracer): void;
|
|
8
|
+
export declare function getCustomTracer(): Tracer;
|
|
9
|
+
export declare function clearCustomTracer(): void;
|
|
10
|
+
export declare function setCustomTracerIgnoredInstruments(ignoredInstruments: CustomTracerIgnoredInstruments[]): void;
|
|
11
|
+
export declare function getCustomTracerIgnoredInstruments(): CustomTracerIgnoredInstruments[];
|
|
12
|
+
export declare function shouldAttachSpanToGlobalSpan(instrumentationType: CustomTracerIgnoredInstruments): boolean;
|
|
13
|
+
export declare function attachChildSpanToGlobalSpan(name: string): Span;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CUSTOM_TRACER_IGNORED_INSTRUMENTS, CUSTOM_TRACER_KEY, GLOBAL_SPAN_KEY, } from './custom-spans.consts';
|
|
2
|
+
export function setGlobalSpan(globalSpan) {
|
|
3
|
+
window[GLOBAL_SPAN_KEY] = globalSpan;
|
|
4
|
+
}
|
|
5
|
+
export function getGlobalSpan() {
|
|
6
|
+
return window[GLOBAL_SPAN_KEY];
|
|
7
|
+
}
|
|
8
|
+
export function clearGlobalSpan() {
|
|
9
|
+
delete window[GLOBAL_SPAN_KEY];
|
|
10
|
+
}
|
|
11
|
+
export function setCustomTracer(customTracer) {
|
|
12
|
+
window[CUSTOM_TRACER_KEY] = customTracer;
|
|
13
|
+
}
|
|
14
|
+
export function getCustomTracer() {
|
|
15
|
+
return window[CUSTOM_TRACER_KEY];
|
|
16
|
+
}
|
|
17
|
+
export function clearCustomTracer() {
|
|
18
|
+
delete window[CUSTOM_TRACER_KEY];
|
|
19
|
+
}
|
|
20
|
+
export function setCustomTracerIgnoredInstruments(ignoredInstruments) {
|
|
21
|
+
window[CUSTOM_TRACER_IGNORED_INSTRUMENTS] = ignoredInstruments;
|
|
22
|
+
}
|
|
23
|
+
export function getCustomTracerIgnoredInstruments() {
|
|
24
|
+
return window[CUSTOM_TRACER_IGNORED_INSTRUMENTS];
|
|
25
|
+
}
|
|
26
|
+
export function shouldAttachSpanToGlobalSpan(instrumentationType) {
|
|
27
|
+
var _a;
|
|
28
|
+
return (getGlobalSpan() &&
|
|
29
|
+
!((_a = getCustomTracerIgnoredInstruments()) === null || _a === void 0 ? void 0 : _a.includes(instrumentationType)));
|
|
30
|
+
}
|
|
31
|
+
export function attachChildSpanToGlobalSpan(name) {
|
|
32
|
+
let span;
|
|
33
|
+
const globalSpan = getGlobalSpan();
|
|
34
|
+
globalSpan.withContext(() => {
|
|
35
|
+
const childSpan = globalSpan.startCustomSpan(name);
|
|
36
|
+
span = childSpan.span;
|
|
37
|
+
});
|
|
38
|
+
return span;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=custom-spans.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-spans.utils.js","sourceRoot":"","sources":["../../../../../libs/browser/src/custom-spans/custom-spans.utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,iCAAiC,EACjC,iBAAiB,EACjB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,UAAU,aAAa,CAAC,UAAsB;IAClD,MAAM,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,YAAoB;IAClD,MAAM,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,eAAe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