@multiplayer-app/session-recorder-browser 1.3.32 → 1.3.34

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/index.umd.js CHANGED
@@ -24326,7 +24326,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
24326
24326
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
24327
24327
  const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
24328
24328
  const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
24329
- const PACKAGE_VERSION_EXPORT = "1.3.32" || 0;
24329
+ const PACKAGE_VERSION_EXPORT = "1.3.34" || 0;
24330
24330
  // Regex patterns for OpenTelemetry ignore URLs
24331
24331
  const OTEL_IGNORE_URLS = [
24332
24332
  // Traces endpoint
@@ -24423,7 +24423,7 @@ const BASE_CONFIG = {
24423
24423
  widgetTextOverrides: DEFAULT_WIDGET_TEXT_CONFIG,
24424
24424
  useWebsocket: true,
24425
24425
  buffering: {
24426
- enabled: true,
24426
+ enabled: false,
24427
24427
  windowMinutes: 0.5,
24428
24428
  snapshotIntervalMs: 20000
24429
24429
  }
@@ -30811,7 +30811,8 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
30811
30811
 
30812
30812
  "use strict";
30813
30813
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
30814
- /* harmony export */ captureException: () => (/* binding */ captureException)
30814
+ /* harmony export */ captureException: () => (/* binding */ captureException),
30815
+ /* harmony export */ shouldCaptureException: () => (/* binding */ shouldCaptureException)
30815
30816
  /* harmony export */ });
30816
30817
  /* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/context-api.js");
30817
30818
  /* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
@@ -30845,6 +30846,17 @@ var __read = (undefined && undefined.__read) || function (o, n) {
30845
30846
  }
30846
30847
  return ar;
30847
30848
  };
30849
+ var __values = (undefined && undefined.__values) || function(o) {
30850
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
30851
+ if (m) return m.call(o);
30852
+ if (o && typeof o.length === "number") return {
30853
+ next: function () {
30854
+ if (o && i >= o.length) o = void 0;
30855
+ return { value: o && o[i++], done: !o };
30856
+ }
30857
+ };
30858
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
30859
+ };
30848
30860
 
30849
30861
 
30850
30862
 
@@ -30855,7 +30867,7 @@ var __read = (undefined && undefined.__read) || function (o, n) {
30855
30867
  */
30856
30868
  var captureException = function (error, errorInfo) {
30857
30869
  var _a, _b;
30858
- if (!error) {
30870
+ if (!error || !shouldCaptureException(error)) {
30859
30871
  return;
30860
30872
  }
30861
30873
  var activeContext = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.context.active();
@@ -30863,7 +30875,7 @@ var captureException = function (error, errorInfo) {
30863
30875
  var isNewSpan = false;
30864
30876
  if (!span || !span.isRecording()) {
30865
30877
  span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.getTracer('exception').startSpan(error.name || 'Error', {
30866
- attributes: __assign((_a = {}, _a[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_MESSAGE] = error.message, _a[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_STACKTRACE] = error.stack, _a[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_TYPE] = error.name, _a), (0,_set_resource_attributes__WEBPACK_IMPORTED_MODULE_0__.getResourceAttributes)()),
30878
+ attributes: __assign((_a = {}, _a[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_MESSAGE] = error.message, _a[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_STACKTRACE] = error.stack, _a[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_TYPE] = error.name, _a), (0,_set_resource_attributes__WEBPACK_IMPORTED_MODULE_0__.getResourceAttributes)())
30867
30879
  });
30868
30880
  _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.setSpan(activeContext, span);
30869
30881
  isNewSpan = true;
@@ -30884,12 +30896,57 @@ var captureException = function (error, errorInfo) {
30884
30896
  span.recordException(error);
30885
30897
  span.setStatus({
30886
30898
  code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
30887
- message: error.message,
30899
+ message: error.message
30888
30900
  });
30889
30901
  if (isNewSpan) {
30890
30902
  span.end();
30891
30903
  }
30892
30904
  };
30905
+ /**
30906
+ * Best-effort deduplication of exceptions that fire multiple times
30907
+ * (e.g. framework handler + global handlers) within a short time window.
30908
+ */
30909
+ var exceptionDedupeWindowMs = 2000;
30910
+ var recentExceptionFingerprints = new Map();
30911
+ var shouldCaptureException = function (error, _errorInfo) {
30912
+ var e_1, _a;
30913
+ if (!error)
30914
+ return false;
30915
+ var now = Date.now();
30916
+ // Build a fingerprint that is stable enough across repeated emissions
30917
+ // but not so broad that different errors collapse into one.
30918
+ var keyParts = [];
30919
+ keyParts.push(error.name || 'Error');
30920
+ keyParts.push(error.message || '');
30921
+ // First stack line tends to include file/line where it originated.
30922
+ if (typeof error.stack === 'string') {
30923
+ var firstFrame = error.stack.split('\n')[1] || '';
30924
+ keyParts.push(firstFrame.trim());
30925
+ }
30926
+ var fingerprint = keyParts.join('|').slice(0, 500);
30927
+ var lastSeen = recentExceptionFingerprints.get(fingerprint);
30928
+ if (lastSeen && now - lastSeen < exceptionDedupeWindowMs) {
30929
+ return false;
30930
+ }
30931
+ recentExceptionFingerprints.set(fingerprint, now);
30932
+ try {
30933
+ // Cheap cleanup of old entries to avoid unbounded growth.
30934
+ for (var recentExceptionFingerprints_1 = __values(recentExceptionFingerprints), recentExceptionFingerprints_1_1 = recentExceptionFingerprints_1.next(); !recentExceptionFingerprints_1_1.done; recentExceptionFingerprints_1_1 = recentExceptionFingerprints_1.next()) {
30935
+ var _b = __read(recentExceptionFingerprints_1_1.value, 2), key = _b[0], ts = _b[1];
30936
+ if (now - ts > exceptionDedupeWindowMs * 5) {
30937
+ recentExceptionFingerprints.delete(key);
30938
+ }
30939
+ }
30940
+ }
30941
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
30942
+ finally {
30943
+ try {
30944
+ if (recentExceptionFingerprints_1_1 && !recentExceptionFingerprints_1_1.done && (_a = recentExceptionFingerprints_1.return)) _a.call(recentExceptionFingerprints_1);
30945
+ }
30946
+ finally { if (e_1) throw e_1.error; }
30947
+ }
30948
+ return true;
30949
+ };
30893
30950
  //# sourceMappingURL=capture-exception.js.map
30894
30951
 
30895
30952
  /***/ }),
@@ -30949,7 +31006,8 @@ __webpack_require__.r(__webpack_exports__);
30949
31006
  /* harmony export */ setMessageBody: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setMessageBody),
30950
31007
  /* harmony export */ setResourceAttributes: () => (/* reexport safe */ _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__.setResourceAttributes),
30951
31008
  /* harmony export */ setRpcRequestMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcRequestMessage),
30952
- /* harmony export */ setRpcResponseMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcResponseMessage)
31009
+ /* harmony export */ setRpcResponseMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcResponseMessage),
31010
+ /* harmony export */ shouldCaptureException: () => (/* reexport safe */ _capture_exception__WEBPACK_IMPORTED_MODULE_4__.shouldCaptureException)
30953
31011
  /* harmony export */ });
30954
31012
  /* harmony import */ var _mask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mask */ "../session-recorder-common/dist/esm/sdk/mask.js");
30955
31013
  /* harmony import */ var _schemify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./schemify */ "../session-recorder-common/dist/esm/sdk/schemify.js");