@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/browser/index.js
CHANGED
|
@@ -25054,7 +25054,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
|
25054
25054
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
25055
25055
|
const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
|
|
25056
25056
|
const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
|
|
25057
|
-
const PACKAGE_VERSION_EXPORT = "1.3.
|
|
25057
|
+
const PACKAGE_VERSION_EXPORT = "1.3.23" || 0;
|
|
25058
25058
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
25059
25059
|
const OTEL_IGNORE_URLS = [
|
|
25060
25060
|
// Traces endpoint
|
|
@@ -26063,13 +26063,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26063
26063
|
|
|
26064
26064
|
|
|
26065
26065
|
|
|
26066
|
+
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);
|
|
26066
26067
|
class TracerBrowserSDK {
|
|
26067
26068
|
constructor() {
|
|
26068
26069
|
this.clientId = '';
|
|
26069
26070
|
this.sessionId = '';
|
|
26070
26071
|
this.globalErrorListenersRegistered = false;
|
|
26071
26072
|
}
|
|
26072
|
-
|
|
26073
|
+
_setSessionId(sessionId, sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.MANUAL) {
|
|
26073
26074
|
this.sessionId = sessionId;
|
|
26074
26075
|
if (!this.idGenerator) {
|
|
26075
26076
|
throw new Error('Id generator not initialized');
|
|
@@ -26078,9 +26079,10 @@ class TracerBrowserSDK {
|
|
|
26078
26079
|
}
|
|
26079
26080
|
init(options) {
|
|
26080
26081
|
this.config = options;
|
|
26081
|
-
this.clientId =
|
|
26082
|
+
this.clientId = clientIdGenerator();
|
|
26082
26083
|
const { application, version, environment } = this.config;
|
|
26083
26084
|
this.idGenerator = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderIdGenerator();
|
|
26085
|
+
this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.SESSION_CACHE);
|
|
26084
26086
|
this.exporter = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderBrowserTraceExporter({
|
|
26085
26087
|
apiKey: options.apiKey,
|
|
26086
26088
|
url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
|
|
@@ -26214,13 +26216,13 @@ class TracerBrowserSDK {
|
|
|
26214
26216
|
if (!this.tracerProvider) {
|
|
26215
26217
|
throw new Error('Configuration not initialized. Call init() before start().');
|
|
26216
26218
|
}
|
|
26217
|
-
this.
|
|
26219
|
+
this._setSessionId(sessionId, sessionType);
|
|
26218
26220
|
}
|
|
26219
26221
|
stop() {
|
|
26220
26222
|
if (!this.tracerProvider) {
|
|
26221
26223
|
throw new Error('Configuration not initialized. Call init() before start().');
|
|
26222
26224
|
}
|
|
26223
|
-
this.
|
|
26225
|
+
this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.SESSION_CACHE);
|
|
26224
26226
|
}
|
|
26225
26227
|
setApiKey(apiKey) {
|
|
26226
26228
|
if (!this.exporter) {
|
|
@@ -26228,6 +26230,14 @@ class TracerBrowserSDK {
|
|
|
26228
26230
|
}
|
|
26229
26231
|
this.exporter.setApiKey(apiKey);
|
|
26230
26232
|
}
|
|
26233
|
+
async exportTraces(spans) {
|
|
26234
|
+
var _a;
|
|
26235
|
+
if ((_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd) {
|
|
26236
|
+
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); });
|
|
26237
|
+
// return this.batchSpanProcessor.onEnd()
|
|
26238
|
+
}
|
|
26239
|
+
throw new Error('Buffer span processor not initialized');
|
|
26240
|
+
}
|
|
26231
26241
|
/**
|
|
26232
26242
|
* Capture an exception as an error span/event.
|
|
26233
26243
|
* If there is an active span, the exception will be recorded on it.
|
|
@@ -26259,14 +26269,6 @@ class TracerBrowserSDK {
|
|
|
26259
26269
|
}
|
|
26260
26270
|
catch (_ignored) { }
|
|
26261
26271
|
}
|
|
26262
|
-
async exportTraces(spans) {
|
|
26263
|
-
var _a;
|
|
26264
|
-
if ((_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd) {
|
|
26265
|
-
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); });
|
|
26266
|
-
// return this.batchSpanProcessor.onEnd()
|
|
26267
|
-
}
|
|
26268
|
-
throw new Error('Buffer span processor not initialized');
|
|
26269
|
-
}
|
|
26270
26272
|
_recordException(span, error, errorInfo) {
|
|
26271
26273
|
span.recordException(error);
|
|
26272
26274
|
span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__.SpanStatusCode.ERROR, message: error.message });
|
|
@@ -28681,13 +28683,11 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28681
28683
|
}, 5000);
|
|
28682
28684
|
});
|
|
28683
28685
|
this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.REMOTE_SESSION_RECORDING_START, (payload) => {
|
|
28684
|
-
console.log('REMOTE_SESSION_RECORDING_START', payload);
|
|
28685
28686
|
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
|
|
28686
28687
|
this.start();
|
|
28687
28688
|
}
|
|
28688
28689
|
});
|
|
28689
28690
|
this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.REMOTE_SESSION_RECORDING_STOP, (payload) => {
|
|
28690
|
-
console.log('REMOTE_SESSION_RECORDING_STOP', payload);
|
|
28691
28691
|
if (this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
|
|
28692
28692
|
this.stop();
|
|
28693
28693
|
}
|
|
@@ -31045,7 +31045,9 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
|
|
|
31045
31045
|
}
|
|
31046
31046
|
SessionRecorderIdGenerator.prototype.generateTraceId = function () {
|
|
31047
31047
|
var traceId = this.generateLongId();
|
|
31048
|
-
if (!this.sessionShortId
|
|
31048
|
+
if (!this.sessionShortId
|
|
31049
|
+
&& !this.sessionType
|
|
31050
|
+
&& !this.clientId) {
|
|
31049
31051
|
return traceId;
|
|
31050
31052
|
}
|
|
31051
31053
|
var sessionTypePrefix = _constants_constants_base__WEBPACK_IMPORTED_MODULE_2__.MULTIPLAYER_TRACE_PREFIX_MAP[this.sessionType];
|