@coralogix/browser 1.0.77 → 1.0.81
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 +43 -4
- package/package.json +1 -1
- package/src/CoralogixExporter.d.ts +3 -1
- package/src/CoralogixExporter.js +52 -29
- package/src/CoralogixExporter.js.map +1 -1
- package/src/CoralogixSpanAttributesProcessor.d.ts +4 -5
- package/src/CoralogixSpanAttributesProcessor.js +0 -2
- package/src/CoralogixSpanAttributesProcessor.js.map +1 -1
- package/src/constants.d.ts +18 -13
- package/src/constants.js +37 -14
- package/src/constants.js.map +1 -1
- package/src/filters/filters.d.ts +2 -0
- package/src/filters/filters.js +28 -0
- package/src/filters/filters.js.map +1 -0
- package/src/index.js +16 -2
- package/src/index.js.map +1 -1
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +0 -1
- package/src/instrumentations/CoralogixErrorInstrumentation.js +1 -46
- package/src/instrumentations/CoralogixErrorInstrumentation.js.map +1 -1
- package/src/instrumentations/CoralogixInternalInstrumentation.d.ts +11 -0
- package/src/instrumentations/CoralogixInternalInstrumentation.js +50 -0
- package/src/instrumentations/CoralogixInternalInstrumentation.js.map +1 -0
- package/src/instrumentations/instrumentation.consts.d.ts +1 -0
- package/src/instrumentations/instrumentation.consts.js +1 -0
- package/src/instrumentations/instrumentation.consts.js.map +1 -1
- package/src/internal-event-reporter.d.ts +2 -0
- package/src/internal-event-reporter.js +7 -0
- package/src/internal-event-reporter.js.map +1 -0
- package/src/session/session.consts.d.ts +1 -0
- package/src/session/session.consts.js +1 -0
- package/src/session/session.consts.js.map +1 -1
- package/src/session/session.model.d.ts +2 -0
- package/src/session/session.model.js.map +1 -1
- package/src/session/sessionManager.js +13 -2
- package/src/session/sessionManager.js.map +1 -1
- package/src/session/sessionRecorder.js +5 -2
- package/src/session/sessionRecorder.js.map +1 -1
- package/src/types.d.ts +29 -6
- package/src/types.js +1 -0
- package/src/types.js.map +1 -1
- package/src/{utils.d.ts → utils/all.d.ts} +9 -3
- package/src/{utils.js → utils/all.js} +42 -21
- package/src/utils/all.js.map +1 -0
- package/src/utils/index.d.ts +4 -0
- package/src/utils/index.js +5 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/internal-rum-data.d.ts +2 -0
- package/src/utils/internal-rum-data.js +12 -0
- package/src/utils/internal-rum-data.js.map +1 -0
- package/src/utils/session.d.ts +1 -0
- package/src/utils/session.js +4 -0
- package/src/utils/session.js.map +1 -0
- package/src/utils/string.d.ts +2 -0
- package/src/utils/string.js +24 -0
- package/src/utils/string.js.map +1 -0
- package/src/version.d.ts +1 -1
- package/src/version.js +1 -1
- package/src/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -25,9 +25,11 @@ CoralogixRum.init({
|
|
|
25
25
|
payment: 'visa',
|
|
26
26
|
},
|
|
27
27
|
ignoreErrors: ['some error message to ignore'],
|
|
28
|
+
sessionSampleRate: 100 // Percentage of overall sessions being tracked, defaults to 100%
|
|
28
29
|
});
|
|
29
30
|
```
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
More properties: `instrumentations`, `traceParentInHeader`, `ignoreUrls`, `debug`, `urlBlueprinters`
|
|
31
33
|
|
|
32
34
|
To provide contextual information or transmit manual logs, utilize the exported functions of `CoralogixRum`.
|
|
33
35
|
Keep in mind that these functions will remain inactive until you've invoked `CoralogixRum.init()`.
|
|
@@ -48,10 +50,11 @@ CoralogixRum.setUserContext({
|
|
|
48
50
|
|
|
49
51
|
// Update custom labels dynamically
|
|
50
52
|
CoralogixRum.setLabels({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
...CoralogixRum.getLabels(),
|
|
54
|
+
paymentMethod: 'visa',
|
|
55
|
+
userTheme: 'dark',
|
|
53
56
|
// ...
|
|
54
|
-
})
|
|
57
|
+
});
|
|
55
58
|
|
|
56
59
|
// Update application context dynamically
|
|
57
60
|
CoralogixRum.setApplicationContext({
|
|
@@ -63,6 +66,20 @@ CoralogixRum.log(CoralogixLogSeverity.Error, 'this is a log', { key: 'value' })
|
|
|
63
66
|
CoralogixRum.error('this is a log with error severity', { key: 'value' })
|
|
64
67
|
```
|
|
65
68
|
|
|
69
|
+
### Ignore Errors
|
|
70
|
+
The ignoreErrors option allows you to exclude errors that meet specific criteria.
|
|
71
|
+
This options accepts a set of strings and regular expressions to match against the event's error message.
|
|
72
|
+
Use regular expressions for exact matching as strings remove partial matches.
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
import { CoralogixRum } from '@coralogix/browser';
|
|
76
|
+
|
|
77
|
+
CoralogixRum.init({
|
|
78
|
+
// ...
|
|
79
|
+
ignoreErrors: [/Exact Match Error Message/, 'partial/match'],
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
66
83
|
|
|
67
84
|
### Label Providers
|
|
68
85
|
Provide labels based on url or event
|
|
@@ -104,6 +121,28 @@ CoralogixRum.init({
|
|
|
104
121
|
});
|
|
105
122
|
```
|
|
106
123
|
|
|
124
|
+
### Url Blueprinters
|
|
125
|
+
Modify the event's page or network url based on custom-defined functions.
|
|
126
|
+
```javascript
|
|
127
|
+
import { CoralogixRum } from '@coralogix/browser';
|
|
128
|
+
|
|
129
|
+
CoralogixRum.init({
|
|
130
|
+
// ...
|
|
131
|
+
urlBlueprinters: {
|
|
132
|
+
pageUrlBlueprinters: [
|
|
133
|
+
(url) => {
|
|
134
|
+
const hostnameParts = new URL(url).hostname.split('.');
|
|
135
|
+
hostnameParts[0] = '{team-id}';
|
|
136
|
+
return 'https://' + hostnameParts.join('.');
|
|
137
|
+
// "https://alpha.company.com" => "https://{team-id}.company.com"
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
networkUrlBlueprinters: [(url) => url.replace('api/v1', '{server}')]
|
|
141
|
+
// "https://path/api/v1/logs" => "https://path/{server}/logs"
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
107
146
|
## CDN
|
|
108
147
|
|
|
109
148
|
Coralogix Browser SDK is also provided via CDN.
|
package/package.json
CHANGED
|
@@ -5,13 +5,15 @@ type CoralogixExporterConfig = Pick<CoralogixBrowserSdkConfig, 'public_key' | 'c
|
|
|
5
5
|
export declare class CoralogixExporter implements SpanExporter {
|
|
6
6
|
private isActive;
|
|
7
7
|
private public_key;
|
|
8
|
-
private
|
|
8
|
+
private sdkConfig;
|
|
9
|
+
private url;
|
|
9
10
|
constructor({ public_key, coralogixDomain }: CoralogixExporterConfig);
|
|
10
11
|
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
11
12
|
shutdown(): Promise<void>;
|
|
12
13
|
private _mapToCxSpan;
|
|
13
14
|
private resolveLabels;
|
|
14
15
|
private _getEventTypeContext;
|
|
16
|
+
private resolvePageContext;
|
|
15
17
|
private getLabelsByLabelProviders;
|
|
16
18
|
}
|
|
17
19
|
export {};
|
package/src/CoralogixExporter.js
CHANGED
|
@@ -2,19 +2,20 @@ import { CoralogixEventType, OtelNetworkAttrs, } from './types';
|
|
|
2
2
|
import { CORALOGIX_LOGS_URL_SUFFIX, CoralogixAttributes, CoralogixDomainsApiUrlMap, NETWORK_URL_LABEL_PROVIDERS_KEY, PAGE_URL_LABEL_PROVIDERS_KEY, } from './constants';
|
|
3
3
|
import { CoralogixLogSeverity } from './types-external';
|
|
4
4
|
import ErrorStackParser from 'error-stack-parser';
|
|
5
|
-
import { deepClone, flattenAttributes, getInternalRumData, getUrlFragments, hrTimeToMilliseconds, parseUserAgent, } from './utils';
|
|
5
|
+
import { applyUrlBluePrinters, deepClone, flattenAttributes, getInternalRumData, getUrlFragments, hrTimeToMilliseconds, parseUserAgent, } from './utils';
|
|
6
6
|
import { SDK_VERSION } from './version';
|
|
7
7
|
import { ExportResultCode } from '@opentelemetry/core';
|
|
8
8
|
import { LONG_TASK_PERFORMANCE_TYPE, RESOURCES_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_NAME, } from './instrumentations/instrumentation.consts';
|
|
9
|
-
import { ErrorSource } from './instrumentations/CoralogixErrorInstrumentation';
|
|
10
9
|
import { getSdkConfig, getSessionManager, getSessionRecorder } from './helpers';
|
|
10
|
+
import { shouldDropEvent } from './filters/filters';
|
|
11
11
|
export class CoralogixExporter {
|
|
12
12
|
constructor({ public_key, coralogixDomain }) {
|
|
13
13
|
this.isActive = true;
|
|
14
14
|
this.public_key = '';
|
|
15
|
-
this.
|
|
15
|
+
this.sdkConfig = getSdkConfig();
|
|
16
|
+
this.url = '';
|
|
16
17
|
this.public_key = public_key;
|
|
17
|
-
this.
|
|
18
|
+
this.url = `${CoralogixDomainsApiUrlMap[coralogixDomain]}${CORALOGIX_LOGS_URL_SUFFIX}`;
|
|
18
19
|
}
|
|
19
20
|
export(spans, resultCallback) {
|
|
20
21
|
var _a, _b, _c;
|
|
@@ -26,24 +27,19 @@ export class CoralogixExporter {
|
|
|
26
27
|
const sessionHasRecording = !!((_c = getSessionRecorder()) === null || _c === void 0 ? void 0 : _c.getSessionHasRecording());
|
|
27
28
|
const cxSpans = spans
|
|
28
29
|
.map((s) => this._mapToCxSpan(s, session, sessionHasRecording))
|
|
29
|
-
.filter((cxSpan) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
body: JSON.stringify({ logs: cxSpans }),
|
|
44
|
-
}).catch((e) => {
|
|
45
|
-
return e;
|
|
46
|
-
});
|
|
30
|
+
.filter((cxSpan) => !shouldDropEvent(cxSpan.text.cx_rum, this.sdkConfig));
|
|
31
|
+
if (cxSpans.length) {
|
|
32
|
+
fetch(this.url, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
Authorization: `Bearer ${this.public_key}`,
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify({ logs: cxSpans }),
|
|
39
|
+
}).catch((e) => {
|
|
40
|
+
return e;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
47
43
|
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
48
44
|
}
|
|
49
45
|
shutdown() {
|
|
@@ -87,10 +83,7 @@ export class CoralogixExporter {
|
|
|
87
83
|
}, version_metadata, session_context: Object.assign(Object.assign({ session_id: sessionId, session_creation_date: sessionCreationDate, hasRecording: sessionHasRecording, user_agent: attributes[CoralogixAttributes.USER_AGENT] }, parseUserAgent(attributes[CoralogixAttributes.USER_AGENT])), { user_id,
|
|
88
84
|
user_name,
|
|
89
85
|
user_email,
|
|
90
|
-
user_metadata }), page_context: {
|
|
91
|
-
page_url: attributes[CoralogixAttributes.LOCATION_HREF],
|
|
92
|
-
page_fragments: attributes[CoralogixAttributes.LOCATION_FRAGMENTS],
|
|
93
|
-
}, event_context: {
|
|
86
|
+
user_metadata }), page_context: this.resolvePageContext(attributes), event_context: {
|
|
94
87
|
type: attributes[CoralogixAttributes.EVENT_TYPE],
|
|
95
88
|
source: attributes[CoralogixAttributes.SOURCE],
|
|
96
89
|
severity,
|
|
@@ -137,7 +130,7 @@ export class CoralogixExporter {
|
|
|
137
130
|
return allLabels;
|
|
138
131
|
}
|
|
139
132
|
_getEventTypeContext(spanAttributes, eventType, span) {
|
|
140
|
-
var _a;
|
|
133
|
+
var _a, _b;
|
|
141
134
|
switch (eventType) {
|
|
142
135
|
case CoralogixEventType.ERROR: {
|
|
143
136
|
const errorMessage = spanAttributes[CoralogixAttributes.ERROR.MESSAGE];
|
|
@@ -164,12 +157,18 @@ export class CoralogixExporter {
|
|
|
164
157
|
};
|
|
165
158
|
}
|
|
166
159
|
case CoralogixEventType.NETWORK_REQUEST: {
|
|
160
|
+
const url = spanAttributes[OtelNetworkAttrs.URL];
|
|
161
|
+
const url_blueprint = applyUrlBluePrinters({
|
|
162
|
+
url,
|
|
163
|
+
blueprinters: (_b = this.sdkConfig.urlBlueprinters) === null || _b === void 0 ? void 0 : _b.networkUrlBlueprinters,
|
|
164
|
+
});
|
|
167
165
|
return {
|
|
168
166
|
network_request_context: {
|
|
169
167
|
method: spanAttributes[OtelNetworkAttrs.METHOD],
|
|
170
168
|
status_code: spanAttributes[OtelNetworkAttrs.STATUS_CODE],
|
|
171
|
-
url
|
|
172
|
-
|
|
169
|
+
url,
|
|
170
|
+
url_blueprint,
|
|
171
|
+
fragments: getUrlFragments(url_blueprint),
|
|
173
172
|
host: spanAttributes[OtelNetworkAttrs.HOST],
|
|
174
173
|
schema: spanAttributes[OtelNetworkAttrs.SCHEME],
|
|
175
174
|
status_text: spanAttributes[OtelNetworkAttrs.STATUS_TEXT],
|
|
@@ -194,6 +193,16 @@ export class CoralogixExporter {
|
|
|
194
193
|
},
|
|
195
194
|
};
|
|
196
195
|
}
|
|
196
|
+
case CoralogixEventType.INTERNAL: {
|
|
197
|
+
const internalContext = JSON.parse(spanAttributes[CoralogixAttributes.INTERNAL]);
|
|
198
|
+
const { event, data } = internalContext || {};
|
|
199
|
+
return {
|
|
200
|
+
internal_context: {
|
|
201
|
+
event,
|
|
202
|
+
data,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
197
206
|
case CoralogixEventType.USER_INTERACTION: {
|
|
198
207
|
return {
|
|
199
208
|
interaction_context: {
|
|
@@ -228,6 +237,20 @@ export class CoralogixExporter {
|
|
|
228
237
|
}
|
|
229
238
|
return {};
|
|
230
239
|
}
|
|
240
|
+
resolvePageContext(attributes) {
|
|
241
|
+
var _a;
|
|
242
|
+
const url = attributes[CoralogixAttributes.LOCATION_HREF];
|
|
243
|
+
const page_url_blueprint = applyUrlBluePrinters({
|
|
244
|
+
url,
|
|
245
|
+
blueprinters: (_a = this.sdkConfig.urlBlueprinters) === null || _a === void 0 ? void 0 : _a.pageUrlBlueprinters,
|
|
246
|
+
});
|
|
247
|
+
const page_fragments = getUrlFragments(page_url_blueprint);
|
|
248
|
+
return {
|
|
249
|
+
page_url: url,
|
|
250
|
+
page_url_blueprint,
|
|
251
|
+
page_fragments,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
231
254
|
getLabelsByLabelProviders(labelProviders, cxRumEvent, url) {
|
|
232
255
|
let allLabels = {};
|
|
233
256
|
const cxRumEventClone = deepClone(cxRumEvent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoralogixExporter.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixExporter.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"CoralogixExporter.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixExporter.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAUlB,gBAAgB,GAMjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,gBAAgC,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAgB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOpD,MAAM,OAAO,iBAAiB;IAM5B,YAAY,EAAE,UAAU,EAAE,eAAe,EAA2B;QAL5D,aAAQ,GAAG,IAAI,CAAC;QA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gBACjC,MAAM,eAAe,GAAoB,IAAI,CAAC,KAAK,CACjD,cAAc,CAAC,8BAA8B,CAAW,CACzD,CAAC;gBAEF,OAAO;oBACL,gBAAgB,EAAE,eAAe;iBAClC,CAAC;aACH;SACF;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,kBAAkB,CAAC,UAAsB;;QAC/C,MAAM,GAAG,GAAG,UAAU,CAAC,mBAAmB,CAAC,aAAa,CAAW,CAAC;QACpE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;YAC9C,GAAG;YACH,YAAY,EAAE,MAAA,IAAI,CAAC,SAAS,CAAC,eAAe,0CAAE,mBAAmB;SAClE,CAAC,CAAC;QACH,MAAM,cAAc,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAE3D,OAAO;YACL,QAAQ,EAAE,GAAG;YACb,kBAAkB;YAClB,cAAc;SACf,CAAC;IACJ,CAAC;IAEO,yBAAyB,CAC/B,cAA+B,EAC/B,UAAsB,EACtB,GAAW;QAEX,IAAI,SAAS,GAAuB,EAAE,CAAC;QAEvC,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;QAE9C,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;YAC1C,SAAS,mCACJ,SAAS,GACT,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,eAAe,CAAC,CACpD,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Attributes } from '@opentelemetry/api';
|
|
2
1
|
import { Span, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
3
2
|
import { CoralogixRumLabels, UserContextConfig } from './types';
|
|
4
3
|
export declare class CoralogixSpanAttributesProcessor implements SpanProcessor {
|
|
5
4
|
private labels;
|
|
6
|
-
constructor(labels?:
|
|
5
|
+
constructor(labels?: CoralogixRumLabels);
|
|
7
6
|
setCustomLabels(labels?: CoralogixRumLabels): void;
|
|
8
7
|
setInternalLabels(labels?: CoralogixRumLabels): void;
|
|
9
|
-
getLabels():
|
|
10
|
-
getCustomLabels():
|
|
11
|
-
getInternalLabels():
|
|
8
|
+
getLabels(): CoralogixRumLabels;
|
|
9
|
+
getCustomLabels(): CoralogixRumLabels;
|
|
10
|
+
getInternalLabels(): CoralogixRumLabels;
|
|
12
11
|
getUserContext(): UserContextConfig | undefined;
|
|
13
12
|
forceFlush(): Promise<void>;
|
|
14
13
|
onStart(span: Span): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CoralogixAttributes } from './constants';
|
|
2
|
-
import { getUrlFragments } from './utils';
|
|
3
2
|
export class CoralogixSpanAttributesProcessor {
|
|
4
3
|
constructor(labels) {
|
|
5
4
|
this.labels = {
|
|
@@ -36,7 +35,6 @@ export class CoralogixSpanAttributesProcessor {
|
|
|
36
35
|
onStart(span) {
|
|
37
36
|
var _a, _b, _c, _d;
|
|
38
37
|
span.setAttribute(CoralogixAttributes.LOCATION_HREF, location.href);
|
|
39
|
-
span.setAttribute(CoralogixAttributes.LOCATION_FRAGMENTS, getUrlFragments(location.href));
|
|
40
38
|
span.setAttribute(CoralogixAttributes.USER_AGENT, navigator.userAgent);
|
|
41
39
|
span.setAttribute(CoralogixAttributes.COUNTRY, (_d = (_c = (_b = (_a = new Date().toString()) === null || _a === void 0 ? void 0 : _a.split('(')) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split(' ')) === null || _d === void 0 ? void 0 : _d[0]);
|
|
42
40
|
span.setAttributes(this.labels);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoralogixSpanAttributesProcessor.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixSpanAttributesProcessor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoralogixSpanAttributesProcessor.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixSpanAttributesProcessor.ts"],"names":[],"mappings":"AAEA,OAAO,E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AAI,CAAC,KAAK,CAAC,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,CAAC,IAAU;;QAChB,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,YAAY,CACf,mBAAmB,CAAC,OAAO,EAC3B,MAAA,MAAA,MAAA,MAAA,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE,0CAAE,KAAK,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,CACxD,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,KAAU,CAAC;IAEhB,QAAQ;QACN,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAEO,eAAe,CAAC,MAA0B;QAChD,MAAM,cAAc,GAA2B,EAAE,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;YACxB,cAAc,CAAC,GAAG,CAAC;gBACjB,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ;oBAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;oBACb,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;SACnC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF"}
|
package/src/constants.d.ts
CHANGED
|
@@ -7,12 +7,25 @@ import { CoralogixUserInteractionInstrumentation } from './instrumentations/Cora
|
|
|
7
7
|
import { CoralogixWebVitalsInstrumentation } from './instrumentations/CoralogixWebVitalsInstrumentation';
|
|
8
8
|
import { CoralogixLongTaskInstrumentation } from './instrumentations/CoralogixLongTaskInstrumentation';
|
|
9
9
|
import { CoralogixResourcesInstrumentation } from './instrumentations/CoralogixResourcesInstrumentation';
|
|
10
|
+
import { CoralogixInternalInstrumentation } from './instrumentations/CoralogixInternalInstrumentation';
|
|
10
11
|
export declare const miillisecondsInSecond = 1000;
|
|
11
12
|
export declare const CORALOGIX_LOGS_URL_SUFFIX = "/browser/v1beta/logs";
|
|
12
13
|
export declare const MAX_EXPORT_BATCH_SIZE = 50;
|
|
13
14
|
export declare const MAX_INTERACTION_ELEMENT_SIZE = 1024;
|
|
14
15
|
export declare const SCHEDULE_DELAY_MILLIS: number;
|
|
15
16
|
export declare const REQUIRED_CONFIG_KEYS: Array<keyof CoralogixBrowserSdkConfig>;
|
|
17
|
+
export declare const SDK_CONFIG_KEY = "sdkConfig";
|
|
18
|
+
export declare const MILLISECONDS_PER_HOUR: number;
|
|
19
|
+
export declare const SESSION_IDLE_TIME_IN_MINUTES = 15;
|
|
20
|
+
export declare const SESSION_EXPIRATION_IN_HOURS = 1;
|
|
21
|
+
export declare const SESSION_MANAGER_KEY = "rumSessionManager";
|
|
22
|
+
export declare const SESSION_RECORDER_KEY = "rumSessionRecorder";
|
|
23
|
+
export declare const ID_MASK_KEY = "{id}";
|
|
24
|
+
export declare const UUID_REGEX: RegExp;
|
|
25
|
+
export declare const NANOID_REGEX: RegExp;
|
|
26
|
+
export declare const PAGE_URL_LABEL_PROVIDERS_KEY = "PAGE_URL_LABEL_PROVIDERS";
|
|
27
|
+
export declare const NETWORK_URL_LABEL_PROVIDERS_KEY = "NETWORK_URL_LABEL_PROVIDERS";
|
|
28
|
+
export declare const RUM_INTERNAL_DATA_KEY = "rumInternalData";
|
|
16
29
|
export declare const OPTIONS_DEFAULTS: Partial<CoralogixBrowserSdkConfig>;
|
|
17
30
|
export declare const INSTRUMENTATIONS: readonly [{
|
|
18
31
|
readonly Instrument: typeof CoralogixErrorInstrumentation;
|
|
@@ -46,11 +59,14 @@ export declare const INSTRUMENTATIONS: readonly [{
|
|
|
46
59
|
readonly Instrument: typeof CoralogixResourcesInstrumentation;
|
|
47
60
|
readonly confKey: string;
|
|
48
61
|
readonly disable: false;
|
|
62
|
+
}, {
|
|
63
|
+
readonly Instrument: typeof CoralogixInternalInstrumentation;
|
|
64
|
+
readonly confKey: string;
|
|
65
|
+
readonly disable: false;
|
|
49
66
|
}];
|
|
50
67
|
export declare const CoralogixAttributes: {
|
|
51
68
|
USER_AGENT: string;
|
|
52
69
|
LOCATION_HREF: string;
|
|
53
|
-
LOCATION_FRAGMENTS: string;
|
|
54
70
|
EVENT_TYPE: string;
|
|
55
71
|
SEVERITY: string;
|
|
56
72
|
APPLICATION_CONTEXT: string;
|
|
@@ -74,6 +90,7 @@ export declare const CoralogixAttributes: {
|
|
|
74
90
|
TARGET_ELEMENT: string;
|
|
75
91
|
TARGET_ELEMENT_TYPE: string;
|
|
76
92
|
TIMESTAMP: string;
|
|
93
|
+
INTERNAL: string;
|
|
77
94
|
};
|
|
78
95
|
export declare const CoralogixDomainsApiUrlMap: {
|
|
79
96
|
EU1: string;
|
|
@@ -83,15 +100,3 @@ export declare const CoralogixDomainsApiUrlMap: {
|
|
|
83
100
|
AP1: string;
|
|
84
101
|
AP2: string;
|
|
85
102
|
};
|
|
86
|
-
export declare const SDK_CONFIG_KEY = "sdkConfig";
|
|
87
|
-
export declare const MILLISECONDS_PER_HOUR: number;
|
|
88
|
-
export declare const SESSION_IDLE_TIME_IN_MINUTES = 15;
|
|
89
|
-
export declare const SESSION_EXPIRATION_IN_HOURS = 1;
|
|
90
|
-
export declare const SESSION_MANAGER_KEY = "rumSessionManager";
|
|
91
|
-
export declare const SESSION_RECORDER_KEY = "rumSessionRecorder";
|
|
92
|
-
export declare const ID_MASK_KEY = "{id}";
|
|
93
|
-
export declare const UUID_REGEX: RegExp;
|
|
94
|
-
export declare const NANOID_REGEX: RegExp;
|
|
95
|
-
export declare const PAGE_URL_LABEL_PROVIDERS_KEY = "PAGE_URL_LABEL_PROVIDERS";
|
|
96
|
-
export declare const NETWORK_URL_LABEL_PROVIDERS_KEY = "NETWORK_URL_LABEL_PROVIDERS";
|
|
97
|
-
export declare const RUM_INTERNAL_DATA_KEY = "rumInternalData";
|
package/src/constants.js
CHANGED
|
@@ -4,9 +4,11 @@ import { CoralogixXhrInstrumentation } from './instrumentations/CoralogixXhrInst
|
|
|
4
4
|
import { CoralogixCustomLogInstrumentation } from './instrumentations/CoralogixCustomLogInstrumentation';
|
|
5
5
|
import { CoralogixUserInteractionInstrumentation } from './instrumentations/CoralogixUserInteractionInstrumentation';
|
|
6
6
|
import { CoralogixWebVitalsInstrumentation } from './instrumentations/CoralogixWebVitalsInstrumentation';
|
|
7
|
-
import { LONG_TASKS_INSTRUMENTATION_NAME, RESOURCES_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_NAME, } from './instrumentations/instrumentation.consts';
|
|
7
|
+
import { INTERNAL_INSTRUMENTATION_NAME, LONG_TASKS_INSTRUMENTATION_NAME, RESOURCES_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_NAME, } from './instrumentations/instrumentation.consts';
|
|
8
8
|
import { CoralogixLongTaskInstrumentation } from './instrumentations/CoralogixLongTaskInstrumentation';
|
|
9
9
|
import { CoralogixResourcesInstrumentation } from './instrumentations/CoralogixResourcesInstrumentation';
|
|
10
|
+
import { replacePatternsInUrl } from './utils';
|
|
11
|
+
import { CoralogixInternalInstrumentation } from './instrumentations/CoralogixInternalInstrumentation';
|
|
10
12
|
export const miillisecondsInSecond = 1000;
|
|
11
13
|
export const CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
|
|
12
14
|
export const MAX_EXPORT_BATCH_SIZE = 50;
|
|
@@ -18,6 +20,33 @@ export const REQUIRED_CONFIG_KEYS = [
|
|
|
18
20
|
'coralogixDomain',
|
|
19
21
|
'version',
|
|
20
22
|
];
|
|
23
|
+
export const SDK_CONFIG_KEY = 'sdkConfig';
|
|
24
|
+
export const MILLISECONDS_PER_HOUR = 60000 * 60;
|
|
25
|
+
export const SESSION_IDLE_TIME_IN_MINUTES = 15;
|
|
26
|
+
export const SESSION_EXPIRATION_IN_HOURS = 1;
|
|
27
|
+
export const SESSION_MANAGER_KEY = 'rumSessionManager';
|
|
28
|
+
export const SESSION_RECORDER_KEY = 'rumSessionRecorder';
|
|
29
|
+
export const ID_MASK_KEY = '{id}';
|
|
30
|
+
export const UUID_REGEX = /[0-9a-fA-F-]{36}/g;
|
|
31
|
+
export const NANOID_REGEX = /^[a-zA-Z0-9-_]{21}$/;
|
|
32
|
+
export const PAGE_URL_LABEL_PROVIDERS_KEY = 'PAGE_URL_LABEL_PROVIDERS';
|
|
33
|
+
export const NETWORK_URL_LABEL_PROVIDERS_KEY = 'NETWORK_URL_LABEL_PROVIDERS';
|
|
34
|
+
export const RUM_INTERNAL_DATA_KEY = 'rumInternalData';
|
|
35
|
+
const idPatterns = [
|
|
36
|
+
{
|
|
37
|
+
pattern: new RegExp(UUID_REGEX),
|
|
38
|
+
replacement: ID_MASK_KEY,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
pattern: new RegExp(NANOID_REGEX),
|
|
42
|
+
replacement: ID_MASK_KEY,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
const defaultUrlBlueprinters = {
|
|
46
|
+
pageUrlBlueprinters: [
|
|
47
|
+
(url) => replacePatternsInUrl({ patterns: idPatterns, url }),
|
|
48
|
+
],
|
|
49
|
+
};
|
|
21
50
|
export const OPTIONS_DEFAULTS = {
|
|
22
51
|
ignoreUrls: [new RegExp('.*' + CORALOGIX_LOGS_URL_SUFFIX + '.*')],
|
|
23
52
|
user_context: {
|
|
@@ -25,6 +54,7 @@ export const OPTIONS_DEFAULTS = {
|
|
|
25
54
|
user_name: '',
|
|
26
55
|
},
|
|
27
56
|
labels: {},
|
|
57
|
+
urlBlueprinters: defaultUrlBlueprinters,
|
|
28
58
|
};
|
|
29
59
|
export const INSTRUMENTATIONS = [
|
|
30
60
|
{
|
|
@@ -67,11 +97,15 @@ export const INSTRUMENTATIONS = [
|
|
|
67
97
|
confKey: RESOURCES_INSTRUMENTATION_NAME,
|
|
68
98
|
disable: false,
|
|
69
99
|
},
|
|
100
|
+
{
|
|
101
|
+
Instrument: CoralogixInternalInstrumentation,
|
|
102
|
+
confKey: INTERNAL_INSTRUMENTATION_NAME,
|
|
103
|
+
disable: false,
|
|
104
|
+
},
|
|
70
105
|
];
|
|
71
106
|
export const CoralogixAttributes = {
|
|
72
107
|
USER_AGENT: 'user_agent',
|
|
73
108
|
LOCATION_HREF: 'location_href',
|
|
74
|
-
LOCATION_FRAGMENTS: 'location_fragments',
|
|
75
109
|
EVENT_TYPE: 'event_type',
|
|
76
110
|
SEVERITY: 'severity',
|
|
77
111
|
APPLICATION_CONTEXT: 'application_context',
|
|
@@ -91,6 +125,7 @@ export const CoralogixAttributes = {
|
|
|
91
125
|
TARGET_ELEMENT: 'target_element',
|
|
92
126
|
TARGET_ELEMENT_TYPE: 'target_element_type',
|
|
93
127
|
TIMESTAMP: 'timestamp',
|
|
128
|
+
INTERNAL: 'internal'
|
|
94
129
|
};
|
|
95
130
|
export const CoralogixDomainsApiUrlMap = {
|
|
96
131
|
EU1: 'https://ingress.eu1.rum-ingress-coralogix.com',
|
|
@@ -100,16 +135,4 @@ export const CoralogixDomainsApiUrlMap = {
|
|
|
100
135
|
AP1: 'https://ingress.ap1.rum-ingress-coralogix.com',
|
|
101
136
|
AP2: 'https://ingress.ap2.rum-ingress-coralogix.com', // ap-southeast-1 (Singapore)
|
|
102
137
|
};
|
|
103
|
-
export const SDK_CONFIG_KEY = 'sdkConfig';
|
|
104
|
-
export const MILLISECONDS_PER_HOUR = 60000 * 60;
|
|
105
|
-
export const SESSION_IDLE_TIME_IN_MINUTES = 15;
|
|
106
|
-
export const SESSION_EXPIRATION_IN_HOURS = 1;
|
|
107
|
-
export const SESSION_MANAGER_KEY = 'rumSessionManager';
|
|
108
|
-
export const SESSION_RECORDER_KEY = 'rumSessionRecorder';
|
|
109
|
-
export const ID_MASK_KEY = '{id}';
|
|
110
|
-
export const UUID_REGEX = /[0-9a-fA-F-]{36}/g;
|
|
111
|
-
export const NANOID_REGEX = /^[a-zA-Z0-9-_]{21}$/;
|
|
112
|
-
export const PAGE_URL_LABEL_PROVIDERS_KEY = 'PAGE_URL_LABEL_PROVIDERS';
|
|
113
|
-
export const NETWORK_URL_LABEL_PROVIDERS_KEY = 'NETWORK_URL_LABEL_PROVIDERS';
|
|
114
|
-
export const RUM_INTERNAL_DATA_KEY = 'rumInternalData';
|
|
115
138
|
//# sourceMappingURL=constants.js.map
|
package/src/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../libs/browser/src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../libs/browser/src/constants.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,uCAAuC,EAAE,MAAM,4DAA4D,CAAC;AACrH,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EACL,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,o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AAgC;QAC5C,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,KAAK;KACf;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,eAAe;IACtB,GAAG,EAAE,QAAQ;IACb,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,aAAa;IAC1B,sBAAsB,EAAE,wBAAwB;IAChD,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,UAAU,EAAE,YAAY;IACxB,eAAe,EAAE,iBAAiB;IAClC,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,GAAG,EAAE,+CAA+C;IACpD,GAAG,EAAE,+CAA+C;IACpD,GAAG,EAAE,+CAA+C;IACpD,GAAG,EAAE,+CAA+C;IACpD,GAAG,EAAE,+CAA+C;IACpD,GAAG,EAAE,+CAA+C,EAAE,6BAA6B;CACpF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CoralogixEventType, } from '../types';
|
|
2
|
+
import { stringMatchesSomePattern } from '../utils';
|
|
3
|
+
import { ErrorSource } from '../instrumentations/CoralogixErrorInstrumentation';
|
|
4
|
+
export function shouldDropEvent(cxRumEvent, options) {
|
|
5
|
+
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
6
|
+
options.debug && console.warn('Document error without message dropped.');
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (isIgnoredError(cxRumEvent, options.ignoreErrors)) {
|
|
10
|
+
options.debug && console.warn('Ignored error dropped.');
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
function isDocumentErrorWithoutMessage(cxRumEvent) {
|
|
16
|
+
const { event_context, error_context } = cxRumEvent || {};
|
|
17
|
+
return (event_context.type === CoralogixEventType.ERROR &&
|
|
18
|
+
event_context.source === ErrorSource.DOCUMENT &&
|
|
19
|
+
!(error_context === null || error_context === void 0 ? void 0 : error_context.error_message));
|
|
20
|
+
}
|
|
21
|
+
function isIgnoredError(cxRumEvent, ignoreErrors) {
|
|
22
|
+
if (!cxRumEvent.error_context || !(ignoreErrors === null || ignoreErrors === void 0 ? void 0 : ignoreErrors.length)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const errorMessage = cxRumEvent.error_context.error_message || '';
|
|
26
|
+
return stringMatchesSomePattern(errorMessage, ignoreErrors);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../libs/browser/src/filters/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,GAEnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAEhF,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,OAAkC;IAElC,IAAI,6BAA6B,CAAC,UAAU,CAAC,EAAE;QAC7C,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;KACb;IAED,IAAI,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE;QACpD,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,6BAA6B,CAAC,UAAsB;IAC3D,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,UAAU,IAAI,EAAE,CAAC;IAC1D,OAAO,CACL,aAAa,CAAC,IAAI,KAAK,kBAAkB,CAAC,KAAK;QAC/C,aAAa,CAAC,MAAM,KAAK,WAAW,CAAC,QAAQ;QAC7C,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,aAAa,CAAA,CAC9B,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,UAAsB,EACtB,YAAuD;IAEvD,IAAI,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,CAAA,EAAE;QACtD,OAAO,KAAK,CAAC;KACd;IAED,MAAM,YAAY,GAAW,UAAU,CAAC,aAAa,CAAC,aAAa,IAAI,EAAE,CAAC;IAE1E,OAAO,wBAAwB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAC9D,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
2
|
-
import { getInstrumentationConfig, partition, resolveCoralogixOtelWebConfig, saveInternalRumData, } from './utils';
|
|
2
|
+
import { getInstrumentationConfig, partition, isSamplingOn, resolveCoralogixOtelWebConfig, saveInternalRumData, } from './utils';
|
|
3
3
|
import { CoralogixSpanAttributesProcessor } from './CoralogixSpanAttributesProcessor';
|
|
4
4
|
import { UrlType, } from './types';
|
|
5
5
|
import { CoralogixAttributes, INSTRUMENTATIONS, MAX_EXPORT_BATCH_SIZE, NETWORK_URL_LABEL_PROVIDERS_KEY, OPTIONS_DEFAULTS, PAGE_URL_LABEL_PROVIDERS_KEY, REQUIRED_CONFIG_KEYS, SCHEDULE_DELAY_MILLIS, SDK_CONFIG_KEY, } from './constants';
|
|
@@ -13,6 +13,8 @@ import { isNil } from 'lodash-es';
|
|
|
13
13
|
import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray';
|
|
14
14
|
import { SessionManager } from './session/sessionManager';
|
|
15
15
|
import { clearSessionManager, clearSessionRecorder, getSessionManager, getSessionRecorder, } from './helpers';
|
|
16
|
+
import { INTERNAL_INSTRUMENTATION_NAME } from './instrumentations/instrumentation.consts';
|
|
17
|
+
import { reportInternalEvent } from './internal-event-reporter';
|
|
16
18
|
let isInited = false;
|
|
17
19
|
let _deregisterInstrumentations;
|
|
18
20
|
let _customInstrumentation;
|
|
@@ -50,6 +52,12 @@ export const CoralogixRum = {
|
|
|
50
52
|
// Merge options & default options.
|
|
51
53
|
const resolvedOptions = resolveCoralogixOtelWebConfig(options);
|
|
52
54
|
window[SDK_CONFIG_KEY] = resolvedOptions;
|
|
55
|
+
if (!isSamplingOn(resolvedOptions.sessionSampleRate)) {
|
|
56
|
+
if (options.debug) {
|
|
57
|
+
console.debug('CoralogixRum: Session tracking is disabled');
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
53
61
|
// Check if not in debug mode & no auth token.
|
|
54
62
|
if (!resolvedOptions.debug && !resolvedOptions.public_key) {
|
|
55
63
|
console.warn('rumAuth will be required in the future');
|
|
@@ -74,6 +82,11 @@ export const CoralogixRum = {
|
|
|
74
82
|
traceParentInHeader }));
|
|
75
83
|
break;
|
|
76
84
|
}
|
|
85
|
+
case INTERNAL_INSTRUMENTATION_NAME: {
|
|
86
|
+
instrumentation = new Instrument(pluginConf);
|
|
87
|
+
saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
77
90
|
default:
|
|
78
91
|
instrumentation = new Instrument(pluginConf);
|
|
79
92
|
}
|
|
@@ -131,8 +144,9 @@ export const CoralogixRum = {
|
|
|
131
144
|
console.info('CoralogixRum.init() complete');
|
|
132
145
|
}
|
|
133
146
|
function createSessionManager() {
|
|
134
|
-
new SessionManager(
|
|
147
|
+
new SessionManager(resolvedOptions.sessionRecordingConfig).start();
|
|
135
148
|
}
|
|
149
|
+
reportInternalEvent('init');
|
|
136
150
|
},
|
|
137
151
|
shutdown() {
|
|
138
152
|
var _a;
|