@coralogix/browser 0.0.9
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 +104 -0
- package/package.json +32 -0
- package/src/CoralogixExporter.d.ts +15 -0
- package/src/CoralogixExporter.js +217 -0
- package/src/CoralogixExporter.js.map +1 -0
- package/src/CoralogixPropgator.d.ts +3 -0
- package/src/CoralogixPropgator.js +9 -0
- package/src/CoralogixPropgator.js.map +1 -0
- package/src/CoralogixSpanAttributesProcessor.d.ts +18 -0
- package/src/CoralogixSpanAttributesProcessor.js +64 -0
- package/src/CoralogixSpanAttributesProcessor.js.map +1 -0
- package/src/CoralogixWebTracerProvider.d.ts +3 -0
- package/src/CoralogixWebTracerProvider.js +11 -0
- package/src/CoralogixWebTracerProvider.js.map +1 -0
- package/src/constants.d.ts +93 -0
- package/src/constants.js +111 -0
- package/src/constants.js.map +1 -0
- package/src/helpers.d.ts +2 -0
- package/src/helpers.js +5 -0
- package/src/helpers.js.map +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +203 -0
- package/src/index.js.map +1 -0
- package/src/instrumentations/CoralogixCustomLogInstrumentation.d.ts +14 -0
- package/src/instrumentations/CoralogixCustomLogInstrumentation.js +41 -0
- package/src/instrumentations/CoralogixCustomLogInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +32 -0
- package/src/instrumentations/CoralogixErrorInstrumentation.js +226 -0
- package/src/instrumentations/CoralogixErrorInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixFetchInstrumentation.d.ts +8 -0
- package/src/instrumentations/CoralogixFetchInstrumentation.js +36 -0
- package/src/instrumentations/CoralogixFetchInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixLongTaskInstrumentation.d.ts +12 -0
- package/src/instrumentations/CoralogixLongTaskInstrumentation.js +71 -0
- package/src/instrumentations/CoralogixLongTaskInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixResourcesInstrumentation.d.ts +13 -0
- package/src/instrumentations/CoralogixResourcesInstrumentation.js +129 -0
- package/src/instrumentations/CoralogixResourcesInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixUserInteractionInstrumentation.d.ts +17 -0
- package/src/instrumentations/CoralogixUserInteractionInstrumentation.js +79 -0
- package/src/instrumentations/CoralogixUserInteractionInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixWebVitalsInstrumentation.d.ts +18 -0
- package/src/instrumentations/CoralogixWebVitalsInstrumentation.js +160 -0
- package/src/instrumentations/CoralogixWebVitalsInstrumentation.js.map +1 -0
- package/src/instrumentations/CoralogixXhrInstrumentation.d.ts +7 -0
- package/src/instrumentations/CoralogixXhrInstrumentation.js +33 -0
- package/src/instrumentations/CoralogixXhrInstrumentation.js.map +1 -0
- package/src/instrumentations/instrumentation.consts.d.ts +18 -0
- package/src/instrumentations/instrumentation.consts.js +57 -0
- package/src/instrumentations/instrumentation.consts.js.map +1 -0
- package/src/instrumentations/instrumentation.helper.d.ts +1 -0
- package/src/instrumentations/instrumentation.helper.js +4 -0
- package/src/instrumentations/instrumentation.helper.js.map +1 -0
- package/src/instrumentations/instrumentation.model.d.ts +30 -0
- package/src/instrumentations/instrumentation.model.js +18 -0
- package/src/instrumentations/instrumentation.model.js.map +1 -0
- package/src/sessionManager.d.ts +12 -0
- package/src/sessionManager.js +69 -0
- package/src/sessionManager.js.map +1 -0
- package/src/tools/addEventListener.d.ts +54 -0
- package/src/tools/addEventListener.js +35 -0
- package/src/tools/addEventListener.js.map +1 -0
- package/src/tools/getGlobalObject.d.ts +5 -0
- package/src/tools/getGlobalObject.js +36 -0
- package/src/tools/getGlobalObject.js.map +1 -0
- package/src/tools/getZoneJsOriginalDom.d.ts +9 -0
- package/src/tools/getZoneJsOriginalDom.js +17 -0
- package/src/tools/getZoneJsOriginalDom.js.map +1 -0
- package/src/types-external.d.ts +8 -0
- package/src/types-external.js +10 -0
- package/src/types-external.js.map +1 -0
- package/src/types.d.ts +270 -0
- package/src/types.js +27 -0
- package/src/types.js.map +1 -0
- package/src/utils.d.ts +24 -0
- package/src/utils.js +156 -0
- package/src/utils.js.map +1 -0
- package/src/version.d.ts +1 -0
- package/src/version.js +2 -0
- package/src/version.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Official Coralogix SDK for Browsers
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@coralogix/browser)
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- [Coralogix Real User Monitoring](https://coralogix.com/docs/real-user-monitoring/)
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
To use Coralogix SDK for Browsers, call `CoralogixRum.init(options)` at the soonest available moment after the page load.
|
|
12
|
+
This will initialize the SDK based on the options you provided.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { CoralogixRum } from '@coralogix/browser';
|
|
17
|
+
|
|
18
|
+
CoralogixRum.init({
|
|
19
|
+
application: 'app-name',
|
|
20
|
+
environment: 'production',
|
|
21
|
+
public_key: 'abc-123-456',
|
|
22
|
+
coralogixDomain: 'EU2',
|
|
23
|
+
version: 'v1.0.3',
|
|
24
|
+
labels: {
|
|
25
|
+
payment: 'visa',
|
|
26
|
+
},
|
|
27
|
+
ignoreErrors: ['some error message to ignore'],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
More properties: `instrumentations`, `traceParentInHeader`, `ignoreUrls`, `debug`
|
|
31
|
+
|
|
32
|
+
To provide contextual information or transmit manual logs, utilize the exported functions of `CoralogixRum`.
|
|
33
|
+
Keep in mind that these functions will remain inactive until you've invoked `CoralogixRum.init()`.
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { CoralogixRum } from '@coralogix/browser';
|
|
37
|
+
|
|
38
|
+
// Update user context dynamically
|
|
39
|
+
CoralogixRum.setUserContext({
|
|
40
|
+
user_id: '123',
|
|
41
|
+
user_name: 'name',
|
|
42
|
+
user_email: 'user@email.com',
|
|
43
|
+
user_metadata: {
|
|
44
|
+
role: 'admin',
|
|
45
|
+
// ...
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
// Update custom labels dynamically
|
|
50
|
+
CoralogixRum.setLabels({
|
|
51
|
+
paymentMethod: 'visa',
|
|
52
|
+
userTheme: 'black'
|
|
53
|
+
// ...
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// Update application context dynamically
|
|
57
|
+
CoralogixRum.setApplicationContext({
|
|
58
|
+
application: 'app-name',
|
|
59
|
+
version: '1.0.0'
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
CoralogixRum.log(CoralogixLogSeverity.Error, 'this is a log', { key: 'value' })
|
|
63
|
+
CoralogixRum.error('this is a log with error severity', { key: 'value' })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## CDN
|
|
67
|
+
|
|
68
|
+
Coralogix Browser SDK is also provided via CDN.
|
|
69
|
+
You can choose a specific version or use the latest one.
|
|
70
|
+
|
|
71
|
+
#### Latest Version (recommended)
|
|
72
|
+
https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/coralogix-browser-sdk.js
|
|
73
|
+
|
|
74
|
+
#### Specific Version
|
|
75
|
+
https://cdn.rum-ingress-coralogix.com/coralogix/browser/[version]/coralogix-browser-sdk.js \
|
|
76
|
+
Replace [version] with a version from [Releases page](https://www.npmjs.com/package/@coralogix/browser?activeTab=versions).
|
|
77
|
+
|
|
78
|
+
### Add the CDN script to your application
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
<head>
|
|
82
|
+
...
|
|
83
|
+
<script src="https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/coralogix-browser-sdk.js"></script>
|
|
84
|
+
</head>
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Initialization
|
|
89
|
+
#### Via JS file
|
|
90
|
+
```javascript
|
|
91
|
+
window.CoralogixRum.init(...);
|
|
92
|
+
```
|
|
93
|
+
#### Via TS file
|
|
94
|
+
```javascript
|
|
95
|
+
window.CoralogixRum.init(...);
|
|
96
|
+
|
|
97
|
+
// In case of warning from TSC
|
|
98
|
+
declare global {
|
|
99
|
+
interface Window {
|
|
100
|
+
CoralogixRum:any;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@coralogix/browser",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Official Coralogix SDK for browsers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@opentelemetry/api": "1.7.0",
|
|
8
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.48.0",
|
|
9
|
+
"@opentelemetry/instrumentation": "0.48.0",
|
|
10
|
+
"@opentelemetry/instrumentation-fetch": "0.48.0",
|
|
11
|
+
"@opentelemetry/instrumentation-xml-http-request": "0.48.0",
|
|
12
|
+
"@opentelemetry/sdk-trace-base": "1.21.0",
|
|
13
|
+
"@opentelemetry/sdk-trace-web": "1.21.0",
|
|
14
|
+
"@opentelemetry/propagator-aws-xray": "1.3.1",
|
|
15
|
+
"error-stack-parser": "2.1.4",
|
|
16
|
+
"idle-js": "1.2.0",
|
|
17
|
+
"lodash-es": "4.17.21",
|
|
18
|
+
"tslib": "2.6.1",
|
|
19
|
+
"ts-node": "10.9.1",
|
|
20
|
+
"uuid": "9.0.0",
|
|
21
|
+
"web-vitals": "3.5.2"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/lodash-es": "4.17.8",
|
|
25
|
+
"@types/idle-js": "1.2.1"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"typescript": ">=4.4.2"
|
|
29
|
+
},
|
|
30
|
+
"main": "./src/index.js",
|
|
31
|
+
"types": "./src/index.d.ts"
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { CoralogixBrowserSdkConfig } from './types';
|
|
3
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
4
|
+
type CoralogixExporterConfig = Pick<CoralogixBrowserSdkConfig, 'public_key' | 'coralogixDomain'>;
|
|
5
|
+
export declare class CoralogixExporter implements SpanExporter {
|
|
6
|
+
private isActive;
|
|
7
|
+
private public_key;
|
|
8
|
+
private coralogixDomain;
|
|
9
|
+
constructor({ public_key, coralogixDomain }: CoralogixExporterConfig);
|
|
10
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
11
|
+
shutdown(): Promise<void>;
|
|
12
|
+
private _mapToCxSpan;
|
|
13
|
+
private _getEventTypeContext;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { CoralogixEventType, OtelNetworkAttrs, } from './types';
|
|
3
|
+
import { CORALOGIX_LOGS_URL_SUFFIX, CoralogixAttributes, CoralogixDomainsApiUrlMap, SESSION_MANAGER_KEY, } from './constants';
|
|
4
|
+
import { CoralogixLogSeverity } from './types-external';
|
|
5
|
+
import ErrorStackParser from 'error-stack-parser';
|
|
6
|
+
import { getUrlFragments, hrTimeToMilliseconds, parseUserAgent, flattenAttributes, } from './utils';
|
|
7
|
+
import { SDK_VERSION } from './version';
|
|
8
|
+
import { ExportResultCode } from '@opentelemetry/core';
|
|
9
|
+
import { LONG_TASK_PERFORMANCE_TYPE, RESOURCES_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_NAME, } from './instrumentations/instrumentation.consts';
|
|
10
|
+
import { ErrorSource } from './instrumentations/CoralogixErrorInstrumentation';
|
|
11
|
+
var CoralogixExporter = /** @class */ (function () {
|
|
12
|
+
function CoralogixExporter(_a) {
|
|
13
|
+
var public_key = _a.public_key, coralogixDomain = _a.coralogixDomain;
|
|
14
|
+
this.isActive = true;
|
|
15
|
+
this.public_key = '';
|
|
16
|
+
this.coralogixDomain = 'EU2';
|
|
17
|
+
this.public_key = public_key;
|
|
18
|
+
this.coralogixDomain = coralogixDomain;
|
|
19
|
+
}
|
|
20
|
+
CoralogixExporter.prototype.export = function (spans, resultCallback) {
|
|
21
|
+
var _this = this;
|
|
22
|
+
if (!this.isActive) {
|
|
23
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var sessionManger = window[SESSION_MANAGER_KEY];
|
|
27
|
+
var session = sessionManger.getSession() || sessionManger.setSession();
|
|
28
|
+
var cxSpans = spans
|
|
29
|
+
.map(function (s) { return _this._mapToCxSpan(s, session); })
|
|
30
|
+
.filter(function (cxSpan) {
|
|
31
|
+
var _a = cxSpan.text.cx_rum || {}, event_context = _a.event_context, error_context = _a.error_context;
|
|
32
|
+
var isDocumentErrorWithoutMessage = event_context.type === CoralogixEventType.ERROR &&
|
|
33
|
+
event_context.source === ErrorSource.DOCUMENT &&
|
|
34
|
+
!(error_context === null || error_context === void 0 ? void 0 : error_context.error_message);
|
|
35
|
+
return !isDocumentErrorWithoutMessage;
|
|
36
|
+
});
|
|
37
|
+
var url = "".concat(CoralogixDomainsApiUrlMap[this.coralogixDomain]).concat(CORALOGIX_LOGS_URL_SUFFIX);
|
|
38
|
+
fetch(url, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
Authorization: "Bearer ".concat(this.public_key),
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({ logs: cxSpans }),
|
|
45
|
+
}).catch(function (e) {
|
|
46
|
+
return e;
|
|
47
|
+
});
|
|
48
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
49
|
+
};
|
|
50
|
+
CoralogixExporter.prototype.shutdown = function () {
|
|
51
|
+
this.isActive = false;
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
};
|
|
54
|
+
CoralogixExporter.prototype._mapToCxSpan = function (span, session) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
var _c = session || {}, sessionId = _c.sessionId, sessionCreationDate = _c.sessionCreationDate;
|
|
57
|
+
var attributes = span.attributes, startTime = span.startTime, parentSpanId = span.parentSpanId, name = span.name, endTime = span.endTime, status = span.status, duration = span.duration, kind = span.kind;
|
|
58
|
+
var user_context = JSON.parse(attributes[CoralogixAttributes.USER_CONTEXT]);
|
|
59
|
+
var application_context = JSON.parse(attributes[CoralogixAttributes.APPLICATION_CONTEXT]);
|
|
60
|
+
var user_id = user_context.user_id, user_name = user_context.user_name, user_metadata = user_context.user_metadata, user_email = user_context.user_email;
|
|
61
|
+
var application = application_context.application, version = application_context.version;
|
|
62
|
+
var eventType = attributes[CoralogixAttributes.EVENT_TYPE];
|
|
63
|
+
var eventTypeContext = this._getEventTypeContext(attributes, eventType, span);
|
|
64
|
+
var _d = span.spanContext(), spanId = _d.spanId, traceId = _d.traceId;
|
|
65
|
+
var resourceAttributes = __assign(__assign({}, (_a = span.resource) === null || _a === void 0 ? void 0 : _a.attributes), { 'service.name': application });
|
|
66
|
+
var labels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
|
|
67
|
+
var isErrorWithStacktrace = !!((_b = eventTypeContext === null || eventTypeContext === void 0 ? void 0 : eventTypeContext.error_context) === null || _b === void 0 ? void 0 : _b.original_stacktrace);
|
|
68
|
+
var version_metadata = {
|
|
69
|
+
app_name: application,
|
|
70
|
+
app_version: version,
|
|
71
|
+
};
|
|
72
|
+
var severity = (attributes === null || attributes === void 0 ? void 0 : attributes[CoralogixAttributes.SEVERITY]) ||
|
|
73
|
+
CoralogixLogSeverity.Info;
|
|
74
|
+
var timestamp = attributes[CoralogixAttributes.TIMESTAMP] || Date.now();
|
|
75
|
+
if (timestamp < sessionCreationDate) {
|
|
76
|
+
timestamp = Date.now();
|
|
77
|
+
}
|
|
78
|
+
var cxSpan = {
|
|
79
|
+
version_metadata: version_metadata,
|
|
80
|
+
applicationName: application,
|
|
81
|
+
subsystemName: 'cx_rum',
|
|
82
|
+
isErrorWithStacktrace: isErrorWithStacktrace,
|
|
83
|
+
severity: severity,
|
|
84
|
+
timestamp: timestamp,
|
|
85
|
+
text: {
|
|
86
|
+
cx_rum: __assign(__assign({ timestamp: timestamp }, eventTypeContext), { browser_sdk: {
|
|
87
|
+
version: SDK_VERSION,
|
|
88
|
+
}, version_metadata: version_metadata, session_context: __assign(__assign({ session_id: sessionId, session_creation_date: sessionCreationDate, user_agent: attributes[CoralogixAttributes.USER_AGENT] }, parseUserAgent(attributes[CoralogixAttributes.USER_AGENT])), { user_id: user_id, user_name: user_name, user_email: user_email, user_metadata: user_metadata }), page_context: {
|
|
89
|
+
page_url: attributes[CoralogixAttributes.LOCATION_HREF],
|
|
90
|
+
page_fragments: attributes[CoralogixAttributes.LOCATION_FRAGMENTS],
|
|
91
|
+
}, event_context: {
|
|
92
|
+
type: attributes[CoralogixAttributes.EVENT_TYPE],
|
|
93
|
+
source: attributes[CoralogixAttributes.SOURCE],
|
|
94
|
+
severity: severity,
|
|
95
|
+
}, labels: labels, spanId: spanId, traceId: traceId, environment: attributes[CoralogixAttributes.ENVIRONMENT] || '' }),
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
if (eventType === CoralogixEventType.NETWORK_REQUEST) {
|
|
99
|
+
cxSpan.instrumentation_data = {
|
|
100
|
+
otelSpan: {
|
|
101
|
+
spanId: spanId,
|
|
102
|
+
traceId: traceId,
|
|
103
|
+
parentSpanId: parentSpanId,
|
|
104
|
+
name: name,
|
|
105
|
+
attributes: flattenAttributes(attributes),
|
|
106
|
+
startTime: startTime,
|
|
107
|
+
endTime: endTime,
|
|
108
|
+
status: status,
|
|
109
|
+
kind: kind,
|
|
110
|
+
duration: duration,
|
|
111
|
+
},
|
|
112
|
+
otelResource: {
|
|
113
|
+
attributes: resourceAttributes,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return cxSpan;
|
|
118
|
+
};
|
|
119
|
+
CoralogixExporter.prototype._getEventTypeContext = function (spanAttributes, eventType, span) {
|
|
120
|
+
var _a;
|
|
121
|
+
switch (eventType) {
|
|
122
|
+
case CoralogixEventType.ERROR: {
|
|
123
|
+
var errorMessage = spanAttributes[CoralogixAttributes.ERROR.MESSAGE];
|
|
124
|
+
var stack = spanAttributes[CoralogixAttributes.ERROR.STACK];
|
|
125
|
+
var originalStackTrace = undefined;
|
|
126
|
+
if (stack) {
|
|
127
|
+
originalStackTrace = (_a = ErrorStackParser.parse({
|
|
128
|
+
stack: spanAttributes[CoralogixAttributes.ERROR.STACK],
|
|
129
|
+
message: errorMessage,
|
|
130
|
+
name: '',
|
|
131
|
+
})) === null || _a === void 0 ? void 0 : _a.map(function (_a) {
|
|
132
|
+
var fileName = _a.fileName, columnNumber = _a.columnNumber, lineNumber = _a.lineNumber, functionName = _a.functionName;
|
|
133
|
+
return ({
|
|
134
|
+
fileName: fileName,
|
|
135
|
+
columnNumber: columnNumber,
|
|
136
|
+
lineNumber: lineNumber,
|
|
137
|
+
functionName: functionName,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
error_context: {
|
|
143
|
+
error_type: spanAttributes[CoralogixAttributes.ERROR.TYPE],
|
|
144
|
+
error_message: errorMessage,
|
|
145
|
+
original_stacktrace: originalStackTrace,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
case CoralogixEventType.NETWORK_REQUEST: {
|
|
150
|
+
return {
|
|
151
|
+
network_request_context: {
|
|
152
|
+
method: spanAttributes[OtelNetworkAttrs.METHOD],
|
|
153
|
+
status_code: spanAttributes[OtelNetworkAttrs.STATUS_CODE],
|
|
154
|
+
url: spanAttributes[OtelNetworkAttrs.URL],
|
|
155
|
+
fragments: getUrlFragments(spanAttributes[OtelNetworkAttrs.URL]),
|
|
156
|
+
host: spanAttributes[OtelNetworkAttrs.HOST],
|
|
157
|
+
schema: spanAttributes[OtelNetworkAttrs.SCHEME],
|
|
158
|
+
status_text: spanAttributes[OtelNetworkAttrs.STATUS_TEXT],
|
|
159
|
+
duration: hrTimeToMilliseconds(span === null || span === void 0 ? void 0 : span.duration),
|
|
160
|
+
response_content_length: spanAttributes[OtelNetworkAttrs.RESPONSE_CONTENT_LENGTH],
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
case CoralogixEventType.LOG: {
|
|
165
|
+
if (spanAttributes[CoralogixAttributes.LOG]) {
|
|
166
|
+
var cxLog = JSON.parse(spanAttributes[CoralogixAttributes.LOG]);
|
|
167
|
+
return {
|
|
168
|
+
log_context: {
|
|
169
|
+
message: cxLog.message,
|
|
170
|
+
data: cxLog === null || cxLog === void 0 ? void 0 : cxLog.data,
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
log_context: {
|
|
176
|
+
message: '',
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
case CoralogixEventType.USER_INTERACTION: {
|
|
181
|
+
return {
|
|
182
|
+
interaction_context: {
|
|
183
|
+
target_element: spanAttributes[CoralogixAttributes.TARGET_ELEMENT],
|
|
184
|
+
event_name: spanAttributes[CoralogixAttributes.INTERACTION_EVENT_NAME],
|
|
185
|
+
target_element_inner_text: spanAttributes[CoralogixAttributes.ELEMENT_INNER_TEXT],
|
|
186
|
+
target_element_inner_html: spanAttributes[CoralogixAttributes.ELEMENT_INNER_HTML],
|
|
187
|
+
element_id: spanAttributes[CoralogixAttributes.ELEMENT_ID],
|
|
188
|
+
element_classes: spanAttributes[CoralogixAttributes.ELEMENT_CLASSES],
|
|
189
|
+
target_element_type: spanAttributes[CoralogixAttributes.TARGET_ELEMENT_TYPE],
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
case CoralogixEventType.WEB_VITALS: {
|
|
194
|
+
var webVitalsContext = JSON.parse(spanAttributes[WEB_VITALS_INSTRUMENTATION_NAME]);
|
|
195
|
+
return {
|
|
196
|
+
web_vitals_context: webVitalsContext,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
case CoralogixEventType.LONG_TASK: {
|
|
200
|
+
var longTaskContext = JSON.parse(spanAttributes[LONG_TASK_PERFORMANCE_TYPE]);
|
|
201
|
+
return {
|
|
202
|
+
longtask_context: longTaskContext,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
case CoralogixEventType.RESOURCES: {
|
|
206
|
+
var resourceContext = JSON.parse(spanAttributes[RESOURCES_INSTRUMENTATION_NAME]);
|
|
207
|
+
return {
|
|
208
|
+
resource_context: resourceContext,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return {};
|
|
213
|
+
};
|
|
214
|
+
return CoralogixExporter;
|
|
215
|
+
}());
|
|
216
|
+
export { CoralogixExporter };
|
|
217
|
+
//# sourceMappingURL=CoralogixExporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoralogixExporter.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixExporter.ts"],"names":[],"mappings":";AACA,OAAO,EAIL,kBAAkB,EAMlB,gBAAgB,GAKjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,gBAAgC,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO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c,CACxB,mBAAmB,CAAC,sBAAsB,CACjC;wBACX,yBAAyB,EAAE,cAAc,CACvC,mBAAmB,CAAC,kBAAkB,CAC7B;wBACX,yBAAyB,EAAE,cAAc,CACvC,mBAAmB,CAAC,kBAAkB,CAC7B;wBACX,UAAU,EAAE,cAAc,CACxB,mBAAmB,CAAC,UAAU,CACrB;wBACX,eAAe,EAAE,cAAc,CAC7B,mBAAmB,CAAC,eAAe,CAC1B;wBACX,mBAAmB,EAAE,cAAc,CACjC,mBAAmB,CAAC,mBAAmB,CAC9B;qBACZ;iBACF,CAAC;aACH;YACD,KAAK,kBAAkB,CAAC,UAAU,CAAC,CAAC;gBAClC,IAAM,gBAAgB,GAAqB,IAAI,CAAC,KAAK,CACnD,cAAc,CAAC,+BAA+B,CAAW,CAC1D,CAAC;gBAEF,OAAO;oBACL,kBAAkB,EAAE,gBAAgB;iBACrC,CAAC;aACH;YAED,KAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC;gBACjC,IAAM,eAAe,GAAoB,IAAI,CAAC,KAAK,CACjD,cAAc,CAAC,0BAA0B,CAAW,CACrD,CAAC;gBAEF,OAAO;oBACL,gBAAgB,EAAE,eAAe;iBAClC,CAAC;aACH;YAED,KAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC;gBACjC,IAAM,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;IACH,wBAAC;AAAD,CAAC,AAvUD,IAuUC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FetchInstrumentationConfig } from '@opentelemetry/instrumentation-fetch';
|
|
2
|
+
import { XMLHttpRequestInstrumentationConfig } from '@opentelemetry/instrumentation-xml-http-request';
|
|
3
|
+
export declare const propagateTraceHeaderCorsUrls: (config: FetchInstrumentationConfig | XMLHttpRequestInstrumentationConfig) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var propagateTraceHeaderCorsUrls = function (config) {
|
|
2
|
+
var _a;
|
|
3
|
+
var traceParentInHeader = config.traceParentInHeader;
|
|
4
|
+
var propagateCorsUrls = (_a = traceParentInHeader === null || traceParentInHeader === void 0 ? void 0 : traceParentInHeader.options) === null || _a === void 0 ? void 0 : _a.propagateTraceHeaderCorsUrls;
|
|
5
|
+
if ((traceParentInHeader === null || traceParentInHeader === void 0 ? void 0 : traceParentInHeader.enabled) && propagateCorsUrls) {
|
|
6
|
+
config.propagateTraceHeaderCorsUrls = propagateCorsUrls;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=CoralogixPropgator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoralogixPropgator.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixPropgator.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,IAAM,4BAA4B,GAAG,UAC1C,MAAwE;;IAEhE,IAAA,mBAAmB,GAAK,MAAmC,oBAAxC,CAAyC;IAEpE,IAAM,iBAAiB,GACrB,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,OAAO,0CAAE,4BAA4B,CAAC;IAE7D,IAAI,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,OAAO,KAAI,iBAAiB,EAAE;QACrD,MAAM,CAAC,4BAA4B,GAAG,iBAAiB,CAAC;KACzD;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Attributes } from '@opentelemetry/api';
|
|
2
|
+
import { Span, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { CoralogixRumLabels, UserContextConfig } from './types';
|
|
4
|
+
export declare class CoralogixSpanAttributesProcessor implements SpanProcessor {
|
|
5
|
+
private labels;
|
|
6
|
+
constructor(labels?: Attributes);
|
|
7
|
+
setCustomLabels(labels?: CoralogixRumLabels): void;
|
|
8
|
+
setInternalLabels(labels?: CoralogixRumLabels): void;
|
|
9
|
+
getLabels(): any;
|
|
10
|
+
getCustomLabels(): Attributes;
|
|
11
|
+
getInternalLabels(): Attributes;
|
|
12
|
+
getUserContext(): UserContextConfig | undefined;
|
|
13
|
+
forceFlush(): Promise<void>;
|
|
14
|
+
onStart(span: Span): void;
|
|
15
|
+
onEnd(): void;
|
|
16
|
+
shutdown(): Promise<void>;
|
|
17
|
+
private stringifyValues;
|
|
18
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { CoralogixAttributes } from './constants';
|
|
3
|
+
import { getUrlFragments } from './utils';
|
|
4
|
+
var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
5
|
+
function CoralogixSpanAttributesProcessor(labels) {
|
|
6
|
+
var _a;
|
|
7
|
+
this.labels = (_a = {},
|
|
8
|
+
_a[CoralogixAttributes.CUSTOM_LABELS] = '{}',
|
|
9
|
+
_a);
|
|
10
|
+
if (labels) {
|
|
11
|
+
this.labels = labels;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
CoralogixSpanAttributesProcessor.prototype.setCustomLabels = function (labels) {
|
|
15
|
+
this.labels[CoralogixAttributes.CUSTOM_LABELS] = JSON.stringify(labels !== null && labels !== void 0 ? labels : {});
|
|
16
|
+
};
|
|
17
|
+
CoralogixSpanAttributesProcessor.prototype.setInternalLabels = function (labels) {
|
|
18
|
+
var _a;
|
|
19
|
+
this.labels = __assign((_a = {}, _a[CoralogixAttributes.CUSTOM_LABELS] = this.labels[CoralogixAttributes.CUSTOM_LABELS], _a), (labels ? this.stringifyValues(labels) : {}));
|
|
20
|
+
};
|
|
21
|
+
CoralogixSpanAttributesProcessor.prototype.getLabels = function () {
|
|
22
|
+
return JSON.parse(JSON.stringify(this.labels));
|
|
23
|
+
};
|
|
24
|
+
CoralogixSpanAttributesProcessor.prototype.getCustomLabels = function () {
|
|
25
|
+
return JSON.parse(this.labels[CoralogixAttributes.CUSTOM_LABELS]);
|
|
26
|
+
};
|
|
27
|
+
CoralogixSpanAttributesProcessor.prototype.getInternalLabels = function () {
|
|
28
|
+
var labels = __assign({}, this.labels);
|
|
29
|
+
delete labels[CoralogixAttributes.CUSTOM_LABELS];
|
|
30
|
+
return labels;
|
|
31
|
+
};
|
|
32
|
+
CoralogixSpanAttributesProcessor.prototype.getUserContext = function () {
|
|
33
|
+
var userContext = this.labels[CoralogixAttributes.USER_CONTEXT];
|
|
34
|
+
return userContext ? JSON.parse("".concat(userContext)) : undefined;
|
|
35
|
+
};
|
|
36
|
+
CoralogixSpanAttributesProcessor.prototype.forceFlush = function () {
|
|
37
|
+
return Promise.resolve();
|
|
38
|
+
};
|
|
39
|
+
CoralogixSpanAttributesProcessor.prototype.onStart = function (span) {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
span.setAttribute(CoralogixAttributes.LOCATION_HREF, location.href);
|
|
42
|
+
span.setAttribute(CoralogixAttributes.LOCATION_FRAGMENTS, getUrlFragments(location.href));
|
|
43
|
+
span.setAttribute(CoralogixAttributes.USER_AGENT, navigator.userAgent);
|
|
44
|
+
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]);
|
|
45
|
+
span.setAttributes(this.labels);
|
|
46
|
+
};
|
|
47
|
+
CoralogixSpanAttributesProcessor.prototype.onEnd = function () { };
|
|
48
|
+
CoralogixSpanAttributesProcessor.prototype.shutdown = function () {
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
};
|
|
51
|
+
CoralogixSpanAttributesProcessor.prototype.stringifyValues = function (labels) {
|
|
52
|
+
var resolvedLabels = {};
|
|
53
|
+
for (var key in labels) {
|
|
54
|
+
resolvedLabels[key] =
|
|
55
|
+
typeof labels[key] === 'string'
|
|
56
|
+
? labels[key]
|
|
57
|
+
: JSON.stringify(labels[key]);
|
|
58
|
+
}
|
|
59
|
+
return resolvedLabels;
|
|
60
|
+
};
|
|
61
|
+
return CoralogixSpanAttributesProcessor;
|
|
62
|
+
}());
|
|
63
|
+
export { CoralogixSpanAttributesProcessor };
|
|
64
|
+
//# sourceMappingURL=CoralogixSpanAttributesProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoralogixSpanAttributesProcessor.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixSpanAttributesProcessor.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;IAKE,0CAAY,MAAmB;;QAJvB,WAAM;YACZ,GAAC,mBAAmB,CAAC,aAAa,IAAG,IAAI;gBACzC;QAGA,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;IACH,CAAC;IAED,0DAAe,GAAf,UAAgB,MAA2B;QACzC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,SAAS,CAC7D,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CACb,CAAC;IACJ,CAAC;IAED,4DAAiB,GAAjB,UAAkB,MAA2B;;QAC3C,IAAI,CAAC,MAAM,yBACR,mBAAmB,CAAC,aAAa,IAChC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,CAAC,OAC7C,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAChD,CAAC;IACJ,CAAC;IAED,oDAAS,GAAT;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAA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AC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,gDAAK,GAAL,cAAe,CAAC;IAEhB,mDAAQ,GAAR;QACE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAEO,0DAAe,GAAvB,UAAwB,MAA0B;QAChD,IAAM,cAAc,GAA2B,EAAE,CAAC;QAClD,KAAK,IAAM,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;IACH,uCAAC;AAAD,CAAC,AAjFD,IAiFC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
|
3
|
+
var CoralogixWebTracerProvider = /** @class */ (function (_super) {
|
|
4
|
+
__extends(CoralogixWebTracerProvider, _super);
|
|
5
|
+
function CoralogixWebTracerProvider() {
|
|
6
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7
|
+
}
|
|
8
|
+
return CoralogixWebTracerProvider;
|
|
9
|
+
}(WebTracerProvider));
|
|
10
|
+
export { CoralogixWebTracerProvider };
|
|
11
|
+
//# sourceMappingURL=CoralogixWebTracerProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoralogixWebTracerProvider.js","sourceRoot":"","sources":["../../../../libs/browser/src/CoralogixWebTracerProvider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE;IAAgD,8CAAiB;IAAjE;;IAAmE,CAAC;IAAD,iCAAC;AAAD,CAAC,AAApE,CAAgD,iBAAiB,GAAG"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CoralogixBrowserSdkConfig } from './types';
|
|
2
|
+
import { CoralogixErrorInstrumentation } from './instrumentations/CoralogixErrorInstrumentation';
|
|
3
|
+
import { CoralogixFetchInstrumentation } from './instrumentations/CoralogixFetchInstrumentation';
|
|
4
|
+
import { CoralogixXhrInstrumentation } from './instrumentations/CoralogixXhrInstrumentation';
|
|
5
|
+
import { CoralogixCustomLogInstrumentation } from './instrumentations/CoralogixCustomLogInstrumentation';
|
|
6
|
+
import { CoralogixUserInteractionInstrumentation } from './instrumentations/CoralogixUserInteractionInstrumentation';
|
|
7
|
+
import { CoralogixWebVitalsInstrumentation } from './instrumentations/CoralogixWebVitalsInstrumentation';
|
|
8
|
+
import { CoralogixLongTaskInstrumentation } from './instrumentations/CoralogixLongTaskInstrumentation';
|
|
9
|
+
import { CoralogixResourcesInstrumentation } from './instrumentations/CoralogixResourcesInstrumentation';
|
|
10
|
+
export declare const miillisecondsInSecond = 1000;
|
|
11
|
+
export declare const CORALOGIX_LOGS_URL_SUFFIX = "/browser/v1beta/logs";
|
|
12
|
+
export declare const MAX_EXPORT_BATCH_SIZE = 50;
|
|
13
|
+
export declare const MAX_INTERACTION_ELEMENT_SIZE = 1024;
|
|
14
|
+
export declare const SCHEDULE_DELAY_MILLIS: number;
|
|
15
|
+
export declare const REQUIRED_CONFIG_KEYS: Array<keyof CoralogixBrowserSdkConfig>;
|
|
16
|
+
export declare const OPTIONS_DEFAULTS: Partial<CoralogixBrowserSdkConfig>;
|
|
17
|
+
export declare const INSTRUMENTATIONS: readonly [{
|
|
18
|
+
readonly Instrument: typeof CoralogixErrorInstrumentation;
|
|
19
|
+
readonly confKey: "errors";
|
|
20
|
+
readonly disable: false;
|
|
21
|
+
}, {
|
|
22
|
+
readonly Instrument: typeof CoralogixFetchInstrumentation;
|
|
23
|
+
readonly confKey: "fetch";
|
|
24
|
+
readonly disable: false;
|
|
25
|
+
}, {
|
|
26
|
+
readonly Instrument: typeof CoralogixXhrInstrumentation;
|
|
27
|
+
readonly confKey: "xhr";
|
|
28
|
+
readonly disable: false;
|
|
29
|
+
}, {
|
|
30
|
+
readonly Instrument: typeof CoralogixCustomLogInstrumentation;
|
|
31
|
+
readonly confKey: "custom";
|
|
32
|
+
readonly disable: false;
|
|
33
|
+
}, {
|
|
34
|
+
readonly Instrument: typeof CoralogixUserInteractionInstrumentation;
|
|
35
|
+
readonly confKey: "interactions";
|
|
36
|
+
readonly disable: false;
|
|
37
|
+
}, {
|
|
38
|
+
readonly Instrument: typeof CoralogixWebVitalsInstrumentation;
|
|
39
|
+
readonly confKey: string;
|
|
40
|
+
readonly disable: false;
|
|
41
|
+
}, {
|
|
42
|
+
readonly Instrument: typeof CoralogixLongTaskInstrumentation;
|
|
43
|
+
readonly confKey: string;
|
|
44
|
+
readonly disable: false;
|
|
45
|
+
}, {
|
|
46
|
+
readonly Instrument: typeof CoralogixResourcesInstrumentation;
|
|
47
|
+
readonly confKey: string;
|
|
48
|
+
readonly disable: false;
|
|
49
|
+
}];
|
|
50
|
+
export declare const CoralogixAttributes: {
|
|
51
|
+
USER_AGENT: string;
|
|
52
|
+
LOCATION_HREF: string;
|
|
53
|
+
LOCATION_FRAGMENTS: string;
|
|
54
|
+
EVENT_TYPE: string;
|
|
55
|
+
SEVERITY: string;
|
|
56
|
+
APPLICATION_CONTEXT: string;
|
|
57
|
+
USER_CONTEXT: string;
|
|
58
|
+
COUNTRY: string;
|
|
59
|
+
SOURCE: string;
|
|
60
|
+
ERROR: {
|
|
61
|
+
TYPE: string;
|
|
62
|
+
STACK: string;
|
|
63
|
+
MESSAGE: string;
|
|
64
|
+
};
|
|
65
|
+
LOG: string;
|
|
66
|
+
CUSTOM_LABELS: string;
|
|
67
|
+
ENVIRONMENT: string;
|
|
68
|
+
INTERACTION_EVENT_NAME: string;
|
|
69
|
+
ELEMENT_INNER_TEXT: string;
|
|
70
|
+
ELEMENT_INNER_HTML: string;
|
|
71
|
+
ELEMENT_ID: string;
|
|
72
|
+
ELEMENT_CLASSES: string;
|
|
73
|
+
TARGET_XPATH: string;
|
|
74
|
+
TARGET_ELEMENT: string;
|
|
75
|
+
TARGET_ELEMENT_TYPE: string;
|
|
76
|
+
TIMESTAMP: string;
|
|
77
|
+
};
|
|
78
|
+
export declare const CoralogixDomainsApiUrlMap: {
|
|
79
|
+
EU1: string;
|
|
80
|
+
EU2: string;
|
|
81
|
+
US1: string;
|
|
82
|
+
US2: string;
|
|
83
|
+
AP1: string;
|
|
84
|
+
AP2: string;
|
|
85
|
+
};
|
|
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 ID_MASK_KEY = "{id}";
|
|
92
|
+
export declare const UUID_REGEX: RegExp;
|
|
93
|
+
export declare const NANOID_REGEX: RegExp;
|