@multiplayer-app/session-recorder-browser 1.3.23 → 1.3.24
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 +8 -0
- package/dist/browser/index.js +42 -43
- package/dist/exporters/index.js +1 -1
- package/dist/exporters/index.js.map +1 -1
- package/dist/index.js +42 -43
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +42 -43
- package/dist/index.umd.js.map +1 -1
- package/dist/otel/CrashBufferSpanProcessor.js +3 -3
- package/dist/otel/CrashBufferSpanProcessor.js.map +1 -1
- package/dist/otel/index.js +16 -16
- package/dist/otel/index.js.map +1 -1
- package/dist/rrweb/index.js +6 -6
- package/dist/services/api.service.js +5 -5
- package/dist/services/crashBuffer.service.js +6 -6
- package/dist/services/crashBuffer.service.js.map +1 -1
- package/dist/services/indexedDb.service.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -114,6 +114,14 @@ SessionRecorder.init({
|
|
|
114
114
|
// should be sent through `exporters`
|
|
115
115
|
sampleTraceRatio: 0,
|
|
116
116
|
|
|
117
|
+
// crash buffer: keep a rolling window of rrweb + traces when no recording is active.
|
|
118
|
+
// when user starts a session or saves (e.g. on error), the buffer is flushed into the session.
|
|
119
|
+
buffering: {
|
|
120
|
+
enabled: true, // enable/disable buffering (default: true)
|
|
121
|
+
windowMinutes: 1, // rolling window size in minutes (default: 1)
|
|
122
|
+
snapshotIntervalMs: 30000 // full snapshot interval while buffering in ms (default: 30000)
|
|
123
|
+
},
|
|
124
|
+
|
|
117
125
|
// optional: exporters allow you to send
|
|
118
126
|
// OTLP data to observability platforms
|
|
119
127
|
exporters: [
|
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.24" || 0;
|
|
25058
25058
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
25059
25059
|
const OTEL_IGNORE_URLS = [
|
|
25060
25060
|
// Traces endpoint
|
|
@@ -25779,8 +25779,8 @@ class CrashBufferSpanProcessor {
|
|
|
25779
25779
|
this._crashBuffer.appendSpans([
|
|
25780
25780
|
{
|
|
25781
25781
|
ts: span.startTime[0] * 1000 + span.startTime[1] / 1000000,
|
|
25782
|
-
span: this._serializeSpan(span)
|
|
25783
|
-
}
|
|
25782
|
+
span: this._serializeSpan(span),
|
|
25783
|
+
},
|
|
25784
25784
|
]);
|
|
25785
25785
|
}
|
|
25786
25786
|
return;
|
|
@@ -26086,25 +26086,25 @@ class TracerBrowserSDK {
|
|
|
26086
26086
|
this.exporter = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderBrowserTraceExporter({
|
|
26087
26087
|
apiKey: options.apiKey,
|
|
26088
26088
|
url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
|
|
26089
|
-
usePostMessageFallback: options.usePostMessageFallback
|
|
26089
|
+
usePostMessageFallback: options.usePostMessageFallback,
|
|
26090
26090
|
});
|
|
26091
26091
|
this.batchSpanProcessor = new _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_5__.BatchSpanProcessor(this.exporter);
|
|
26092
26092
|
this.tracerProvider = new _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_6__.WebTracerProvider({
|
|
26093
26093
|
resource: (0,_opentelemetry_resources__WEBPACK_IMPORTED_MODULE_7__.resourceFromAttributes)({
|
|
26094
26094
|
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_SERVICE_NAME]: application,
|
|
26095
26095
|
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_SERVICE_VERSION]: version,
|
|
26096
|
-
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment
|
|
26096
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment,
|
|
26097
26097
|
}),
|
|
26098
26098
|
idGenerator: this.idGenerator,
|
|
26099
26099
|
sampler: new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio),
|
|
26100
26100
|
spanProcessors: [
|
|
26101
26101
|
this._getSpanSessionIdProcessor(),
|
|
26102
|
-
new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__.CrashBufferSpanProcessor(this.batchSpanProcessor, this.crashBuffer, this.exporter.serializeSpan.bind(this.exporter))
|
|
26103
|
-
]
|
|
26102
|
+
new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__.CrashBufferSpanProcessor(this.batchSpanProcessor, this.crashBuffer, this.exporter.serializeSpan.bind(this.exporter)),
|
|
26103
|
+
],
|
|
26104
26104
|
});
|
|
26105
26105
|
this.tracerProvider.register({
|
|
26106
26106
|
// contextManager: new ZoneContextManager(),
|
|
26107
|
-
propagator: new _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__.W3CTraceContextPropagator()
|
|
26107
|
+
propagator: new _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__.W3CTraceContextPropagator(),
|
|
26108
26108
|
});
|
|
26109
26109
|
(0,_opentelemetry_instrumentation__WEBPACK_IMPORTED_MODULE_10__.registerInstrumentations)({
|
|
26110
26110
|
tracerProvider: this.tracerProvider,
|
|
@@ -26132,7 +26132,7 @@ class TracerBrowserSDK {
|
|
|
26132
26132
|
requestBody,
|
|
26133
26133
|
responseBody,
|
|
26134
26134
|
requestHeaders,
|
|
26135
|
-
responseHeaders
|
|
26135
|
+
responseHeaders,
|
|
26136
26136
|
};
|
|
26137
26137
|
(0,_helpers__WEBPACK_IMPORTED_MODULE_3__.processHttpPayload)(payload, this.config, span);
|
|
26138
26138
|
}
|
|
@@ -26140,7 +26140,7 @@ class TracerBrowserSDK {
|
|
|
26140
26140
|
// eslint-disable-next-line
|
|
26141
26141
|
console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture xml-http payload', error);
|
|
26142
26142
|
}
|
|
26143
|
-
}
|
|
26143
|
+
},
|
|
26144
26144
|
},
|
|
26145
26145
|
'@opentelemetry/instrumentation-fetch': {
|
|
26146
26146
|
clearTimingResources: true,
|
|
@@ -26181,7 +26181,7 @@ class TracerBrowserSDK {
|
|
|
26181
26181
|
requestBody,
|
|
26182
26182
|
responseBody,
|
|
26183
26183
|
requestHeaders,
|
|
26184
|
-
responseHeaders
|
|
26184
|
+
responseHeaders,
|
|
26185
26185
|
};
|
|
26186
26186
|
(0,_helpers__WEBPACK_IMPORTED_MODULE_3__.processHttpPayload)(payload, this.config, span);
|
|
26187
26187
|
}
|
|
@@ -26189,7 +26189,7 @@ class TracerBrowserSDK {
|
|
|
26189
26189
|
// eslint-disable-next-line
|
|
26190
26190
|
console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture fetch payload', error);
|
|
26191
26191
|
}
|
|
26192
|
-
}
|
|
26192
|
+
},
|
|
26193
26193
|
},
|
|
26194
26194
|
'@opentelemetry/instrumentation-user-interaction': {
|
|
26195
26195
|
shouldPreventSpanCreation: (_event, element, span) => {
|
|
@@ -26202,10 +26202,10 @@ class TracerBrowserSDK {
|
|
|
26202
26202
|
span.setAttribute(`target.attribute.${attribute.name}`, attribute.value);
|
|
26203
26203
|
});
|
|
26204
26204
|
return false;
|
|
26205
|
-
}
|
|
26206
|
-
}
|
|
26207
|
-
})
|
|
26208
|
-
]
|
|
26205
|
+
},
|
|
26206
|
+
},
|
|
26207
|
+
}),
|
|
26208
|
+
],
|
|
26209
26209
|
});
|
|
26210
26210
|
this._registerGlobalErrorListeners();
|
|
26211
26211
|
}
|
|
@@ -26291,7 +26291,7 @@ class TracerBrowserSDK {
|
|
|
26291
26291
|
if ((_a = this.sessionId) === null || _a === void 0 ? void 0 : _a.length) {
|
|
26292
26292
|
span.setAttribute(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.ATTR_MULTIPLAYER_SESSION_ID, this.sessionId);
|
|
26293
26293
|
}
|
|
26294
|
-
}
|
|
26294
|
+
},
|
|
26295
26295
|
};
|
|
26296
26296
|
}
|
|
26297
26297
|
_registerGlobalErrorListeners() {
|
|
@@ -26760,7 +26760,7 @@ class RecorderBrowserSDK {
|
|
|
26760
26760
|
constructor() {
|
|
26761
26761
|
this.intervals = {
|
|
26762
26762
|
restart: null,
|
|
26763
|
-
bufferSnapshot: null
|
|
26763
|
+
bufferSnapshot: null,
|
|
26764
26764
|
};
|
|
26765
26765
|
this.startedAt = '';
|
|
26766
26766
|
this.stoppedAt = '';
|
|
@@ -26802,7 +26802,7 @@ class RecorderBrowserSDK {
|
|
|
26802
26802
|
return;
|
|
26803
26803
|
}
|
|
26804
26804
|
this._handleLiveSessionEvent(event, ts, sessionId, sessionType);
|
|
26805
|
-
}
|
|
26805
|
+
},
|
|
26806
26806
|
});
|
|
26807
26807
|
this.takeFullSnapshot();
|
|
26808
26808
|
this._setupPeriodicSnapshots(sessionId, sessionType);
|
|
@@ -26879,8 +26879,8 @@ class RecorderBrowserSDK {
|
|
|
26879
26879
|
event: {
|
|
26880
26880
|
event: packedEvent,
|
|
26881
26881
|
eventType: event.type,
|
|
26882
|
-
timestamp: ts
|
|
26883
|
-
}
|
|
26882
|
+
timestamp: ts,
|
|
26883
|
+
},
|
|
26884
26884
|
});
|
|
26885
26885
|
}
|
|
26886
26886
|
catch (error) {
|
|
@@ -26905,7 +26905,7 @@ class RecorderBrowserSDK {
|
|
|
26905
26905
|
eventType: event.type,
|
|
26906
26906
|
timestamp: ts,
|
|
26907
26907
|
debugSessionId: sessionId,
|
|
26908
|
-
debugSessionType: sessionType
|
|
26908
|
+
debugSessionType: sessionType,
|
|
26909
26909
|
});
|
|
26910
26910
|
}
|
|
26911
26911
|
/**
|
|
@@ -26919,7 +26919,7 @@ class RecorderBrowserSDK {
|
|
|
26919
26919
|
sampling: { canvas: 5 },
|
|
26920
26920
|
recordCanvas: (_c = this.config) === null || _c === void 0 ? void 0 : _c.recordCanvas,
|
|
26921
26921
|
dataURLOptions: { type: 'image/webp', quality: 0.1 },
|
|
26922
|
-
plugins: [(0,_rrweb_rrweb_plugin_console_record__WEBPACK_IMPORTED_MODULE_3__.getRecordConsolePlugin)({ level: ['log', 'error'] })]
|
|
26922
|
+
plugins: [(0,_rrweb_rrweb_plugin_console_record__WEBPACK_IMPORTED_MODULE_3__.getRecordConsolePlugin)({ level: ['log', 'error'] })],
|
|
26923
26923
|
};
|
|
26924
26924
|
if (maskingConfig.maskInputOptions) {
|
|
26925
26925
|
options.maskInputOptions = maskingConfig.maskInputOptions;
|
|
@@ -26981,7 +26981,7 @@ class ApiService {
|
|
|
26981
26981
|
this.config = {
|
|
26982
26982
|
apiKey: '',
|
|
26983
26983
|
apiBaseUrl: '',
|
|
26984
|
-
exporterEndpoint: ''
|
|
26984
|
+
exporterEndpoint: '',
|
|
26985
26985
|
};
|
|
26986
26986
|
}
|
|
26987
26987
|
/**
|
|
@@ -26991,7 +26991,7 @@ class ApiService {
|
|
|
26991
26991
|
init(config) {
|
|
26992
26992
|
this.config = {
|
|
26993
26993
|
...this.config,
|
|
26994
|
-
...config
|
|
26994
|
+
...config,
|
|
26995
26995
|
};
|
|
26996
26996
|
}
|
|
26997
26997
|
/**
|
|
@@ -27085,14 +27085,14 @@ class ApiService {
|
|
|
27085
27085
|
body: body ? JSON.stringify(body) : null,
|
|
27086
27086
|
headers: {
|
|
27087
27087
|
'Content-Type': 'application/json',
|
|
27088
|
-
...(this.config.apiKey && { 'X-Api-Key': this.config.apiKey })
|
|
27089
|
-
}
|
|
27088
|
+
...(this.config.apiKey && { 'X-Api-Key': this.config.apiKey }),
|
|
27089
|
+
},
|
|
27090
27090
|
};
|
|
27091
27091
|
try {
|
|
27092
27092
|
const response = await fetch(url, {
|
|
27093
27093
|
...params,
|
|
27094
27094
|
credentials: 'include',
|
|
27095
|
-
signal
|
|
27095
|
+
signal,
|
|
27096
27096
|
});
|
|
27097
27097
|
if (!response.ok) {
|
|
27098
27098
|
throw new Error('Network response was not ok: ' + response.statusText);
|
|
@@ -27167,7 +27167,7 @@ class CrashBufferService {
|
|
|
27167
27167
|
await this._safe(async () => {
|
|
27168
27168
|
await this.db.setAttrs({
|
|
27169
27169
|
tabId: this.tabId,
|
|
27170
|
-
...attrs
|
|
27170
|
+
...attrs,
|
|
27171
27171
|
});
|
|
27172
27172
|
}, undefined);
|
|
27173
27173
|
}
|
|
@@ -27185,7 +27185,7 @@ class CrashBufferService {
|
|
|
27185
27185
|
tabId: this.tabId,
|
|
27186
27186
|
ts: payload.ts,
|
|
27187
27187
|
isFullSnapshot: payload.isFullSnapshot,
|
|
27188
|
-
event: payload.event
|
|
27188
|
+
event: payload.event,
|
|
27189
27189
|
});
|
|
27190
27190
|
}, undefined);
|
|
27191
27191
|
if (isFullSnapshot && this.requiresFullSnapshot) {
|
|
@@ -27215,7 +27215,7 @@ class CrashBufferService {
|
|
|
27215
27215
|
return {
|
|
27216
27216
|
tabId: this.tabId,
|
|
27217
27217
|
ts: p.ts,
|
|
27218
|
-
span: p.span
|
|
27218
|
+
span: p.span,
|
|
27219
27219
|
};
|
|
27220
27220
|
});
|
|
27221
27221
|
await this.db.appendSpans(records);
|
|
@@ -27264,7 +27264,7 @@ class CrashBufferService {
|
|
|
27264
27264
|
const [rrweb, spans, attrs] = await Promise.all([
|
|
27265
27265
|
this._safe(() => this.db.getRrwebEventsWindow(this.tabId, rrwebFromTs, toTs), []),
|
|
27266
27266
|
this._safe(() => this.db.getOtelSpansWindow(this.tabId, fromTs, toTs), []),
|
|
27267
|
-
this._safe(() => this.db.getAttrs(this.tabId), null)
|
|
27267
|
+
this._safe(() => this.db.getAttrs(this.tabId), null),
|
|
27268
27268
|
]);
|
|
27269
27269
|
const rrwebSorted = rrweb
|
|
27270
27270
|
.sort((a, b) => a.ts - b.ts)
|
|
@@ -27285,12 +27285,12 @@ class CrashBufferService {
|
|
|
27285
27285
|
? {
|
|
27286
27286
|
sessionAttributes: attrs.sessionAttributes,
|
|
27287
27287
|
resourceAttributes: attrs.resourceAttributes,
|
|
27288
|
-
userAttributes: attrs.userAttributes
|
|
27288
|
+
userAttributes: attrs.userAttributes,
|
|
27289
27289
|
}
|
|
27290
27290
|
: null,
|
|
27291
27291
|
windowMs: this.windowMs,
|
|
27292
27292
|
fromTs: replayStartTs,
|
|
27293
|
-
toTs
|
|
27293
|
+
toTs,
|
|
27294
27294
|
};
|
|
27295
27295
|
}
|
|
27296
27296
|
async clear() {
|
|
@@ -27444,7 +27444,7 @@ class IndexedDBService {
|
|
|
27444
27444
|
const db = await this.dbPromise;
|
|
27445
27445
|
const payload = {
|
|
27446
27446
|
...attrs,
|
|
27447
|
-
updatedAt: (_a = attrs.updatedAt) !== null && _a !== void 0 ? _a : Date.now()
|
|
27447
|
+
updatedAt: (_a = attrs.updatedAt) !== null && _a !== void 0 ? _a : Date.now(),
|
|
27448
27448
|
};
|
|
27449
27449
|
return new Promise((resolve, reject) => {
|
|
27450
27450
|
const tx = db.transaction(attrsStore, 'readwrite');
|
|
@@ -27687,7 +27687,7 @@ class IndexedDBService {
|
|
|
27687
27687
|
const r = attr.delete(tabId);
|
|
27688
27688
|
r.onsuccess = () => res();
|
|
27689
27689
|
r.onerror = () => rej(r.error);
|
|
27690
|
-
})
|
|
27690
|
+
}),
|
|
27691
27691
|
])
|
|
27692
27692
|
.then(() => {
|
|
27693
27693
|
// noop
|
|
@@ -31041,13 +31041,13 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
|
|
|
31041
31041
|
this.generateShortId = (0,_sdk__WEBPACK_IMPORTED_MODULE_1__.getIdGenerator)(8);
|
|
31042
31042
|
this.sessionShortId = '';
|
|
31043
31043
|
this.clientId = '';
|
|
31044
|
-
this.sessionType
|
|
31044
|
+
this.sessionType;
|
|
31045
31045
|
}
|
|
31046
31046
|
SessionRecorderIdGenerator.prototype.generateTraceId = function () {
|
|
31047
31047
|
var traceId = this.generateLongId();
|
|
31048
|
-
if (!this.sessionShortId
|
|
31049
|
-
&& !this.
|
|
31050
|
-
|
|
31048
|
+
if ((!this.sessionShortId
|
|
31049
|
+
&& !this.clientId)
|
|
31050
|
+
|| !this.sessionType) {
|
|
31051
31051
|
return traceId;
|
|
31052
31052
|
}
|
|
31053
31053
|
var sessionTypePrefix = _constants_constants_base__WEBPACK_IMPORTED_MODULE_2__.MULTIPLAYER_TRACE_PREFIX_MAP[this.sessionType];
|
|
@@ -31059,7 +31059,6 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
|
|
|
31059
31059
|
return this.generateShortId();
|
|
31060
31060
|
};
|
|
31061
31061
|
SessionRecorderIdGenerator.prototype.setSessionId = function (sessionShortId, sessionType, clientId) {
|
|
31062
|
-
if (sessionType === void 0) { sessionType = _type__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL; }
|
|
31063
31062
|
if (clientId === void 0) { clientId = ''; }
|
|
31064
31063
|
if (!clientId &&
|
|
31065
31064
|
[
|
|
@@ -31427,7 +31426,7 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
31427
31426
|
window.postMessage({
|
|
31428
31427
|
action: 'traces',
|
|
31429
31428
|
type: this.postMessageType,
|
|
31430
|
-
payload: spans.map(function (span) { return _this.serializeSpan(span); })
|
|
31429
|
+
payload: spans.map(function (span) { return _this.serializeSpan(span); }),
|
|
31431
31430
|
}, this.postMessageTargetOrigin);
|
|
31432
31431
|
resultCallback({ code: 0 });
|
|
31433
31432
|
}
|
|
@@ -31445,7 +31444,7 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
31445
31444
|
headers: __assign(__assign({ 'Content-Type': 'application/json' }, (this.config.apiKey ? { Authorization: this.config.apiKey } : {})), (this.config.headers || {})),
|
|
31446
31445
|
timeoutMillis: this.config.timeoutMillis,
|
|
31447
31446
|
keepAlive: this.config.keepAlive,
|
|
31448
|
-
concurrencyLimit: this.config.concurrencyLimit
|
|
31447
|
+
concurrencyLimit: this.config.concurrencyLimit,
|
|
31449
31448
|
});
|
|
31450
31449
|
};
|
|
31451
31450
|
SessionRecorderBrowserTraceExporter.prototype.setApiKey = function (apiKey) {
|