@multiplayer-app/session-recorder-browser 1.2.26 → 1.2.27
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 +37 -19
- package/dist/browser/index.js.map +1 -1
- package/dist/exporters/index.js +1 -1
- package/dist/exporters/index.js.map +1 -1
- package/dist/index.js +37 -19
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +37 -19
- package/dist/index.umd.js.map +1 -1
- package/dist/otel/index.d.ts +1 -1
- package/dist/otel/index.d.ts.map +1 -1
- package/dist/otel/index.js +23 -16
- package/dist/otel/index.js.map +1 -1
- package/dist/sessionRecorder.d.ts +2 -1
- package/dist/sessionRecorder.d.ts.map +1 -1
- package/dist/sessionRecorder.js +14 -3
- package/dist/sessionRecorder.js.map +1 -1
- package/dist/types/sessionRecorder.d.ts +1 -1
- package/dist/types/sessionRecorder.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -24284,7 +24284,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
|
|
|
24284
24284
|
const SESSION_RESPONSE = 'multiplayer-debug-session-response';
|
|
24285
24285
|
const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
24286
24286
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
24287
|
-
const PACKAGE_VERSION_EXPORT = "1.2.
|
|
24287
|
+
const PACKAGE_VERSION_EXPORT = "1.2.27" || 0;
|
|
24288
24288
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
24289
24289
|
const OTEL_IGNORE_URLS = [
|
|
24290
24290
|
// Traces endpoint
|
|
@@ -25315,33 +25315,40 @@ class TracerBrowserSDK {
|
|
|
25315
25315
|
* If there is an active span, the exception will be recorded on it.
|
|
25316
25316
|
* Otherwise, a short-lived span will be created to hold the exception event.
|
|
25317
25317
|
*/
|
|
25318
|
-
captureException(error) {
|
|
25318
|
+
captureException(error, errorInfo) {
|
|
25319
25319
|
if (!error)
|
|
25320
25320
|
return;
|
|
25321
|
-
//
|
|
25322
|
-
|
|
25323
|
-
|
|
25324
|
-
|
|
25321
|
+
// Prefer attaching to the active span to keep correlation intact
|
|
25322
|
+
try {
|
|
25323
|
+
const activeSpan = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_10__.trace.getSpan(_opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__.context.active());
|
|
25324
|
+
if (activeSpan) {
|
|
25325
|
+
// Standard OTEL exception event + span status
|
|
25325
25326
|
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.captureException(error);
|
|
25327
|
+
activeSpan.addEvent('exception', {
|
|
25328
|
+
'exception.type': error.name || 'Error',
|
|
25329
|
+
'exception.message': error.message,
|
|
25330
|
+
'exception.stacktrace': error.stack || '',
|
|
25331
|
+
...(errorInfo || {}),
|
|
25332
|
+
});
|
|
25326
25333
|
return;
|
|
25327
25334
|
}
|
|
25328
|
-
catch (_e) {
|
|
25329
|
-
// fallthrough to creating a dedicated span
|
|
25330
|
-
}
|
|
25331
25335
|
}
|
|
25336
|
+
catch (_ignored) { }
|
|
25337
|
+
// Fallback: create a short-lived span to hold the exception details
|
|
25332
25338
|
try {
|
|
25333
|
-
const tracer = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_10__.trace.getTracer('
|
|
25334
|
-
const span = tracer.startSpan('
|
|
25339
|
+
const tracer = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_10__.trace.getTracer('exception');
|
|
25340
|
+
const span = tracer.startSpan(error.name || 'Error');
|
|
25335
25341
|
span.recordException(error);
|
|
25336
25342
|
span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_12__.SpanStatusCode.ERROR, message: error.message });
|
|
25343
|
+
span.addEvent('exception', {
|
|
25344
|
+
'exception.type': error.name || 'Error',
|
|
25345
|
+
'exception.message': error.message,
|
|
25346
|
+
'exception.stacktrace': error.stack || '',
|
|
25347
|
+
...(errorInfo || {}),
|
|
25348
|
+
});
|
|
25337
25349
|
span.end();
|
|
25338
25350
|
}
|
|
25339
|
-
catch (
|
|
25340
|
-
// eslint-disable-next-line no-console
|
|
25341
|
-
if (true) {
|
|
25342
|
-
console.warn('[MULTIPLAYER_SESSION_RECORDER] Failed to capture exception', _err);
|
|
25343
|
-
}
|
|
25344
|
-
}
|
|
25351
|
+
catch (_ignored) { }
|
|
25345
25352
|
}
|
|
25346
25353
|
_getSpanSessionIdProcessor() {
|
|
25347
25354
|
return {
|
|
@@ -26571,10 +26578,11 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
|
|
|
26571
26578
|
/**
|
|
26572
26579
|
* Capture an exception manually and send it as an error trace.
|
|
26573
26580
|
*/
|
|
26574
|
-
captureException(error) {
|
|
26581
|
+
captureException(error, errorInfo) {
|
|
26575
26582
|
try {
|
|
26576
26583
|
const normalizedError = this._normalizeError(error);
|
|
26577
|
-
this.
|
|
26584
|
+
const normalizedErrorInfo = this._normalizeErrorInfo(errorInfo);
|
|
26585
|
+
this._tracer.captureException(normalizedError, normalizedErrorInfo);
|
|
26578
26586
|
}
|
|
26579
26587
|
catch (e) {
|
|
26580
26588
|
this.error = (e === null || e === void 0 ? void 0 : e.message) || 'Failed to capture exception';
|
|
@@ -26839,6 +26847,16 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
|
|
|
26839
26847
|
return new Error(String(error));
|
|
26840
26848
|
}
|
|
26841
26849
|
}
|
|
26850
|
+
_normalizeErrorInfo(errorInfo) {
|
|
26851
|
+
if (!errorInfo)
|
|
26852
|
+
return {};
|
|
26853
|
+
try {
|
|
26854
|
+
return JSON.parse(JSON.stringify(errorInfo));
|
|
26855
|
+
}
|
|
26856
|
+
catch (_e) {
|
|
26857
|
+
return { errorInfo: String(errorInfo) };
|
|
26858
|
+
}
|
|
26859
|
+
}
|
|
26842
26860
|
}
|
|
26843
26861
|
|
|
26844
26862
|
|