@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.
Files changed (80) hide show
  1. package/README.md +104 -0
  2. package/package.json +32 -0
  3. package/src/CoralogixExporter.d.ts +15 -0
  4. package/src/CoralogixExporter.js +217 -0
  5. package/src/CoralogixExporter.js.map +1 -0
  6. package/src/CoralogixPropgator.d.ts +3 -0
  7. package/src/CoralogixPropgator.js +9 -0
  8. package/src/CoralogixPropgator.js.map +1 -0
  9. package/src/CoralogixSpanAttributesProcessor.d.ts +18 -0
  10. package/src/CoralogixSpanAttributesProcessor.js +64 -0
  11. package/src/CoralogixSpanAttributesProcessor.js.map +1 -0
  12. package/src/CoralogixWebTracerProvider.d.ts +3 -0
  13. package/src/CoralogixWebTracerProvider.js +11 -0
  14. package/src/CoralogixWebTracerProvider.js.map +1 -0
  15. package/src/constants.d.ts +93 -0
  16. package/src/constants.js +111 -0
  17. package/src/constants.js.map +1 -0
  18. package/src/helpers.d.ts +2 -0
  19. package/src/helpers.js +5 -0
  20. package/src/helpers.js.map +1 -0
  21. package/src/index.d.ts +2 -0
  22. package/src/index.js +203 -0
  23. package/src/index.js.map +1 -0
  24. package/src/instrumentations/CoralogixCustomLogInstrumentation.d.ts +14 -0
  25. package/src/instrumentations/CoralogixCustomLogInstrumentation.js +41 -0
  26. package/src/instrumentations/CoralogixCustomLogInstrumentation.js.map +1 -0
  27. package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +32 -0
  28. package/src/instrumentations/CoralogixErrorInstrumentation.js +226 -0
  29. package/src/instrumentations/CoralogixErrorInstrumentation.js.map +1 -0
  30. package/src/instrumentations/CoralogixFetchInstrumentation.d.ts +8 -0
  31. package/src/instrumentations/CoralogixFetchInstrumentation.js +36 -0
  32. package/src/instrumentations/CoralogixFetchInstrumentation.js.map +1 -0
  33. package/src/instrumentations/CoralogixLongTaskInstrumentation.d.ts +12 -0
  34. package/src/instrumentations/CoralogixLongTaskInstrumentation.js +71 -0
  35. package/src/instrumentations/CoralogixLongTaskInstrumentation.js.map +1 -0
  36. package/src/instrumentations/CoralogixResourcesInstrumentation.d.ts +13 -0
  37. package/src/instrumentations/CoralogixResourcesInstrumentation.js +129 -0
  38. package/src/instrumentations/CoralogixResourcesInstrumentation.js.map +1 -0
  39. package/src/instrumentations/CoralogixUserInteractionInstrumentation.d.ts +17 -0
  40. package/src/instrumentations/CoralogixUserInteractionInstrumentation.js +79 -0
  41. package/src/instrumentations/CoralogixUserInteractionInstrumentation.js.map +1 -0
  42. package/src/instrumentations/CoralogixWebVitalsInstrumentation.d.ts +18 -0
  43. package/src/instrumentations/CoralogixWebVitalsInstrumentation.js +160 -0
  44. package/src/instrumentations/CoralogixWebVitalsInstrumentation.js.map +1 -0
  45. package/src/instrumentations/CoralogixXhrInstrumentation.d.ts +7 -0
  46. package/src/instrumentations/CoralogixXhrInstrumentation.js +33 -0
  47. package/src/instrumentations/CoralogixXhrInstrumentation.js.map +1 -0
  48. package/src/instrumentations/instrumentation.consts.d.ts +18 -0
  49. package/src/instrumentations/instrumentation.consts.js +57 -0
  50. package/src/instrumentations/instrumentation.consts.js.map +1 -0
  51. package/src/instrumentations/instrumentation.helper.d.ts +1 -0
  52. package/src/instrumentations/instrumentation.helper.js +4 -0
  53. package/src/instrumentations/instrumentation.helper.js.map +1 -0
  54. package/src/instrumentations/instrumentation.model.d.ts +30 -0
  55. package/src/instrumentations/instrumentation.model.js +18 -0
  56. package/src/instrumentations/instrumentation.model.js.map +1 -0
  57. package/src/sessionManager.d.ts +12 -0
  58. package/src/sessionManager.js +69 -0
  59. package/src/sessionManager.js.map +1 -0
  60. package/src/tools/addEventListener.d.ts +54 -0
  61. package/src/tools/addEventListener.js +35 -0
  62. package/src/tools/addEventListener.js.map +1 -0
  63. package/src/tools/getGlobalObject.d.ts +5 -0
  64. package/src/tools/getGlobalObject.js +36 -0
  65. package/src/tools/getGlobalObject.js.map +1 -0
  66. package/src/tools/getZoneJsOriginalDom.d.ts +9 -0
  67. package/src/tools/getZoneJsOriginalDom.js +17 -0
  68. package/src/tools/getZoneJsOriginalDom.js.map +1 -0
  69. package/src/types-external.d.ts +8 -0
  70. package/src/types-external.js +10 -0
  71. package/src/types-external.js.map +1 -0
  72. package/src/types.d.ts +270 -0
  73. package/src/types.js +27 -0
  74. package/src/types.js.map +1 -0
  75. package/src/utils.d.ts +24 -0
  76. package/src/utils.js +156 -0
  77. package/src/utils.js.map +1 -0
  78. package/src/version.d.ts +1 -0
  79. package/src/version.js +2 -0
  80. package/src/version.js.map +1 -0
@@ -0,0 +1,111 @@
1
+ import { CoralogixErrorInstrumentation, ERROR_INSTRUMENTATION_NAME, ErrorAttributes, } from './instrumentations/CoralogixErrorInstrumentation';
2
+ import { CoralogixFetchInstrumentation } from './instrumentations/CoralogixFetchInstrumentation';
3
+ import { CoralogixXhrInstrumentation } from './instrumentations/CoralogixXhrInstrumentation';
4
+ import { CoralogixCustomLogInstrumentation } from './instrumentations/CoralogixCustomLogInstrumentation';
5
+ import { CoralogixUserInteractionInstrumentation } from './instrumentations/CoralogixUserInteractionInstrumentation';
6
+ import { CoralogixWebVitalsInstrumentation } from './instrumentations/CoralogixWebVitalsInstrumentation';
7
+ import { LONG_TASKS_INSTRUMENTATION_NAME, RESOURCES_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_NAME, } from './instrumentations/instrumentation.consts';
8
+ import { CoralogixLongTaskInstrumentation } from './instrumentations/CoralogixLongTaskInstrumentation';
9
+ import { CoralogixResourcesInstrumentation } from './instrumentations/CoralogixResourcesInstrumentation';
10
+ export var miillisecondsInSecond = 1000;
11
+ export var CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
12
+ export var MAX_EXPORT_BATCH_SIZE = 50;
13
+ export var MAX_INTERACTION_ELEMENT_SIZE = 1024;
14
+ export var SCHEDULE_DELAY_MILLIS = 2 * miillisecondsInSecond;
15
+ export var REQUIRED_CONFIG_KEYS = [
16
+ 'application',
17
+ 'public_key',
18
+ 'coralogixDomain',
19
+ 'version',
20
+ ];
21
+ export var OPTIONS_DEFAULTS = {
22
+ ignoreUrls: [new RegExp('.*' + CORALOGIX_LOGS_URL_SUFFIX + '.*')],
23
+ user_context: {
24
+ user_id: '',
25
+ user_name: '',
26
+ },
27
+ labels: {},
28
+ };
29
+ export var INSTRUMENTATIONS = [
30
+ {
31
+ Instrument: CoralogixErrorInstrumentation,
32
+ confKey: ERROR_INSTRUMENTATION_NAME,
33
+ disable: false,
34
+ },
35
+ {
36
+ Instrument: CoralogixFetchInstrumentation,
37
+ confKey: 'fetch',
38
+ disable: false,
39
+ },
40
+ {
41
+ Instrument: CoralogixXhrInstrumentation,
42
+ confKey: 'xhr',
43
+ disable: false,
44
+ },
45
+ {
46
+ Instrument: CoralogixCustomLogInstrumentation,
47
+ confKey: 'custom',
48
+ disable: false,
49
+ },
50
+ {
51
+ Instrument: CoralogixUserInteractionInstrumentation,
52
+ confKey: 'interactions',
53
+ disable: false,
54
+ },
55
+ {
56
+ Instrument: CoralogixWebVitalsInstrumentation,
57
+ confKey: WEB_VITALS_INSTRUMENTATION_NAME,
58
+ disable: false,
59
+ },
60
+ {
61
+ Instrument: CoralogixLongTaskInstrumentation,
62
+ confKey: LONG_TASKS_INSTRUMENTATION_NAME,
63
+ disable: false,
64
+ },
65
+ {
66
+ Instrument: CoralogixResourcesInstrumentation,
67
+ confKey: RESOURCES_INSTRUMENTATION_NAME,
68
+ disable: false,
69
+ },
70
+ ];
71
+ export var CoralogixAttributes = {
72
+ USER_AGENT: 'user_agent',
73
+ LOCATION_HREF: 'location_href',
74
+ LOCATION_FRAGMENTS: 'location_fragments',
75
+ EVENT_TYPE: 'event_type',
76
+ SEVERITY: 'severity',
77
+ APPLICATION_CONTEXT: 'application_context',
78
+ USER_CONTEXT: 'user_context',
79
+ COUNTRY: 'country',
80
+ SOURCE: 'source',
81
+ ERROR: ErrorAttributes,
82
+ LOG: 'cx_log',
83
+ CUSTOM_LABELS: 'custom_labels',
84
+ ENVIRONMENT: 'environment',
85
+ INTERACTION_EVENT_NAME: 'interaction_event_name',
86
+ ELEMENT_INNER_TEXT: 'element_inner_text',
87
+ ELEMENT_INNER_HTML: 'element_inner_html',
88
+ ELEMENT_ID: 'element_id',
89
+ ELEMENT_CLASSES: 'element_classes',
90
+ TARGET_XPATH: 'target_xpath',
91
+ TARGET_ELEMENT: 'target_element',
92
+ TARGET_ELEMENT_TYPE: 'target_element_type',
93
+ TIMESTAMP: 'timestamp',
94
+ };
95
+ export var CoralogixDomainsApiUrlMap = {
96
+ EU1: 'https://ingress.eu1.rum-ingress-coralogix.com',
97
+ EU2: 'https://ingress.eu2.rum-ingress-coralogix.com',
98
+ US1: 'https://ingress.us1.rum-ingress-coralogix.com',
99
+ US2: 'https://ingress.us2.rum-ingress-coralogix.com',
100
+ AP1: 'https://ingress.ap1.rum-ingress-coralogix.com',
101
+ AP2: 'https://ingress.ap2.rum-ingress-coralogix.com', // ap-southeast-1 (Singapore)
102
+ };
103
+ export var SDK_CONFIG_KEY = 'sdkConfig';
104
+ export var MILLISECONDS_PER_HOUR = 60000 * 60;
105
+ export var SESSION_IDLE_TIME_IN_MINUTES = 15;
106
+ export var SESSION_EXPIRATION_IN_HOURS = 1;
107
+ export var SESSION_MANAGER_KEY = 'rumSessionManager';
108
+ export var ID_MASK_KEY = '{id}';
109
+ export var UUID_REGEX = /[0-9a-fA-F-]{36}/g;
110
+ export var NANOID_REGEX = /^[a-zA-Z0-9-_]{21}$/;
111
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../libs/browser/src/constants.ts"],"names":[],"mappings":"AACA,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,g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+C;IACpD,GAAG,EAAE,+CAA+C;IACpD,GAAG,EAAE,+CAA+C,EAAE,6BAA6B;CACpF,CAAC;AAEF,MAAM,CAAC,IAAM,cAAc,GAAG,WAAW,CAAC;AAC1C,MAAM,CAAC,IAAM,qBAAqB,GAAG,KAAK,GAAG,EAAE,CAAC;AAChD,MAAM,CAAC,IAAM,4BAA4B,GAAG,EAAE,CAAC;AAC/C,MAAM,CAAC,IAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,IAAM,mBAAmB,GAAG,mBAAmB,CAAC;AACvD,MAAM,CAAC,IAAM,WAAW,GAAG,MAAM,CAAC;AAClC,MAAM,CAAC,IAAM,UAAU,GAAG,mBAAmB,CAAC;AAC9C,MAAM,CAAC,IAAM,YAAY,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CoralogixBrowserSdkConfig } from './types';
2
+ export declare function getSdkConfig(): CoralogixBrowserSdkConfig;
package/src/helpers.js ADDED
@@ -0,0 +1,5 @@
1
+ import { SDK_CONFIG_KEY } from './constants';
2
+ export function getSdkConfig() {
3
+ return window[SDK_CONFIG_KEY];
4
+ }
5
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../libs/browser/src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC;AAChC,CAAC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { CoralogixOtelWebType } from './types';
2
+ export declare const CoralogixRum: CoralogixOtelWebType;
package/src/index.js ADDED
@@ -0,0 +1,203 @@
1
+ import { __assign } from "tslib";
2
+ import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
3
+ import { getInstrumentationConfig, resolveCoralogixOtelWebConfig, } from './utils';
4
+ import { CoralogixSpanAttributesProcessor } from './CoralogixSpanAttributesProcessor';
5
+ import { CoralogixAttributes, INSTRUMENTATIONS, MAX_EXPORT_BATCH_SIZE, OPTIONS_DEFAULTS, REQUIRED_CONFIG_KEYS, SCHEDULE_DELAY_MILLIS, SDK_CONFIG_KEY, SESSION_MANAGER_KEY, } from './constants';
6
+ import { registerInstrumentations } from '@opentelemetry/instrumentation';
7
+ import { CoralogixExporter } from './CoralogixExporter';
8
+ import { CoralogixLogSeverity } from './types-external';
9
+ import { CoralogixCustomLogInstrumentation } from './instrumentations/CoralogixCustomLogInstrumentation';
10
+ import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator, } from '@opentelemetry/core';
11
+ import { CoralogixWebTracerProvider } from './CoralogixWebTracerProvider';
12
+ import { isNil } from 'lodash-es';
13
+ import { SessionManager } from './sessionManager';
14
+ import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray';
15
+ var isInited = false;
16
+ var _deregisterInstrumentations;
17
+ var _customInstrumentation;
18
+ var tracerProvider;
19
+ var attributesProcessor;
20
+ var exporter;
21
+ export var CoralogixRum = {
22
+ get isInited() {
23
+ return isInited;
24
+ },
25
+ init: function (options) {
26
+ var _a, _b;
27
+ var _c;
28
+ window[SDK_CONFIG_KEY] = options;
29
+ // Check if CoralogixRum already inited.
30
+ if (isInited) {
31
+ console.warn('CoralogixRum already inited.');
32
+ return;
33
+ }
34
+ // Abort if running in a non-browser environment.
35
+ if (typeof window !== 'object') {
36
+ console.error('CoralogixRum: Non-browser environment detected, aborting');
37
+ return;
38
+ }
39
+ // Abort if running in a not supported browser.
40
+ if (typeof Symbol !== 'function') {
41
+ console.error('CoralogixRum: browser not supported, disabling instrumentation.');
42
+ return;
43
+ }
44
+ // Abort if didn't provide all required init options.
45
+ for (var _i = 0, REQUIRED_CONFIG_KEYS_1 = REQUIRED_CONFIG_KEYS; _i < REQUIRED_CONFIG_KEYS_1.length; _i++) {
46
+ var requiredProp = REQUIRED_CONFIG_KEYS_1[_i];
47
+ if (isNil(options[requiredProp])) {
48
+ console.error("CoralogixRum: Initialization aborted. Please provide the required property \"".concat(requiredProp, "\"."));
49
+ return;
50
+ }
51
+ }
52
+ // Merge options & default options.
53
+ var resolvedOptions = resolveCoralogixOtelWebConfig(options);
54
+ // Check if not in debug mode & no auth token.
55
+ if (!resolvedOptions.debug && !resolvedOptions.public_key) {
56
+ console.warn('rumAuth will be required in the future');
57
+ }
58
+ var ignoreUrls = resolvedOptions.ignoreUrls, labels = resolvedOptions.labels, user_context = resolvedOptions.user_context, application = resolvedOptions.application, version = resolvedOptions.version, traceParentInHeader = resolvedOptions.traceParentInHeader, environment = resolvedOptions.environment;
59
+ tracerProvider = new CoralogixWebTracerProvider();
60
+ var pluginDefaults = {};
61
+ // Resolve instrumentations.
62
+ var instrumentations = INSTRUMENTATIONS.map(function (_a) {
63
+ var _b;
64
+ var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
65
+ var pluginConf = getInstrumentationConfig((_b = resolvedOptions === null || resolvedOptions === void 0 ? void 0 : resolvedOptions.instrumentations) === null || _b === void 0 ? void 0 : _b[confKey], pluginDefaults, disable);
66
+ if (pluginConf) {
67
+ var instrumentation = void 0;
68
+ switch (confKey) {
69
+ case 'errors': {
70
+ instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreErrors: options === null || options === void 0 ? void 0 : options.ignoreErrors }));
71
+ break;
72
+ }
73
+ case 'fetch':
74
+ case 'xhr': {
75
+ instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls, traceParentInHeader: traceParentInHeader }));
76
+ break;
77
+ }
78
+ default:
79
+ instrumentation = new Instrument(pluginConf);
80
+ }
81
+ if (instrumentation instanceof CoralogixCustomLogInstrumentation) {
82
+ _customInstrumentation = instrumentation;
83
+ }
84
+ return instrumentation;
85
+ }
86
+ return null;
87
+ }).filter(function (a) { return Boolean(a); });
88
+ var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
89
+ // Init Span Attributes Processor.
90
+ attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
91
+ application: application,
92
+ version: version,
93
+ }), _a[CoralogixAttributes.USER_CONTEXT] = JSON.stringify(mergedUserContext), _a), (environment
94
+ ? (_b = {}, _b[CoralogixAttributes.ENVIRONMENT] = environment, _b) : {})));
95
+ new SessionManager().start();
96
+ if (labels) {
97
+ attributesProcessor.setCustomLabels(labels);
98
+ }
99
+ // Add Span Attributes Processor.
100
+ tracerProvider.addSpanProcessor(attributesProcessor);
101
+ // Add Batch Span Processor and Exporter
102
+ tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter({
103
+ public_key: options === null || options === void 0 ? void 0 : options.public_key,
104
+ coralogixDomain: options === null || options === void 0 ? void 0 : options.coralogixDomain,
105
+ })), {
106
+ maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
107
+ scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
108
+ }));
109
+ if (traceParentInHeader === null || traceParentInHeader === void 0 ? void 0 : traceParentInHeader.enabled) {
110
+ tracerProvider.register({
111
+ propagator: new CompositePropagator({
112
+ propagators: [
113
+ ((_c = traceParentInHeader.options) === null || _c === void 0 ? void 0 : _c.propagateAwsXrayTraceHeader)
114
+ ? new AWSXRayPropagator()
115
+ : new W3CTraceContextPropagator(),
116
+ new W3CBaggagePropagator(),
117
+ ],
118
+ }),
119
+ });
120
+ }
121
+ // Register Instrumentations
122
+ _deregisterInstrumentations = registerInstrumentations({
123
+ tracerProvider: tracerProvider,
124
+ instrumentations: instrumentations,
125
+ });
126
+ isInited = true;
127
+ if (options === null || options === void 0 ? void 0 : options.debug) {
128
+ console.info('CoralogixRum.init() complete');
129
+ }
130
+ },
131
+ shutdown: function () {
132
+ var _a;
133
+ if (!isInited) {
134
+ return;
135
+ }
136
+ _deregisterInstrumentations === null || _deregisterInstrumentations === void 0 ? void 0 : _deregisterInstrumentations();
137
+ _deregisterInstrumentations = undefined;
138
+ (_a = window[SESSION_MANAGER_KEY]) === null || _a === void 0 ? void 0 : _a.stop();
139
+ window[SESSION_MANAGER_KEY] = undefined;
140
+ exporter === null || exporter === void 0 ? void 0 : exporter.shutdown();
141
+ isInited = false;
142
+ },
143
+ setApplicationContext: function (applicationContext) {
144
+ var _a;
145
+ if (!isInited) {
146
+ console.debug('CoralogixRum must be initiated before setting application context');
147
+ return;
148
+ }
149
+ attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setInternalLabels(__assign(__assign({}, attributesProcessor.getInternalLabels()), (_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = applicationContext, _a)));
150
+ },
151
+ setUserContext: function (userContext) {
152
+ var _a;
153
+ if (!isInited) {
154
+ console.debug('CoralogixRum must be initiated before setting user context');
155
+ return;
156
+ }
157
+ attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setInternalLabels(__assign(__assign({}, attributesProcessor.getInternalLabels()), (_a = {}, _a[CoralogixAttributes.USER_CONTEXT] = userContext, _a)));
158
+ },
159
+ getUserContext: function () {
160
+ return attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.getUserContext();
161
+ },
162
+ setLabels: function (labels) {
163
+ attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setCustomLabels(labels);
164
+ },
165
+ getLabels: function () {
166
+ return (attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.getCustomLabels()) || {};
167
+ },
168
+ getSessionId: function () {
169
+ var _a, _b;
170
+ return (_b = (_a = window[SESSION_MANAGER_KEY]) === null || _a === void 0 ? void 0 : _a.getSession()) === null || _b === void 0 ? void 0 : _b.sessionId;
171
+ },
172
+ log: function (severity, message, data) {
173
+ if (!isInited) {
174
+ console.debug('CoralogixRum must be initiated before using log');
175
+ return;
176
+ }
177
+ if (!_customInstrumentation) {
178
+ console.error('Log was reported, but custom instrumentation is disabled.');
179
+ return;
180
+ }
181
+ _customInstrumentation === null || _customInstrumentation === void 0 ? void 0 : _customInstrumentation.log(severity, message, data);
182
+ },
183
+ debug: function (message, data) {
184
+ this.log(CoralogixLogSeverity.Debug, message, data);
185
+ },
186
+ verbose: function (message, data) {
187
+ this.log(CoralogixLogSeverity.Verbose, message, data);
188
+ },
189
+ info: function (message, data) {
190
+ this.log(CoralogixLogSeverity.Info, message, data);
191
+ },
192
+ warn: function (message, data) {
193
+ this.log(CoralogixLogSeverity.Warn, message, data);
194
+ },
195
+ error: function (message, data) {
196
+ this.log(CoralogixLogSeverity.Error, message, data);
197
+ },
198
+ critical: function (message, data) {
199
+ this.log(CoralogixLogSeverity.Critical, message, data);
200
+ },
201
+ };
202
+ window.CoralogixRum = CoralogixRum;
203
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/browser/src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAQtF,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE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OAAO,EAAE,IAAI;QACnB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,YAAC,OAAO,EAAE,IAAI;QAChB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,YAAC,OAAO,EAAE,IAAI;QAChB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,YAAC,OAAO,EAAE,IAAI;QACjB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ,YAAC,OAAO,EAAE,IAAI;QACpB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF,CAAC;AAED,MAAc,CAAC,YAAY,GAAG,YAAY,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation';
2
+ import { CoralogixLogSeverity } from '../types-external';
3
+ export declare const CUSTOM_INSTRUMENTATION_VERSION = "1";
4
+ export declare enum LogSource {
5
+ CODE = "code"
6
+ }
7
+ export declare class CoralogixCustomLogInstrumentation extends InstrumentationBase {
8
+ private stringifyCustomLogData;
9
+ constructor(config: InstrumentationConfig);
10
+ init(): void;
11
+ disable(): void;
12
+ enable(): void;
13
+ log(severity: CoralogixLogSeverity, message: string, data?: any): void;
14
+ }
@@ -0,0 +1,41 @@
1
+ import { __extends } from "tslib";
2
+ import { InstrumentationBase, } from '@opentelemetry/instrumentation';
3
+ import { CoralogixAttributes } from '../constants';
4
+ import { CoralogixEventType } from '../types';
5
+ import { getSdkConfig } from '../helpers';
6
+ import { getCircularReplacer } from '../utils';
7
+ export var CUSTOM_INSTRUMENTATION_VERSION = '1';
8
+ export var LogSource;
9
+ (function (LogSource) {
10
+ LogSource["CODE"] = "code";
11
+ })(LogSource || (LogSource = {}));
12
+ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
13
+ __extends(CoralogixCustomLogInstrumentation, _super);
14
+ function CoralogixCustomLogInstrumentation(config) {
15
+ var _a;
16
+ var _this = _super.call(this, CoralogixEventType.LOG, CUSTOM_INSTRUMENTATION_VERSION, config) || this;
17
+ _this.stringifyCustomLogData = (_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.stringifyCustomLogData;
18
+ return _this;
19
+ }
20
+ CoralogixCustomLogInstrumentation.prototype.init = function () { };
21
+ CoralogixCustomLogInstrumentation.prototype.disable = function () { };
22
+ CoralogixCustomLogInstrumentation.prototype.enable = function () { };
23
+ CoralogixCustomLogInstrumentation.prototype.log = function (severity, message, data) {
24
+ var span = this.tracer.startSpan(CoralogixEventType.LOG);
25
+ span.setAttribute(CoralogixAttributes.TIMESTAMP, Date.now());
26
+ span.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.LOG);
27
+ span.setAttribute(CoralogixAttributes.SOURCE, LogSource.CODE);
28
+ span.setAttribute(CoralogixAttributes.SEVERITY, severity);
29
+ span.setAttribute(CoralogixAttributes.LOG, JSON.stringify({
30
+ severity: severity,
31
+ message: message,
32
+ data: this.stringifyCustomLogData
33
+ ? JSON.stringify(data, getCircularReplacer())
34
+ : data,
35
+ }));
36
+ span.end();
37
+ };
38
+ return CoralogixCustomLogInstrumentation;
39
+ }(InstrumentationBase));
40
+ export { CoralogixCustomLogInstrumentation };
41
+ //# sourceMappingURL=CoralogixCustomLogInstrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoralogixCustomLogInstrumentation.js","sourceRoot":"","sources":["../../../../../libs/browser/src/instrumentations/CoralogixCustomLogInstrumentation.ts"],"names":[],"mappings":";AAAA,OAAO,EACL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AmB,CAAC,GAAG,EACvB,IAAI,CAAC,SAAS,CAAC;YACb,QAAQ,UAAA;YACR,OAAO,SAAA;YACP,IAAI,EAAE,IAAI,CAAC,sBAAsB;gBAC/B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC;gBAC7C,CAAC,CAAC,IAAI;SACT,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC;IACH,wCAAC;AAAD,CAAC,AAnCD,CAAuD,mBAAmB,GAmCzE"}
@@ -0,0 +1,32 @@
1
+ import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation';
2
+ export declare const ERROR_INSTRUMENTATION_NAME = "errors";
3
+ export declare const ERROR_INSTRUMENTATION_VERSION = "1";
4
+ export declare const ErrorAttributes: {
5
+ TYPE: string;
6
+ STACK: string;
7
+ MESSAGE: string;
8
+ };
9
+ export declare enum ErrorSource {
10
+ CONSOLE = "console",
11
+ WINDOW = "window",
12
+ UNHANDLED_REJECTION = "unhandledrejection",
13
+ DOCUMENT = "document"
14
+ }
15
+ export interface CoralogixErrorInstrumentationConfig extends InstrumentationConfig {
16
+ ignoreErrors?: Array<string | RegExp>;
17
+ }
18
+ export declare class CoralogixErrorInstrumentation extends InstrumentationBase {
19
+ ignoreErrors?: Array<string | RegExp>;
20
+ constructor(config: CoralogixErrorInstrumentationConfig);
21
+ init(): void;
22
+ enable(): void;
23
+ disable(): void;
24
+ report(source: ErrorSource, arg: string | Error | Event | ErrorEvent | Array<any>): void;
25
+ parseErrorObject: (obj: any) => string;
26
+ protected reportError(source: ErrorSource, err: Error): void;
27
+ protected reportString(source: ErrorSource, message: string, firstError?: Error): void;
28
+ protected reportErrorEvent(source: ErrorSource, { error, message }: ErrorEvent): void;
29
+ protected reportEvent(source: string, ev: Event): void;
30
+ protected getPossibleEventMessage(event: any): string;
31
+ private _shouldIgnoreError;
32
+ }