@multiplayer-app/session-recorder-browser 1.3.21 → 1.3.23
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/dist/browser/index.js +18 -16
- package/dist/exporters/index.js +1 -1
- package/dist/exporters/index.js.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +18 -16
- package/dist/index.umd.js.map +1 -1
- package/dist/otel/index.d.ts +2 -2
- package/dist/otel/index.d.ts.map +1 -1
- package/dist/otel/index.js +14 -12
- package/dist/otel/index.js.map +1 -1
- package/dist/session-recorder.d.ts.map +1 -1
- package/dist/session-recorder.js +0 -2
- package/dist/session-recorder.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -24152,7 +24152,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
|
24152
24152
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
24153
24153
|
const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
|
|
24154
24154
|
const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
|
|
24155
|
-
const PACKAGE_VERSION_EXPORT = "1.3.
|
|
24155
|
+
const PACKAGE_VERSION_EXPORT = "1.3.23" || 0;
|
|
24156
24156
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
24157
24157
|
const OTEL_IGNORE_URLS = [
|
|
24158
24158
|
// Traces endpoint
|
|
@@ -25118,13 +25118,14 @@ const getElementTextContent = (element) => {
|
|
|
25118
25118
|
|
|
25119
25119
|
|
|
25120
25120
|
|
|
25121
|
+
const clientIdGenerator = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.getIdGenerator(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.MULTIPLAYER_TRACE_CLIENT_ID_LENGTH);
|
|
25121
25122
|
class TracerBrowserSDK {
|
|
25122
25123
|
constructor() {
|
|
25123
25124
|
this.clientId = '';
|
|
25124
25125
|
this.sessionId = '';
|
|
25125
25126
|
this.globalErrorListenersRegistered = false;
|
|
25126
25127
|
}
|
|
25127
|
-
|
|
25128
|
+
_setSessionId(sessionId, sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.MANUAL) {
|
|
25128
25129
|
this.sessionId = sessionId;
|
|
25129
25130
|
if (!this.idGenerator) {
|
|
25130
25131
|
throw new Error('Id generator not initialized');
|
|
@@ -25133,9 +25134,10 @@ class TracerBrowserSDK {
|
|
|
25133
25134
|
}
|
|
25134
25135
|
init(options) {
|
|
25135
25136
|
this.config = options;
|
|
25136
|
-
this.clientId =
|
|
25137
|
+
this.clientId = clientIdGenerator();
|
|
25137
25138
|
const { application, version, environment } = this.config;
|
|
25138
25139
|
this.idGenerator = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderIdGenerator();
|
|
25140
|
+
this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.SESSION_CACHE);
|
|
25139
25141
|
this.exporter = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderBrowserTraceExporter({
|
|
25140
25142
|
apiKey: options.apiKey,
|
|
25141
25143
|
url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
|
|
@@ -25269,13 +25271,13 @@ class TracerBrowserSDK {
|
|
|
25269
25271
|
if (!this.tracerProvider) {
|
|
25270
25272
|
throw new Error('Configuration not initialized. Call init() before start().');
|
|
25271
25273
|
}
|
|
25272
|
-
this.
|
|
25274
|
+
this._setSessionId(sessionId, sessionType);
|
|
25273
25275
|
}
|
|
25274
25276
|
stop() {
|
|
25275
25277
|
if (!this.tracerProvider) {
|
|
25276
25278
|
throw new Error('Configuration not initialized. Call init() before start().');
|
|
25277
25279
|
}
|
|
25278
|
-
this.
|
|
25280
|
+
this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.SESSION_CACHE);
|
|
25279
25281
|
}
|
|
25280
25282
|
setApiKey(apiKey) {
|
|
25281
25283
|
if (!this.exporter) {
|
|
@@ -25283,6 +25285,14 @@ class TracerBrowserSDK {
|
|
|
25283
25285
|
}
|
|
25284
25286
|
this.exporter.setApiKey(apiKey);
|
|
25285
25287
|
}
|
|
25288
|
+
async exportTraces(spans) {
|
|
25289
|
+
var _a;
|
|
25290
|
+
if ((_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd) {
|
|
25291
|
+
spans.map((span) => { var _a; return (_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd(span); });
|
|
25292
|
+
// return this.batchSpanProcessor.onEnd()
|
|
25293
|
+
}
|
|
25294
|
+
throw new Error('Buffer span processor not initialized');
|
|
25295
|
+
}
|
|
25286
25296
|
/**
|
|
25287
25297
|
* Capture an exception as an error span/event.
|
|
25288
25298
|
* If there is an active span, the exception will be recorded on it.
|
|
@@ -25314,14 +25324,6 @@ class TracerBrowserSDK {
|
|
|
25314
25324
|
}
|
|
25315
25325
|
catch (_ignored) { }
|
|
25316
25326
|
}
|
|
25317
|
-
async exportTraces(spans) {
|
|
25318
|
-
var _a;
|
|
25319
|
-
if ((_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd) {
|
|
25320
|
-
spans.map((span) => { var _a; return (_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd(span); });
|
|
25321
|
-
// return this.batchSpanProcessor.onEnd()
|
|
25322
|
-
}
|
|
25323
|
-
throw new Error('Buffer span processor not initialized');
|
|
25324
|
-
}
|
|
25325
25327
|
_recordException(span, error, errorInfo) {
|
|
25326
25328
|
span.recordException(error);
|
|
25327
25329
|
span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__.SpanStatusCode.ERROR, message: error.message });
|
|
@@ -27713,13 +27715,11 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27713
27715
|
}, 5000);
|
|
27714
27716
|
});
|
|
27715
27717
|
this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.REMOTE_SESSION_RECORDING_START, (payload) => {
|
|
27716
|
-
console.log('REMOTE_SESSION_RECORDING_START', payload);
|
|
27717
27718
|
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
|
|
27718
27719
|
this.start();
|
|
27719
27720
|
}
|
|
27720
27721
|
});
|
|
27721
27722
|
this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.REMOTE_SESSION_RECORDING_STOP, (payload) => {
|
|
27722
|
-
console.log('REMOTE_SESSION_RECORDING_STOP', payload);
|
|
27723
27723
|
if (this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
|
|
27724
27724
|
this.stop();
|
|
27725
27725
|
}
|
|
@@ -29976,7 +29976,9 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
|
|
|
29976
29976
|
}
|
|
29977
29977
|
SessionRecorderIdGenerator.prototype.generateTraceId = function () {
|
|
29978
29978
|
var traceId = this.generateLongId();
|
|
29979
|
-
if (!this.sessionShortId
|
|
29979
|
+
if (!this.sessionShortId
|
|
29980
|
+
&& !this.sessionType
|
|
29981
|
+
&& !this.clientId) {
|
|
29980
29982
|
return traceId;
|
|
29981
29983
|
}
|
|
29982
29984
|
var sessionTypePrefix = _constants_constants_base__WEBPACK_IMPORTED_MODULE_2__.MULTIPLAYER_TRACE_PREFIX_MAP[this.sessionType];
|