@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/browser/index.js
CHANGED
|
@@ -25243,7 +25243,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
|
|
|
25243
25243
|
const SESSION_RESPONSE = 'multiplayer-debug-session-response';
|
|
25244
25244
|
const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
25245
25245
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
25246
|
-
const PACKAGE_VERSION_EXPORT = "1.2.
|
|
25246
|
+
const PACKAGE_VERSION_EXPORT = "1.2.27" || 0;
|
|
25247
25247
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
25248
25248
|
const OTEL_IGNORE_URLS = [
|
|
25249
25249
|
// Traces endpoint
|
|
@@ -26313,33 +26313,40 @@ class TracerBrowserSDK {
|
|
|
26313
26313
|
* If there is an active span, the exception will be recorded on it.
|
|
26314
26314
|
* Otherwise, a short-lived span will be created to hold the exception event.
|
|
26315
26315
|
*/
|
|
26316
|
-
captureException(error) {
|
|
26316
|
+
captureException(error, errorInfo) {
|
|
26317
26317
|
if (!error)
|
|
26318
26318
|
return;
|
|
26319
|
-
//
|
|
26320
|
-
|
|
26321
|
-
|
|
26322
|
-
|
|
26319
|
+
// Prefer attaching to the active span to keep correlation intact
|
|
26320
|
+
try {
|
|
26321
|
+
const activeSpan = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_10__.trace.getSpan(_opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__.context.active());
|
|
26322
|
+
if (activeSpan) {
|
|
26323
|
+
// Standard OTEL exception event + span status
|
|
26323
26324
|
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.captureException(error);
|
|
26325
|
+
activeSpan.addEvent('exception', {
|
|
26326
|
+
'exception.type': error.name || 'Error',
|
|
26327
|
+
'exception.message': error.message,
|
|
26328
|
+
'exception.stacktrace': error.stack || '',
|
|
26329
|
+
...(errorInfo || {}),
|
|
26330
|
+
});
|
|
26324
26331
|
return;
|
|
26325
26332
|
}
|
|
26326
|
-
catch (_e) {
|
|
26327
|
-
// fallthrough to creating a dedicated span
|
|
26328
|
-
}
|
|
26329
26333
|
}
|
|
26334
|
+
catch (_ignored) { }
|
|
26335
|
+
// Fallback: create a short-lived span to hold the exception details
|
|
26330
26336
|
try {
|
|
26331
|
-
const tracer = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_10__.trace.getTracer('
|
|
26332
|
-
const span = tracer.startSpan('
|
|
26337
|
+
const tracer = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_10__.trace.getTracer('exception');
|
|
26338
|
+
const span = tracer.startSpan(error.name || 'Error');
|
|
26333
26339
|
span.recordException(error);
|
|
26334
26340
|
span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_12__.SpanStatusCode.ERROR, message: error.message });
|
|
26341
|
+
span.addEvent('exception', {
|
|
26342
|
+
'exception.type': error.name || 'Error',
|
|
26343
|
+
'exception.message': error.message,
|
|
26344
|
+
'exception.stacktrace': error.stack || '',
|
|
26345
|
+
...(errorInfo || {}),
|
|
26346
|
+
});
|
|
26335
26347
|
span.end();
|
|
26336
26348
|
}
|
|
26337
|
-
catch (
|
|
26338
|
-
// eslint-disable-next-line no-console
|
|
26339
|
-
if (true) {
|
|
26340
|
-
console.warn('[MULTIPLAYER_SESSION_RECORDER] Failed to capture exception', _err);
|
|
26341
|
-
}
|
|
26342
|
-
}
|
|
26349
|
+
catch (_ignored) { }
|
|
26343
26350
|
}
|
|
26344
26351
|
_getSpanSessionIdProcessor() {
|
|
26345
26352
|
return {
|
|
@@ -27588,10 +27595,11 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
|
|
|
27588
27595
|
/**
|
|
27589
27596
|
* Capture an exception manually and send it as an error trace.
|
|
27590
27597
|
*/
|
|
27591
|
-
captureException(error) {
|
|
27598
|
+
captureException(error, errorInfo) {
|
|
27592
27599
|
try {
|
|
27593
27600
|
const normalizedError = this._normalizeError(error);
|
|
27594
|
-
this.
|
|
27601
|
+
const normalizedErrorInfo = this._normalizeErrorInfo(errorInfo);
|
|
27602
|
+
this._tracer.captureException(normalizedError, normalizedErrorInfo);
|
|
27595
27603
|
}
|
|
27596
27604
|
catch (e) {
|
|
27597
27605
|
this.error = (e === null || e === void 0 ? void 0 : e.message) || 'Failed to capture exception';
|
|
@@ -27856,6 +27864,16 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
|
|
|
27856
27864
|
return new Error(String(error));
|
|
27857
27865
|
}
|
|
27858
27866
|
}
|
|
27867
|
+
_normalizeErrorInfo(errorInfo) {
|
|
27868
|
+
if (!errorInfo)
|
|
27869
|
+
return {};
|
|
27870
|
+
try {
|
|
27871
|
+
return JSON.parse(JSON.stringify(errorInfo));
|
|
27872
|
+
}
|
|
27873
|
+
catch (_e) {
|
|
27874
|
+
return { errorInfo: String(errorInfo) };
|
|
27875
|
+
}
|
|
27876
|
+
}
|
|
27859
27877
|
}
|
|
27860
27878
|
|
|
27861
27879
|
|