@multiplayer-app/session-recorder-browser 1.3.31 → 1.3.33
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 +3 -3
- package/dist/browser/index.js +363 -352
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +8 -8
- package/dist/config/defaults.js.map +1 -1
- package/dist/exporters/index.js +1 -1
- package/dist/exporters/index.js.map +1 -1
- package/dist/index.js +361 -352
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +362 -352
- package/dist/index.umd.js.map +1 -1
- package/dist/otel/CrashBufferSpanProcessor.js +2 -2
- package/dist/otel/index.d.ts +2 -3
- package/dist/otel/index.d.ts.map +1 -1
- package/dist/otel/index.js +63 -163
- package/dist/otel/index.js.map +1 -1
- package/dist/otel/instrumentations/index.d.ts +3 -0
- package/dist/otel/instrumentations/index.d.ts.map +1 -0
- package/dist/otel/instrumentations/index.js +104 -0
- package/dist/otel/instrumentations/index.js.map +1 -0
- package/dist/rrweb/index.d.ts.map +1 -1
- package/dist/rrweb/index.js +7 -7
- package/dist/rrweb/index.js.map +1 -1
- package/dist/services/api.service.d.ts +2 -0
- package/dist/services/api.service.d.ts.map +1 -1
- package/dist/services/api.service.js +5 -5
- package/dist/services/api.service.js.map +1 -1
- package/dist/services/crashBuffer.service.d.ts +1 -2
- package/dist/services/crashBuffer.service.d.ts.map +1 -1
- package/dist/services/crashBuffer.service.js +33 -73
- package/dist/services/crashBuffer.service.js.map +1 -1
- package/dist/services/indexedDb.service.js +2 -2
- package/dist/services/indexedDb.service.js.map +1 -1
- package/dist/services/socket.service.d.ts.map +1 -1
- package/dist/services/socket.service.js +10 -17
- package/dist/services/socket.service.js.map +1 -1
- package/dist/session-recorder.d.ts.map +1 -1
- package/dist/session-recorder.js +29 -49
- package/dist/session-recorder.js.map +1 -1
- package/dist/types/session-recorder.d.ts +3 -3
- package/dist/types/session-recorder.d.ts.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.33" || 0;
|
|
25058
25058
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
25059
25059
|
const OTEL_IGNORE_URLS = [
|
|
25060
25060
|
// Traces endpoint
|
|
@@ -25104,7 +25104,7 @@ const DEFAULT_MASKING_CONFIG = {
|
|
|
25104
25104
|
maskBodyFieldsList: sensitiveFields,
|
|
25105
25105
|
maskHeadersList: sensitiveHeaders,
|
|
25106
25106
|
headersToInclude: [],
|
|
25107
|
-
headersToExclude: []
|
|
25107
|
+
headersToExclude: []
|
|
25108
25108
|
};
|
|
25109
25109
|
const DEFAULT_WIDGET_TEXT_CONFIG = {
|
|
25110
25110
|
initialTitleWithContinuous: 'Encountered an issue?',
|
|
@@ -25126,7 +25126,7 @@ const DEFAULT_WIDGET_TEXT_CONFIG = {
|
|
|
25126
25126
|
submitDialogCommentLabel: 'You can also add context, comments, or notes.',
|
|
25127
25127
|
submitDialogCommentPlaceholder: 'Add a message...',
|
|
25128
25128
|
submitDialogSubmitText: 'Save',
|
|
25129
|
-
submitDialogCancelText: 'Cancel'
|
|
25129
|
+
submitDialogCancelText: 'Cancel'
|
|
25130
25130
|
};
|
|
25131
25131
|
const BASE_CONFIG = {
|
|
25132
25132
|
apiKey: '',
|
|
@@ -25153,9 +25153,9 @@ const BASE_CONFIG = {
|
|
|
25153
25153
|
useWebsocket: true,
|
|
25154
25154
|
buffering: {
|
|
25155
25155
|
enabled: true,
|
|
25156
|
-
windowMinutes:
|
|
25157
|
-
snapshotIntervalMs:
|
|
25158
|
-
}
|
|
25156
|
+
windowMinutes: 0.5,
|
|
25157
|
+
snapshotIntervalMs: 20000
|
|
25158
|
+
}
|
|
25159
25159
|
};
|
|
25160
25160
|
|
|
25161
25161
|
|
|
@@ -25777,8 +25777,8 @@ class CrashBufferSpanProcessor {
|
|
|
25777
25777
|
this._crashBuffer.appendSpans([
|
|
25778
25778
|
{
|
|
25779
25779
|
ts: span.startTime[0] * 1000 + span.startTime[1] / 1000000,
|
|
25780
|
-
span: this._serializeSpan(span)
|
|
25781
|
-
}
|
|
25780
|
+
span: this._serializeSpan(span)
|
|
25781
|
+
}
|
|
25782
25782
|
]);
|
|
25783
25783
|
}
|
|
25784
25784
|
return;
|
|
@@ -26034,18 +26034,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26034
26034
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26035
26035
|
/* harmony export */ TracerBrowserSDK: () => (/* binding */ TracerBrowserSDK)
|
|
26036
26036
|
/* harmony export */ });
|
|
26037
|
-
/* harmony import */ var
|
|
26038
|
-
/* harmony import */ var
|
|
26039
|
-
/* harmony import */ var
|
|
26040
|
-
/* harmony import */ var
|
|
26041
|
-
/* harmony import */ var
|
|
26042
|
-
/* harmony import */ var
|
|
26043
|
-
/* harmony import */ var
|
|
26044
|
-
/* harmony import */ var
|
|
26045
|
-
/* harmony import */ var
|
|
26046
|
-
/* harmony import */ var
|
|
26047
|
-
/* harmony import */ var _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CrashBufferSpanProcessor */ "./src/otel/CrashBufferSpanProcessor.ts");
|
|
26048
|
-
|
|
26037
|
+
/* harmony import */ var _opentelemetry_resources__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @opentelemetry/resources */ "../../node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js");
|
|
26038
|
+
/* harmony import */ var _opentelemetry_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @opentelemetry/core */ "../../node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js");
|
|
26039
|
+
/* harmony import */ var _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @opentelemetry/sdk-trace-web */ "../../node_modules/@opentelemetry/sdk-trace-web/build/esm/WebTracerProvider.js");
|
|
26040
|
+
/* harmony import */ var _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @opentelemetry/sdk-trace-base */ "../../node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js");
|
|
26041
|
+
/* harmony import */ var _opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @opentelemetry/semantic-conventions */ "../../node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js");
|
|
26042
|
+
/* harmony import */ var _opentelemetry_instrumentation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @opentelemetry/instrumentation */ "../../node_modules/@opentelemetry/instrumentation/build/esm/autoLoader.js");
|
|
26043
|
+
/* harmony import */ var _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiplayer-app/session-recorder-common */ "../session-recorder-common/dist/esm/index-browser.js");
|
|
26044
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "./src/otel/helpers.ts");
|
|
26045
|
+
/* harmony import */ var _instrumentations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./instrumentations */ "./src/otel/instrumentations/index.ts");
|
|
26046
|
+
/* harmony import */ var _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CrashBufferSpanProcessor */ "./src/otel/CrashBufferSpanProcessor.ts");
|
|
26049
26047
|
|
|
26050
26048
|
|
|
26051
26049
|
|
|
@@ -26056,14 +26054,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26056
26054
|
|
|
26057
26055
|
|
|
26058
26056
|
|
|
26059
|
-
const clientIdGenerator =
|
|
26057
|
+
const clientIdGenerator = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionRecorderSdk.getIdGenerator(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CLIENT_ID_LENGTH);
|
|
26060
26058
|
class TracerBrowserSDK {
|
|
26061
26059
|
constructor() {
|
|
26062
26060
|
this.clientId = '';
|
|
26063
26061
|
this.sessionId = '';
|
|
26064
26062
|
this.globalErrorListenersRegistered = false;
|
|
26065
26063
|
}
|
|
26066
|
-
_setSessionId(sessionId, sessionType =
|
|
26064
|
+
_setSessionId(sessionId, sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL) {
|
|
26067
26065
|
this.sessionId = sessionId;
|
|
26068
26066
|
if (!this.idGenerator) {
|
|
26069
26067
|
throw new Error('Id generator not initialized');
|
|
@@ -26074,133 +26072,35 @@ class TracerBrowserSDK {
|
|
|
26074
26072
|
this.config = options;
|
|
26075
26073
|
this.clientId = clientIdGenerator();
|
|
26076
26074
|
const { application, version, environment } = this.config;
|
|
26077
|
-
this.idGenerator = new
|
|
26078
|
-
this._setSessionId('',
|
|
26079
|
-
this.exporter = new
|
|
26075
|
+
this.idGenerator = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionRecorderIdGenerator();
|
|
26076
|
+
this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.SESSION_CACHE);
|
|
26077
|
+
this.exporter = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionRecorderBrowserTraceExporter({
|
|
26080
26078
|
apiKey: options.apiKey,
|
|
26081
|
-
url: (0,
|
|
26082
|
-
usePostMessageFallback: options.usePostMessageFallback
|
|
26079
|
+
url: (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.getExporterEndpoint)(options.exporterEndpoint),
|
|
26080
|
+
usePostMessageFallback: options.usePostMessageFallback
|
|
26083
26081
|
});
|
|
26084
|
-
const resourceAttributes = (0,
|
|
26085
|
-
[
|
|
26086
|
-
[
|
|
26087
|
-
[
|
|
26082
|
+
const resourceAttributes = (0,_opentelemetry_resources__WEBPACK_IMPORTED_MODULE_4__.resourceFromAttributes)({
|
|
26083
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_5__.SEMRESATTRS_SERVICE_NAME]: application,
|
|
26084
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_5__.SEMRESATTRS_SERVICE_VERSION]: version,
|
|
26085
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_5__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment
|
|
26088
26086
|
});
|
|
26089
|
-
|
|
26090
|
-
this.tracerProvider = new
|
|
26087
|
+
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionRecorderSdk.setResourceAttributes(resourceAttributes.attributes);
|
|
26088
|
+
this.tracerProvider = new _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_6__.WebTracerProvider({
|
|
26091
26089
|
resource: resourceAttributes,
|
|
26092
26090
|
idGenerator: this.idGenerator,
|
|
26093
|
-
sampler: new
|
|
26091
|
+
sampler: new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio),
|
|
26094
26092
|
spanProcessors: [
|
|
26095
26093
|
this._getSpanSessionIdProcessor(),
|
|
26096
|
-
new
|
|
26097
|
-
new
|
|
26098
|
-
]
|
|
26094
|
+
new _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_7__.BatchSpanProcessor(this.exporter),
|
|
26095
|
+
new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_3__.CrashBufferSpanProcessor(this.crashBuffer, this.exporter.serializeSpan)
|
|
26096
|
+
]
|
|
26099
26097
|
});
|
|
26100
26098
|
this.tracerProvider.register({
|
|
26101
|
-
|
|
26102
|
-
propagator: new _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__.W3CTraceContextPropagator(),
|
|
26099
|
+
propagator: new _opentelemetry_core__WEBPACK_IMPORTED_MODULE_8__.W3CTraceContextPropagator()
|
|
26103
26100
|
});
|
|
26104
|
-
(0,
|
|
26101
|
+
(0,_opentelemetry_instrumentation__WEBPACK_IMPORTED_MODULE_9__.registerInstrumentations)({
|
|
26105
26102
|
tracerProvider: this.tracerProvider,
|
|
26106
|
-
instrumentations:
|
|
26107
|
-
(0,_opentelemetry_auto_instrumentations_web__WEBPACK_IMPORTED_MODULE_0__.getWebAutoInstrumentations)({
|
|
26108
|
-
'@opentelemetry/instrumentation-xml-http-request': {
|
|
26109
|
-
clearTimingResources: true,
|
|
26110
|
-
ignoreUrls: [..._config__WEBPACK_IMPORTED_MODULE_2__.OTEL_IGNORE_URLS, ...(this.config.ignoreUrls || [])],
|
|
26111
|
-
propagateTraceHeaderCorsUrls: options.propagateTraceHeaderCorsUrls,
|
|
26112
|
-
applyCustomAttributesOnSpan: (span, xhr) => {
|
|
26113
|
-
if (!this.config)
|
|
26114
|
-
return;
|
|
26115
|
-
const { captureBody, captureHeaders } = this.config;
|
|
26116
|
-
try {
|
|
26117
|
-
if (!captureBody && !captureHeaders) {
|
|
26118
|
-
return;
|
|
26119
|
-
}
|
|
26120
|
-
// @ts-ignore
|
|
26121
|
-
const networkRequest = xhr.networkRequest;
|
|
26122
|
-
const requestBody = networkRequest.requestBody;
|
|
26123
|
-
const responseBody = networkRequest.responseBody;
|
|
26124
|
-
const requestHeaders = networkRequest.requestHeaders || {};
|
|
26125
|
-
const responseHeaders = networkRequest.responseHeaders || {};
|
|
26126
|
-
const payload = {
|
|
26127
|
-
requestBody,
|
|
26128
|
-
responseBody,
|
|
26129
|
-
requestHeaders,
|
|
26130
|
-
responseHeaders,
|
|
26131
|
-
};
|
|
26132
|
-
(0,_helpers__WEBPACK_IMPORTED_MODULE_3__.processHttpPayload)(payload, this.config, span);
|
|
26133
|
-
}
|
|
26134
|
-
catch (error) {
|
|
26135
|
-
// eslint-disable-next-line
|
|
26136
|
-
console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture xml-http payload', error);
|
|
26137
|
-
}
|
|
26138
|
-
},
|
|
26139
|
-
},
|
|
26140
|
-
'@opentelemetry/instrumentation-fetch': {
|
|
26141
|
-
clearTimingResources: true,
|
|
26142
|
-
ignoreUrls: [..._config__WEBPACK_IMPORTED_MODULE_2__.OTEL_IGNORE_URLS, ...(this.config.ignoreUrls || [])],
|
|
26143
|
-
propagateTraceHeaderCorsUrls: options.propagateTraceHeaderCorsUrls,
|
|
26144
|
-
applyCustomAttributesOnSpan: async (span, request, response) => {
|
|
26145
|
-
if (!this.config)
|
|
26146
|
-
return;
|
|
26147
|
-
const { captureBody, captureHeaders } = this.config;
|
|
26148
|
-
try {
|
|
26149
|
-
if (!captureBody && !captureHeaders) {
|
|
26150
|
-
return;
|
|
26151
|
-
}
|
|
26152
|
-
// Try to get data from our fetch wrapper first
|
|
26153
|
-
// @ts-ignore
|
|
26154
|
-
const networkRequest = response === null || response === void 0 ? void 0 : response.networkRequest;
|
|
26155
|
-
let requestBody = null;
|
|
26156
|
-
let responseBody = null;
|
|
26157
|
-
let requestHeaders = {};
|
|
26158
|
-
let responseHeaders = {};
|
|
26159
|
-
if (networkRequest) {
|
|
26160
|
-
// Use data captured by our fetch wrapper
|
|
26161
|
-
requestBody = networkRequest.requestBody;
|
|
26162
|
-
responseBody = networkRequest.responseBody;
|
|
26163
|
-
requestHeaders = networkRequest.requestHeaders || {};
|
|
26164
|
-
responseHeaders = networkRequest.responseHeaders || {};
|
|
26165
|
-
}
|
|
26166
|
-
else {
|
|
26167
|
-
// Fallback to original OpenTelemetry approach
|
|
26168
|
-
requestBody = request.body;
|
|
26169
|
-
requestHeaders = (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.headersToObject)(request.headers);
|
|
26170
|
-
responseHeaders = (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.headersToObject)(response instanceof Response ? response.headers : undefined);
|
|
26171
|
-
if (response instanceof Response && response.body) {
|
|
26172
|
-
responseBody = await (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.extractResponseBody)(response);
|
|
26173
|
-
}
|
|
26174
|
-
}
|
|
26175
|
-
const payload = {
|
|
26176
|
-
requestBody,
|
|
26177
|
-
responseBody,
|
|
26178
|
-
requestHeaders,
|
|
26179
|
-
responseHeaders,
|
|
26180
|
-
};
|
|
26181
|
-
(0,_helpers__WEBPACK_IMPORTED_MODULE_3__.processHttpPayload)(payload, this.config, span);
|
|
26182
|
-
}
|
|
26183
|
-
catch (error) {
|
|
26184
|
-
// eslint-disable-next-line
|
|
26185
|
-
console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture fetch payload', error);
|
|
26186
|
-
}
|
|
26187
|
-
},
|
|
26188
|
-
},
|
|
26189
|
-
'@opentelemetry/instrumentation-user-interaction': {
|
|
26190
|
-
shouldPreventSpanCreation: (_event, element, span) => {
|
|
26191
|
-
if (span['parentSpanContext']) {
|
|
26192
|
-
return true;
|
|
26193
|
-
}
|
|
26194
|
-
span.setAttribute('target.innerText', (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getElementInnerText)(element));
|
|
26195
|
-
span.setAttribute('target.textContent', (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getElementTextContent)(element));
|
|
26196
|
-
Array.from(element.attributes).forEach((attribute) => {
|
|
26197
|
-
span.setAttribute(`target.attribute.${attribute.name}`, attribute.value);
|
|
26198
|
-
});
|
|
26199
|
-
return false;
|
|
26200
|
-
},
|
|
26201
|
-
},
|
|
26202
|
-
}),
|
|
26203
|
-
],
|
|
26103
|
+
instrumentations: (0,_instrumentations__WEBPACK_IMPORTED_MODULE_2__.getInstrumentations)(this.config)
|
|
26204
26104
|
});
|
|
26205
26105
|
this._registerGlobalErrorListeners();
|
|
26206
26106
|
}
|
|
@@ -26217,7 +26117,7 @@ class TracerBrowserSDK {
|
|
|
26217
26117
|
if (!this.tracerProvider) {
|
|
26218
26118
|
throw new Error('Configuration not initialized. Call init() before start().');
|
|
26219
26119
|
}
|
|
26220
|
-
this._setSessionId('',
|
|
26120
|
+
this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.SESSION_CACHE);
|
|
26221
26121
|
}
|
|
26222
26122
|
setApiKey(apiKey) {
|
|
26223
26123
|
if (!this.exporter) {
|
|
@@ -26225,56 +26125,6 @@ class TracerBrowserSDK {
|
|
|
26225
26125
|
}
|
|
26226
26126
|
this.exporter.setApiKey(apiKey);
|
|
26227
26127
|
}
|
|
26228
|
-
static _toReadableSpanLike(span) {
|
|
26229
|
-
var _a;
|
|
26230
|
-
if (span && typeof span.spanContext === 'function' && span.instrumentationScope) {
|
|
26231
|
-
return span;
|
|
26232
|
-
}
|
|
26233
|
-
const spanContext = typeof (span === null || span === void 0 ? void 0 : span.spanContext) === 'function' ? span.spanContext() : span === null || span === void 0 ? void 0 : span._spanContext;
|
|
26234
|
-
const normalizedCtx = spanContext ||
|
|
26235
|
-
{
|
|
26236
|
-
traceId: span === null || span === void 0 ? void 0 : span.traceId,
|
|
26237
|
-
spanId: span === null || span === void 0 ? void 0 : span.spanId,
|
|
26238
|
-
traceFlags: span === null || span === void 0 ? void 0 : span.traceFlags,
|
|
26239
|
-
traceState: span === null || span === void 0 ? void 0 : span.traceState,
|
|
26240
|
-
};
|
|
26241
|
-
const instrumentationScope = (span === null || span === void 0 ? void 0 : span.instrumentationScope) ||
|
|
26242
|
-
(span === null || span === void 0 ? void 0 : span.instrumentationLibrary) ||
|
|
26243
|
-
{ name: 'multiplayer-buffer', version: undefined, schemaUrl: undefined };
|
|
26244
|
-
const normalizedScope = {
|
|
26245
|
-
name: (instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.name) || 'multiplayer-buffer',
|
|
26246
|
-
version: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.version,
|
|
26247
|
-
schemaUrl: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.schemaUrl,
|
|
26248
|
-
};
|
|
26249
|
-
const resource = (span === null || span === void 0 ? void 0 : span.resource) || { attributes: {}, asyncAttributesPending: false };
|
|
26250
|
-
const parentSpanId = span === null || span === void 0 ? void 0 : span.parentSpanId;
|
|
26251
|
-
return {
|
|
26252
|
-
name: (span === null || span === void 0 ? void 0 : span.name) || '',
|
|
26253
|
-
kind: span === null || span === void 0 ? void 0 : span.kind,
|
|
26254
|
-
spanContext: () => normalizedCtx,
|
|
26255
|
-
parentSpanContext: parentSpanId
|
|
26256
|
-
? {
|
|
26257
|
-
traceId: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceId,
|
|
26258
|
-
spanId: parentSpanId,
|
|
26259
|
-
traceFlags: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceFlags,
|
|
26260
|
-
traceState: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceState,
|
|
26261
|
-
}
|
|
26262
|
-
: undefined,
|
|
26263
|
-
startTime: span === null || span === void 0 ? void 0 : span.startTime,
|
|
26264
|
-
endTime: (_a = span === null || span === void 0 ? void 0 : span.endTime) !== null && _a !== void 0 ? _a : span === null || span === void 0 ? void 0 : span.startTime,
|
|
26265
|
-
duration: span === null || span === void 0 ? void 0 : span.duration,
|
|
26266
|
-
status: span === null || span === void 0 ? void 0 : span.status,
|
|
26267
|
-
attributes: (span === null || span === void 0 ? void 0 : span.attributes) || {},
|
|
26268
|
-
links: (span === null || span === void 0 ? void 0 : span.links) || [],
|
|
26269
|
-
events: (span === null || span === void 0 ? void 0 : span.events) || [],
|
|
26270
|
-
ended: typeof (span === null || span === void 0 ? void 0 : span.ended) === 'boolean' ? span.ended : true,
|
|
26271
|
-
droppedAttributesCount: (span === null || span === void 0 ? void 0 : span.droppedAttributesCount) || 0,
|
|
26272
|
-
droppedEventsCount: (span === null || span === void 0 ? void 0 : span.droppedEventsCount) || 0,
|
|
26273
|
-
droppedLinksCount: (span === null || span === void 0 ? void 0 : span.droppedLinksCount) || 0,
|
|
26274
|
-
resource,
|
|
26275
|
-
instrumentationScope: normalizedScope,
|
|
26276
|
-
};
|
|
26277
|
-
}
|
|
26278
26128
|
async exportTraces(spans) {
|
|
26279
26129
|
if (!this.exporter) {
|
|
26280
26130
|
throw new Error('Trace exporter not initialized');
|
|
@@ -26296,19 +26146,18 @@ class TracerBrowserSDK {
|
|
|
26296
26146
|
* Otherwise, a short-lived span will be created to hold the exception event.
|
|
26297
26147
|
*/
|
|
26298
26148
|
captureException(error, errorInfo) {
|
|
26299
|
-
|
|
26149
|
+
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionRecorderSdk.captureException(error, errorInfo);
|
|
26300
26150
|
}
|
|
26301
26151
|
_getSpanSessionIdProcessor() {
|
|
26302
26152
|
return {
|
|
26303
|
-
forceFlush: () => Promise.resolve(),
|
|
26304
|
-
onEnd: () => Promise.resolve(),
|
|
26305
|
-
shutdown: () => Promise.resolve(),
|
|
26306
26153
|
onStart: (span) => {
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
span.setAttribute(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.ATTR_MULTIPLAYER_SESSION_ID, this.sessionId);
|
|
26154
|
+
if (this.sessionId) {
|
|
26155
|
+
span.setAttribute(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.ATTR_MULTIPLAYER_SESSION_ID, this.sessionId);
|
|
26310
26156
|
}
|
|
26311
26157
|
},
|
|
26158
|
+
onEnd: () => { },
|
|
26159
|
+
shutdown: () => Promise.resolve(),
|
|
26160
|
+
forceFlush: () => Promise.resolve()
|
|
26312
26161
|
};
|
|
26313
26162
|
}
|
|
26314
26163
|
_registerGlobalErrorListeners() {
|
|
@@ -26333,9 +26182,180 @@ class TracerBrowserSDK {
|
|
|
26333
26182
|
window.addEventListener('unhandledrejection', rejectionHandler);
|
|
26334
26183
|
this.globalErrorListenersRegistered = true;
|
|
26335
26184
|
}
|
|
26185
|
+
static _toReadableSpanLike(span) {
|
|
26186
|
+
var _a;
|
|
26187
|
+
if (span && typeof span.spanContext === 'function' && span.instrumentationScope) {
|
|
26188
|
+
return span;
|
|
26189
|
+
}
|
|
26190
|
+
const spanContext = typeof (span === null || span === void 0 ? void 0 : span.spanContext) === 'function' ? span.spanContext() : span === null || span === void 0 ? void 0 : span._spanContext;
|
|
26191
|
+
const normalizedCtx = spanContext ||
|
|
26192
|
+
{
|
|
26193
|
+
traceId: span === null || span === void 0 ? void 0 : span.traceId,
|
|
26194
|
+
spanId: span === null || span === void 0 ? void 0 : span.spanId,
|
|
26195
|
+
traceFlags: span === null || span === void 0 ? void 0 : span.traceFlags,
|
|
26196
|
+
traceState: span === null || span === void 0 ? void 0 : span.traceState
|
|
26197
|
+
};
|
|
26198
|
+
const instrumentationScope = (span === null || span === void 0 ? void 0 : span.instrumentationScope) ||
|
|
26199
|
+
(span === null || span === void 0 ? void 0 : span.instrumentationLibrary) ||
|
|
26200
|
+
{ name: 'multiplayer-buffer', version: undefined, schemaUrl: undefined };
|
|
26201
|
+
const normalizedScope = {
|
|
26202
|
+
name: (instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.name) || 'multiplayer-buffer',
|
|
26203
|
+
version: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.version,
|
|
26204
|
+
schemaUrl: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.schemaUrl
|
|
26205
|
+
};
|
|
26206
|
+
const resource = (span === null || span === void 0 ? void 0 : span.resource) || { attributes: {}, asyncAttributesPending: false };
|
|
26207
|
+
const parentSpanId = span === null || span === void 0 ? void 0 : span.parentSpanId;
|
|
26208
|
+
return {
|
|
26209
|
+
name: (span === null || span === void 0 ? void 0 : span.name) || '',
|
|
26210
|
+
kind: span === null || span === void 0 ? void 0 : span.kind,
|
|
26211
|
+
spanContext: () => normalizedCtx,
|
|
26212
|
+
parentSpanContext: parentSpanId
|
|
26213
|
+
? {
|
|
26214
|
+
traceId: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceId,
|
|
26215
|
+
spanId: parentSpanId,
|
|
26216
|
+
traceFlags: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceFlags,
|
|
26217
|
+
traceState: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceState
|
|
26218
|
+
}
|
|
26219
|
+
: undefined,
|
|
26220
|
+
startTime: span === null || span === void 0 ? void 0 : span.startTime,
|
|
26221
|
+
endTime: (_a = span === null || span === void 0 ? void 0 : span.endTime) !== null && _a !== void 0 ? _a : span === null || span === void 0 ? void 0 : span.startTime,
|
|
26222
|
+
duration: span === null || span === void 0 ? void 0 : span.duration,
|
|
26223
|
+
status: span === null || span === void 0 ? void 0 : span.status,
|
|
26224
|
+
attributes: (span === null || span === void 0 ? void 0 : span.attributes) || {},
|
|
26225
|
+
links: (span === null || span === void 0 ? void 0 : span.links) || [],
|
|
26226
|
+
events: (span === null || span === void 0 ? void 0 : span.events) || [],
|
|
26227
|
+
ended: typeof (span === null || span === void 0 ? void 0 : span.ended) === 'boolean' ? span.ended : true,
|
|
26228
|
+
droppedAttributesCount: (span === null || span === void 0 ? void 0 : span.droppedAttributesCount) || 0,
|
|
26229
|
+
droppedEventsCount: (span === null || span === void 0 ? void 0 : span.droppedEventsCount) || 0,
|
|
26230
|
+
droppedLinksCount: (span === null || span === void 0 ? void 0 : span.droppedLinksCount) || 0,
|
|
26231
|
+
resource,
|
|
26232
|
+
instrumentationScope: normalizedScope
|
|
26233
|
+
};
|
|
26234
|
+
}
|
|
26336
26235
|
}
|
|
26337
26236
|
|
|
26338
26237
|
|
|
26238
|
+
/***/ }),
|
|
26239
|
+
|
|
26240
|
+
/***/ "./src/otel/instrumentations/index.ts":
|
|
26241
|
+
/*!********************************************!*\
|
|
26242
|
+
!*** ./src/otel/instrumentations/index.ts ***!
|
|
26243
|
+
\********************************************/
|
|
26244
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
26245
|
+
|
|
26246
|
+
"use strict";
|
|
26247
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26248
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26249
|
+
/* harmony export */ getInstrumentations: () => (/* binding */ getInstrumentations)
|
|
26250
|
+
/* harmony export */ });
|
|
26251
|
+
/* harmony import */ var _opentelemetry_auto_instrumentations_web__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @opentelemetry/auto-instrumentations-web */ "../../node_modules/@opentelemetry/auto-instrumentations-web/build/esm/index.js");
|
|
26252
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ "./src/otel/helpers.ts");
|
|
26253
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config/index.ts");
|
|
26254
|
+
|
|
26255
|
+
|
|
26256
|
+
|
|
26257
|
+
const getInstrumentations = (config) => {
|
|
26258
|
+
return [
|
|
26259
|
+
(0,_opentelemetry_auto_instrumentations_web__WEBPACK_IMPORTED_MODULE_0__.getWebAutoInstrumentations)({
|
|
26260
|
+
'@opentelemetry/instrumentation-xml-http-request': {
|
|
26261
|
+
clearTimingResources: true,
|
|
26262
|
+
ignoreUrls: [..._config__WEBPACK_IMPORTED_MODULE_2__.OTEL_IGNORE_URLS, ...(config.ignoreUrls || [])],
|
|
26263
|
+
propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
|
|
26264
|
+
applyCustomAttributesOnSpan: (span, xhr) => {
|
|
26265
|
+
if (!config)
|
|
26266
|
+
return;
|
|
26267
|
+
const { captureBody, captureHeaders } = config;
|
|
26268
|
+
try {
|
|
26269
|
+
if (!captureBody && !captureHeaders) {
|
|
26270
|
+
return;
|
|
26271
|
+
}
|
|
26272
|
+
// @ts-ignore
|
|
26273
|
+
const networkRequest = xhr.networkRequest;
|
|
26274
|
+
const requestBody = networkRequest.requestBody;
|
|
26275
|
+
const responseBody = networkRequest.responseBody;
|
|
26276
|
+
const requestHeaders = networkRequest.requestHeaders || {};
|
|
26277
|
+
const responseHeaders = networkRequest.responseHeaders || {};
|
|
26278
|
+
const payload = {
|
|
26279
|
+
requestBody,
|
|
26280
|
+
responseBody,
|
|
26281
|
+
requestHeaders,
|
|
26282
|
+
responseHeaders
|
|
26283
|
+
};
|
|
26284
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.processHttpPayload)(payload, config, span);
|
|
26285
|
+
}
|
|
26286
|
+
catch (error) {
|
|
26287
|
+
// eslint-disable-next-line
|
|
26288
|
+
console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture xml-http payload', error);
|
|
26289
|
+
}
|
|
26290
|
+
}
|
|
26291
|
+
},
|
|
26292
|
+
'@opentelemetry/instrumentation-fetch': {
|
|
26293
|
+
clearTimingResources: true,
|
|
26294
|
+
ignoreUrls: [..._config__WEBPACK_IMPORTED_MODULE_2__.OTEL_IGNORE_URLS, ...(config.ignoreUrls || [])],
|
|
26295
|
+
propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
|
|
26296
|
+
applyCustomAttributesOnSpan: async (span, request, response) => {
|
|
26297
|
+
if (!config)
|
|
26298
|
+
return;
|
|
26299
|
+
const { captureBody, captureHeaders } = config;
|
|
26300
|
+
try {
|
|
26301
|
+
if (!captureBody && !captureHeaders) {
|
|
26302
|
+
return;
|
|
26303
|
+
}
|
|
26304
|
+
// Try to get data from our fetch wrapper first
|
|
26305
|
+
// @ts-ignore
|
|
26306
|
+
const networkRequest = response === null || response === void 0 ? void 0 : response.networkRequest;
|
|
26307
|
+
let requestBody = null;
|
|
26308
|
+
let responseBody = null;
|
|
26309
|
+
let requestHeaders = {};
|
|
26310
|
+
let responseHeaders = {};
|
|
26311
|
+
if (networkRequest) {
|
|
26312
|
+
// Use data captured by our fetch wrapper
|
|
26313
|
+
requestBody = networkRequest.requestBody;
|
|
26314
|
+
responseBody = networkRequest.responseBody;
|
|
26315
|
+
requestHeaders = networkRequest.requestHeaders || {};
|
|
26316
|
+
responseHeaders = networkRequest.responseHeaders || {};
|
|
26317
|
+
}
|
|
26318
|
+
else {
|
|
26319
|
+
// Fallback to original OpenTelemetry approach
|
|
26320
|
+
requestBody = request.body;
|
|
26321
|
+
requestHeaders = (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.headersToObject)(request.headers);
|
|
26322
|
+
responseHeaders = (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.headersToObject)(response instanceof Response ? response.headers : undefined);
|
|
26323
|
+
if (response instanceof Response && response.body) {
|
|
26324
|
+
responseBody = await (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.extractResponseBody)(response);
|
|
26325
|
+
}
|
|
26326
|
+
}
|
|
26327
|
+
const payload = {
|
|
26328
|
+
requestBody,
|
|
26329
|
+
responseBody,
|
|
26330
|
+
requestHeaders,
|
|
26331
|
+
responseHeaders
|
|
26332
|
+
};
|
|
26333
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.processHttpPayload)(payload, config, span);
|
|
26334
|
+
}
|
|
26335
|
+
catch (error) {
|
|
26336
|
+
// eslint-disable-next-line
|
|
26337
|
+
console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture fetch payload', error);
|
|
26338
|
+
}
|
|
26339
|
+
}
|
|
26340
|
+
},
|
|
26341
|
+
'@opentelemetry/instrumentation-user-interaction': {
|
|
26342
|
+
shouldPreventSpanCreation: (_event, element, span) => {
|
|
26343
|
+
if (span['parentSpanContext']) {
|
|
26344
|
+
return true;
|
|
26345
|
+
}
|
|
26346
|
+
span.setAttribute('target.innerText', (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.getElementInnerText)(element));
|
|
26347
|
+
span.setAttribute('target.textContent', (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.getElementTextContent)(element));
|
|
26348
|
+
Array.from(element.attributes).forEach((attribute) => {
|
|
26349
|
+
span.setAttribute(`target.attribute.${attribute.name}`, attribute.value);
|
|
26350
|
+
});
|
|
26351
|
+
return false;
|
|
26352
|
+
}
|
|
26353
|
+
}
|
|
26354
|
+
})
|
|
26355
|
+
];
|
|
26356
|
+
};
|
|
26357
|
+
|
|
26358
|
+
|
|
26339
26359
|
/***/ }),
|
|
26340
26360
|
|
|
26341
26361
|
/***/ "./src/patch/configs.ts":
|
|
@@ -26777,7 +26797,7 @@ class RecorderBrowserSDK {
|
|
|
26777
26797
|
constructor() {
|
|
26778
26798
|
this.intervals = {
|
|
26779
26799
|
restart: null,
|
|
26780
|
-
bufferSnapshot: null
|
|
26800
|
+
bufferSnapshot: null
|
|
26781
26801
|
};
|
|
26782
26802
|
this.startedAt = '';
|
|
26783
26803
|
this.stoppedAt = '';
|
|
@@ -26819,7 +26839,7 @@ class RecorderBrowserSDK {
|
|
|
26819
26839
|
return;
|
|
26820
26840
|
}
|
|
26821
26841
|
this._handleLiveSessionEvent(event, ts, sessionId, sessionType);
|
|
26822
|
-
}
|
|
26842
|
+
}
|
|
26823
26843
|
});
|
|
26824
26844
|
this.takeFullSnapshot();
|
|
26825
26845
|
this._setupPeriodicSnapshots(sessionId, sessionType);
|
|
@@ -26896,8 +26916,8 @@ class RecorderBrowserSDK {
|
|
|
26896
26916
|
event: {
|
|
26897
26917
|
event: packedEvent,
|
|
26898
26918
|
eventType: event.type,
|
|
26899
|
-
timestamp: ts
|
|
26900
|
-
}
|
|
26919
|
+
timestamp: ts
|
|
26920
|
+
}
|
|
26901
26921
|
});
|
|
26902
26922
|
}
|
|
26903
26923
|
catch (error) {
|
|
@@ -26922,7 +26942,7 @@ class RecorderBrowserSDK {
|
|
|
26922
26942
|
eventType: event.type,
|
|
26923
26943
|
timestamp: ts,
|
|
26924
26944
|
debugSessionId: sessionId,
|
|
26925
|
-
debugSessionType: sessionType
|
|
26945
|
+
debugSessionType: sessionType
|
|
26926
26946
|
});
|
|
26927
26947
|
}
|
|
26928
26948
|
/**
|
|
@@ -26936,7 +26956,7 @@ class RecorderBrowserSDK {
|
|
|
26936
26956
|
sampling: { canvas: 5 },
|
|
26937
26957
|
recordCanvas: (_c = this.config) === null || _c === void 0 ? void 0 : _c.recordCanvas,
|
|
26938
26958
|
dataURLOptions: { type: 'image/webp', quality: 0.1 },
|
|
26939
|
-
plugins: [(0,_rrweb_rrweb_plugin_console_record__WEBPACK_IMPORTED_MODULE_3__.getRecordConsolePlugin)({ level: ['log', 'error'] })]
|
|
26959
|
+
plugins: [(0,_rrweb_rrweb_plugin_console_record__WEBPACK_IMPORTED_MODULE_3__.getRecordConsolePlugin)({ level: ['log', 'error'] })]
|
|
26940
26960
|
};
|
|
26941
26961
|
if (maskingConfig.maskInputOptions) {
|
|
26942
26962
|
options.maskInputOptions = maskingConfig.maskInputOptions;
|
|
@@ -26969,7 +26989,7 @@ class RecorderBrowserSDK {
|
|
|
26969
26989
|
}, _config__WEBPACK_IMPORTED_MODULE_5__.CONTINUOUS_DEBUGGING_TIMEOUT);
|
|
26970
26990
|
}
|
|
26971
26991
|
if (!sessionId && ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.buffering) === null || _b === void 0 ? void 0 : _b.enabled)) {
|
|
26972
|
-
const interval = this.config.buffering.snapshotIntervalMs ||
|
|
26992
|
+
const interval = this.config.buffering.snapshotIntervalMs || 20000;
|
|
26973
26993
|
this.intervals.bufferSnapshot = setInterval(() => {
|
|
26974
26994
|
this.takeFullSnapshot();
|
|
26975
26995
|
}, interval);
|
|
@@ -26998,7 +27018,7 @@ class ApiService {
|
|
|
26998
27018
|
this.config = {
|
|
26999
27019
|
apiKey: '',
|
|
27000
27020
|
apiBaseUrl: '',
|
|
27001
|
-
exporterEndpoint: ''
|
|
27021
|
+
exporterEndpoint: ''
|
|
27002
27022
|
};
|
|
27003
27023
|
}
|
|
27004
27024
|
/**
|
|
@@ -27008,7 +27028,7 @@ class ApiService {
|
|
|
27008
27028
|
init(config) {
|
|
27009
27029
|
this.config = {
|
|
27010
27030
|
...this.config,
|
|
27011
|
-
...config
|
|
27031
|
+
...config
|
|
27012
27032
|
};
|
|
27013
27033
|
}
|
|
27014
27034
|
/**
|
|
@@ -27102,14 +27122,14 @@ class ApiService {
|
|
|
27102
27122
|
body: body ? JSON.stringify(body) : null,
|
|
27103
27123
|
headers: {
|
|
27104
27124
|
'Content-Type': 'application/json',
|
|
27105
|
-
...(this.config.apiKey && { 'X-Api-Key': this.config.apiKey })
|
|
27106
|
-
}
|
|
27125
|
+
...(this.config.apiKey && { 'X-Api-Key': this.config.apiKey })
|
|
27126
|
+
}
|
|
27107
27127
|
};
|
|
27108
27128
|
try {
|
|
27109
27129
|
const response = await fetch(url, {
|
|
27110
27130
|
...params,
|
|
27111
27131
|
credentials: 'include',
|
|
27112
|
-
signal
|
|
27132
|
+
signal
|
|
27113
27133
|
});
|
|
27114
27134
|
if (!response.ok) {
|
|
27115
27135
|
throw new Error('Network response was not ok: ' + response.statusText);
|
|
@@ -27182,14 +27202,6 @@ class CrashBufferService {
|
|
|
27182
27202
|
return fallback;
|
|
27183
27203
|
}
|
|
27184
27204
|
}
|
|
27185
|
-
async setAttrs(attrs) {
|
|
27186
|
-
await this._safe(async () => {
|
|
27187
|
-
await this.db.setAttrs({
|
|
27188
|
-
tabId: this.tabId,
|
|
27189
|
-
...attrs,
|
|
27190
|
-
});
|
|
27191
|
-
}, undefined);
|
|
27192
|
-
}
|
|
27193
27205
|
async appendEvent(payload, _windowMs) {
|
|
27194
27206
|
var _a;
|
|
27195
27207
|
this.lastSeenEventTs = Math.max(this.lastSeenEventTs, payload.ts || 0);
|
|
@@ -27198,26 +27210,15 @@ class CrashBufferService {
|
|
|
27198
27210
|
const isFullSnapshot = Boolean(payload.isFullSnapshot);
|
|
27199
27211
|
const eventType = (_a = payload === null || payload === void 0 ? void 0 : payload.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
27200
27212
|
const isMeta = eventType === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta;
|
|
27201
|
-
if (this.requiresFullSnapshot && !isFullSnapshot && !isMeta) {
|
|
27202
|
-
// rrweb replayable prefix is Meta -> FullSnapshot.
|
|
27203
|
-
// While waiting for the first FullSnapshot, we still keep the Meta event (but drop incrementals).
|
|
27204
|
-
return;
|
|
27205
|
-
}
|
|
27206
27213
|
await this._safe(async () => {
|
|
27207
27214
|
await this.db.appendEvent({
|
|
27208
27215
|
tabId: this.tabId,
|
|
27209
27216
|
ts: payload.ts,
|
|
27210
27217
|
isFullSnapshot: payload.isFullSnapshot,
|
|
27211
|
-
event: payload.event
|
|
27218
|
+
event: payload.event
|
|
27212
27219
|
});
|
|
27213
27220
|
}, undefined);
|
|
27214
|
-
if (isFullSnapshot
|
|
27215
|
-
// Ensure this snapshot becomes the first replayable event.
|
|
27216
|
-
// Keep Meta + FullSnapshot (if present) and prune everything older.
|
|
27217
|
-
await this._safe(() => this.db.pruneOlderThanWithRrwebSnapshotAnchor(this.tabId, payload.ts), undefined);
|
|
27218
|
-
this.requiresFullSnapshot = false;
|
|
27219
|
-
}
|
|
27220
|
-
else if (isFullSnapshot) {
|
|
27221
|
+
if (isFullSnapshot) {
|
|
27221
27222
|
this.requiresFullSnapshot = false;
|
|
27222
27223
|
}
|
|
27223
27224
|
this.pruneSoon();
|
|
@@ -27238,7 +27239,7 @@ class CrashBufferService {
|
|
|
27238
27239
|
return {
|
|
27239
27240
|
tabId: this.tabId,
|
|
27240
27241
|
ts: p.ts,
|
|
27241
|
-
span: p.span
|
|
27242
|
+
span: p.span
|
|
27242
27243
|
};
|
|
27243
27244
|
});
|
|
27244
27245
|
await this.db.appendSpans(records);
|
|
@@ -27278,71 +27279,50 @@ class CrashBufferService {
|
|
|
27278
27279
|
}
|
|
27279
27280
|
async snapshot(_windowMs, now = Date.now()) {
|
|
27280
27281
|
var _a, _b;
|
|
27281
|
-
const
|
|
27282
|
-
|
|
27282
|
+
const stoppedAt = now;
|
|
27283
|
+
let startedAt = Math.max(0, stoppedAt - this.windowMs);
|
|
27283
27284
|
// Always include a full snapshot "anchor" if one exists at/before the window start.
|
|
27284
|
-
const
|
|
27285
|
-
const anchor = await this.db.getLastRrwebFullSnapshotBefore(this.tabId,
|
|
27286
|
-
return typeof (anchor === null || anchor === void 0 ? void 0 : anchor.ts) === 'number' ? anchor.ts :
|
|
27287
|
-
},
|
|
27288
|
-
const [
|
|
27289
|
-
this._safe(() => this.db.getRrwebEventsWindow(this.tabId,
|
|
27290
|
-
this._safe(() => this.db.getOtelSpansWindow(this.tabId,
|
|
27291
|
-
this._safe(() => this.db.getAttrs(this.tabId), null),
|
|
27285
|
+
const firstSnapshotAt = await this._safe(async () => {
|
|
27286
|
+
const anchor = await this.db.getLastRrwebFullSnapshotBefore(this.tabId, startedAt);
|
|
27287
|
+
return typeof (anchor === null || anchor === void 0 ? void 0 : anchor.ts) === 'number' ? anchor.ts : startedAt;
|
|
27288
|
+
}, startedAt);
|
|
27289
|
+
const [allEvents, allSpans] = await Promise.all([
|
|
27290
|
+
this._safe(() => this.db.getRrwebEventsWindow(this.tabId, firstSnapshotAt, stoppedAt), []),
|
|
27291
|
+
this._safe(() => this.db.getOtelSpansWindow(this.tabId, startedAt, stoppedAt), [])
|
|
27292
27292
|
]);
|
|
27293
|
-
const
|
|
27293
|
+
const eventsSorted = allEvents
|
|
27294
27294
|
.sort((a, b) => a.ts - b.ts)
|
|
27295
27295
|
.map((r) => ({ ts: r.ts, isFullSnapshot: r.isFullSnapshot, event: r.event }));
|
|
27296
|
+
const payload = {
|
|
27297
|
+
startedAt,
|
|
27298
|
+
stoppedAt,
|
|
27299
|
+
spans: [],
|
|
27300
|
+
events: []
|
|
27301
|
+
};
|
|
27296
27302
|
// Hard guarantee: snapshot payload starts with Meta -> FullSnapshot (or is empty).
|
|
27297
|
-
const
|
|
27298
|
-
if (
|
|
27299
|
-
return
|
|
27300
|
-
rrwebEvents: [],
|
|
27301
|
-
otelSpans: [],
|
|
27302
|
-
attrs: attrs
|
|
27303
|
-
? {
|
|
27304
|
-
sessionAttributes: attrs.sessionAttributes,
|
|
27305
|
-
resourceAttributes: attrs.resourceAttributes,
|
|
27306
|
-
userAttributes: attrs.userAttributes,
|
|
27307
|
-
}
|
|
27308
|
-
: null,
|
|
27309
|
-
windowMs: this.windowMs,
|
|
27310
|
-
fromTs,
|
|
27311
|
-
toTs,
|
|
27312
|
-
};
|
|
27303
|
+
const firstSnapshotIdx = eventsSorted.findIndex((e) => Boolean(e.isFullSnapshot));
|
|
27304
|
+
if (firstSnapshotIdx < 0) {
|
|
27305
|
+
return payload;
|
|
27313
27306
|
}
|
|
27314
27307
|
// Prefer including the Meta event immediately preceding the first FullSnapshot.
|
|
27315
|
-
let startIdx =
|
|
27316
|
-
for (let i =
|
|
27317
|
-
const t = (_b = (_a =
|
|
27308
|
+
let startIdx = firstSnapshotIdx;
|
|
27309
|
+
for (let i = firstSnapshotIdx - 1; i >= 0; i--) {
|
|
27310
|
+
const t = (_b = (_a = eventsSorted[i]) === null || _a === void 0 ? void 0 : _a.event) === null || _b === void 0 ? void 0 : _b.eventType;
|
|
27318
27311
|
if (t === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta) {
|
|
27319
27312
|
startIdx = i;
|
|
27320
27313
|
break;
|
|
27321
27314
|
}
|
|
27322
27315
|
}
|
|
27323
|
-
const
|
|
27324
|
-
|
|
27325
|
-
|
|
27326
|
-
|
|
27327
|
-
const replayStartTs = rrwebEvents.length > 0 ? rrwebEvents[0].ts : fromTs;
|
|
27328
|
-
const otelSpans = spans
|
|
27329
|
-
.filter((s) => typeof (s === null || s === void 0 ? void 0 : s.ts) === 'number' && s.ts >= replayStartTs)
|
|
27316
|
+
const events = eventsSorted.slice(startIdx);
|
|
27317
|
+
const replayStartedAt = events.length > 0 ? events[0].ts : startedAt;
|
|
27318
|
+
const spans = allSpans
|
|
27319
|
+
.filter((s) => typeof (s === null || s === void 0 ? void 0 : s.ts) === 'number' && s.ts >= replayStartedAt)
|
|
27330
27320
|
.sort((a, b) => a.ts - b.ts)
|
|
27331
27321
|
.map((r) => ({ ts: r.ts, span: r.span }));
|
|
27332
|
-
|
|
27333
|
-
|
|
27334
|
-
|
|
27335
|
-
|
|
27336
|
-
? {
|
|
27337
|
-
sessionAttributes: attrs.sessionAttributes,
|
|
27338
|
-
resourceAttributes: attrs.resourceAttributes,
|
|
27339
|
-
userAttributes: attrs.userAttributes,
|
|
27340
|
-
}
|
|
27341
|
-
: null,
|
|
27342
|
-
windowMs: this.windowMs,
|
|
27343
|
-
fromTs: replayStartTs,
|
|
27344
|
-
toTs,
|
|
27345
|
-
};
|
|
27322
|
+
payload.events = events;
|
|
27323
|
+
payload.spans = spans;
|
|
27324
|
+
payload.startedAt = replayStartedAt;
|
|
27325
|
+
return payload;
|
|
27346
27326
|
}
|
|
27347
27327
|
async clear() {
|
|
27348
27328
|
await this._safe(() => this.db.clearTab(this.tabId), undefined);
|
|
@@ -27497,7 +27477,7 @@ class IndexedDBService {
|
|
|
27497
27477
|
const db = await this.dbPromise;
|
|
27498
27478
|
const payload = {
|
|
27499
27479
|
...attrs,
|
|
27500
|
-
updatedAt: (_a = attrs.updatedAt) !== null && _a !== void 0 ? _a : Date.now()
|
|
27480
|
+
updatedAt: (_a = attrs.updatedAt) !== null && _a !== void 0 ? _a : Date.now()
|
|
27501
27481
|
};
|
|
27502
27482
|
return new Promise((resolve, reject) => {
|
|
27503
27483
|
const tx = db.transaction(attrsStore, 'readwrite');
|
|
@@ -27783,7 +27763,7 @@ class IndexedDBService {
|
|
|
27783
27763
|
const r = attr.delete(tabId);
|
|
27784
27764
|
r.onsuccess = () => res();
|
|
27785
27765
|
r.onerror = () => rej(r.error);
|
|
27786
|
-
})
|
|
27766
|
+
})
|
|
27787
27767
|
])
|
|
27788
27768
|
.then(() => {
|
|
27789
27769
|
// noop
|
|
@@ -27942,7 +27922,7 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_4__.Observa
|
|
|
27942
27922
|
apiKey: '',
|
|
27943
27923
|
socketUrl: '',
|
|
27944
27924
|
keepAlive: false,
|
|
27945
|
-
usePostMessageFallback: false
|
|
27925
|
+
usePostMessageFallback: false
|
|
27946
27926
|
};
|
|
27947
27927
|
}
|
|
27948
27928
|
/**
|
|
@@ -27952,11 +27932,9 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_4__.Observa
|
|
|
27952
27932
|
init(config) {
|
|
27953
27933
|
this.options = {
|
|
27954
27934
|
...this.options,
|
|
27955
|
-
...config
|
|
27935
|
+
...config
|
|
27956
27936
|
};
|
|
27957
|
-
if (this.options.keepAlive &&
|
|
27958
|
-
this.options.socketUrl &&
|
|
27959
|
-
this.options.apiKey) {
|
|
27937
|
+
if (this.options.keepAlive && this.options.socketUrl && this.options.apiKey) {
|
|
27960
27938
|
this._initConnection();
|
|
27961
27939
|
}
|
|
27962
27940
|
}
|
|
@@ -27969,16 +27947,13 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_4__.Observa
|
|
|
27969
27947
|
// If any config changed, reconnect if connected
|
|
27970
27948
|
const hasChanges = Object.keys(config).some((key) => {
|
|
27971
27949
|
const typedKey = key;
|
|
27972
|
-
return
|
|
27973
|
-
config[typedKey] !== this.options[typedKey]);
|
|
27950
|
+
return config[typedKey] !== undefined && config[typedKey] !== this.options[typedKey];
|
|
27974
27951
|
});
|
|
27975
27952
|
if (hasChanges) {
|
|
27976
27953
|
this.options = { ...this.options, ...config };
|
|
27977
27954
|
if ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.connected) {
|
|
27978
27955
|
this.close().then(() => {
|
|
27979
|
-
if (this.options.keepAlive &&
|
|
27980
|
-
this.options.socketUrl &&
|
|
27981
|
-
this.options.apiKey) {
|
|
27956
|
+
if (this.options.keepAlive && this.options.socketUrl && this.options.apiKey) {
|
|
27982
27957
|
this._initConnection();
|
|
27983
27958
|
}
|
|
27984
27959
|
});
|
|
@@ -27995,12 +27970,10 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_4__.Observa
|
|
|
27995
27970
|
path: '/v0/radar/ws',
|
|
27996
27971
|
auth: {
|
|
27997
27972
|
'x-api-key': this.options.apiKey,
|
|
27998
|
-
...this.options.clientId
|
|
27999
|
-
? { [_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_3__.ATTR_MULTIPLAYER_SESSION_CLIENT_ID]: this.options.clientId }
|
|
28000
|
-
: {},
|
|
27973
|
+
...(this.options.clientId ? { [_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_3__.ATTR_MULTIPLAYER_SESSION_CLIENT_ID]: this.options.clientId } : {})
|
|
28001
27974
|
},
|
|
28002
27975
|
reconnectionAttempts: 2,
|
|
28003
|
-
transports: ['websocket']
|
|
27976
|
+
transports: ['websocket']
|
|
28004
27977
|
});
|
|
28005
27978
|
this.socket.on('ready', () => {
|
|
28006
27979
|
this.isConnecting = false;
|
|
@@ -28077,7 +28050,7 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_4__.Observa
|
|
|
28077
28050
|
projectId: session.project,
|
|
28078
28051
|
workspaceId: session.workspace,
|
|
28079
28052
|
debugSessionId: this.sessionId,
|
|
28080
|
-
sessionType: session.creationType
|
|
28053
|
+
sessionType: session.creationType
|
|
28081
28054
|
};
|
|
28082
28055
|
this.emitSocketEvent(_config__WEBPACK_IMPORTED_MODULE_2__.SESSION_SUBSCRIBE_EVENT, payload);
|
|
28083
28056
|
// use long id instead of short id
|
|
@@ -28308,7 +28281,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28308
28281
|
this._checkOperation('init');
|
|
28309
28282
|
// GC: remove orphaned crash buffers from old tabs.
|
|
28310
28283
|
// Keep TTL large to avoid any accidental data loss.
|
|
28311
|
-
void this._bufferDb.sweepStaleTabs(
|
|
28284
|
+
void this._bufferDb.sweepStaleTabs(10 * 60 * 60 * 1000);
|
|
28312
28285
|
(0,_patch__WEBPACK_IMPORTED_MODULE_6__.setMaxCapturingHttpPayloadSize)(this._configs.maxCapturingHttpPayloadSize || _config__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE);
|
|
28313
28286
|
(0,_patch__WEBPACK_IMPORTED_MODULE_6__.setShouldRecordHttpData)(this._configs.captureBody, this._configs.captureHeaders);
|
|
28314
28287
|
this._setupCrashBuffer();
|
|
@@ -28347,22 +28320,16 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28347
28320
|
_setupCrashBuffer() {
|
|
28348
28321
|
var _a;
|
|
28349
28322
|
if ((_a = this._configs.buffering) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
28350
|
-
const windowMinutes = this._configs.buffering.windowMinutes ||
|
|
28323
|
+
const windowMinutes = this._configs.buffering.windowMinutes || 0.5;
|
|
28351
28324
|
const windowMs = Math.max(10000, windowMinutes * 60 * 1000);
|
|
28352
28325
|
this._crashBuffer = new _services_crashBuffer_service__WEBPACK_IMPORTED_MODULE_13__.CrashBufferService(this._bufferDb, this._tabId, windowMs);
|
|
28353
28326
|
this._recorder.setCrashBuffer(this._crashBuffer);
|
|
28354
28327
|
this._tracer.setCrashBuffer(this._crashBuffer);
|
|
28355
|
-
this._crashBuffer.setAttrs({
|
|
28356
|
-
sessionAttributes: this.sessionAttributes,
|
|
28357
|
-
resourceAttributes: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getNavigatorInfo)(),
|
|
28358
|
-
userAttributes: this._userAttributes
|
|
28359
|
-
});
|
|
28360
28328
|
this._crashBuffer.on('error-span-appended', (payload) => {
|
|
28361
28329
|
if (this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped || this.sessionId)
|
|
28362
28330
|
return;
|
|
28363
28331
|
if (!payload.span)
|
|
28364
28332
|
return;
|
|
28365
|
-
console.log('error-span-appended', payload);
|
|
28366
28333
|
this._createExceptionSession(payload.span);
|
|
28367
28334
|
});
|
|
28368
28335
|
this._registerCrashBufferLifecycleHandlers();
|
|
@@ -28407,13 +28374,12 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28407
28374
|
}
|
|
28408
28375
|
_startBufferOnlyRecording() {
|
|
28409
28376
|
var _a, _b;
|
|
28410
|
-
if (
|
|
28411
|
-
|
|
28412
|
-
|
|
28413
|
-
|
|
28414
|
-
// Don’t start if a session is active.
|
|
28415
|
-
if (this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped || this.sessionId)
|
|
28377
|
+
if (this.sessionId ||
|
|
28378
|
+
!this._crashBuffer ||
|
|
28379
|
+
!((_b = (_a = this._configs) === null || _a === void 0 ? void 0 : _a.buffering) === null || _b === void 0 ? void 0 : _b.enabled) ||
|
|
28380
|
+
this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
|
|
28416
28381
|
return;
|
|
28382
|
+
}
|
|
28417
28383
|
void this._recorder.restart(null, _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL);
|
|
28418
28384
|
}
|
|
28419
28385
|
/**
|
|
@@ -28560,7 +28526,6 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28560
28526
|
return;
|
|
28561
28527
|
}
|
|
28562
28528
|
this._userAttributes = userAttributes;
|
|
28563
|
-
this._tracer.clientId;
|
|
28564
28529
|
const data = {
|
|
28565
28530
|
userAttributes: this._userAttributes,
|
|
28566
28531
|
clientId: this._tracer.clientId
|
|
@@ -28592,37 +28557,30 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28592
28557
|
}
|
|
28593
28558
|
async _flushBuffer(sessionId) {
|
|
28594
28559
|
var _a, _b;
|
|
28595
|
-
if (!
|
|
28596
|
-
|
|
28597
|
-
|
|
28598
|
-
|
|
28599
|
-
|
|
28600
|
-
return null;
|
|
28601
|
-
// Don’t flush while a live recording is active.
|
|
28602
|
-
if (this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped)
|
|
28560
|
+
if (!sessionId ||
|
|
28561
|
+
!this._crashBuffer ||
|
|
28562
|
+
this._isFlushingBuffer ||
|
|
28563
|
+
!((_b = (_a = this._configs) === null || _a === void 0 ? void 0 : _a.buffering) === null || _b === void 0 ? void 0 : _b.enabled) ||
|
|
28564
|
+
this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
|
|
28603
28565
|
return null;
|
|
28566
|
+
}
|
|
28604
28567
|
this._isFlushingBuffer = true;
|
|
28605
28568
|
try {
|
|
28606
|
-
const
|
|
28607
|
-
if (
|
|
28569
|
+
const { events, spans, startedAt, stoppedAt } = await this._crashBuffer.snapshot();
|
|
28570
|
+
if (events.length === 0 && spans.length === 0) {
|
|
28608
28571
|
return null;
|
|
28609
28572
|
}
|
|
28610
|
-
|
|
28611
|
-
|
|
28612
|
-
|
|
28613
|
-
|
|
28614
|
-
|
|
28615
|
-
|
|
28616
|
-
this.
|
|
28617
|
-
|
|
28618
|
-
|
|
28619
|
-
|
|
28620
|
-
|
|
28621
|
-
resourceAttributes: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getNavigatorInfo)(),
|
|
28622
|
-
userAttributes: this._userAttributes || undefined
|
|
28623
|
-
})
|
|
28624
|
-
]);
|
|
28625
|
-
}
|
|
28573
|
+
await Promise.all([
|
|
28574
|
+
this._tracer.exportTraces(spans.map((s) => s.span)),
|
|
28575
|
+
this._apiService.exportEvents(sessionId, { events: events.map((e) => e.event) }),
|
|
28576
|
+
this._apiService.updateSessionAttributes(sessionId, {
|
|
28577
|
+
startedAt: new Date(startedAt).toISOString(),
|
|
28578
|
+
stoppedAt: new Date(stoppedAt).toISOString(),
|
|
28579
|
+
sessionAttributes: this.sessionAttributes,
|
|
28580
|
+
resourceAttributes: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getNavigatorInfo)(),
|
|
28581
|
+
userAttributes: this._userAttributes || undefined
|
|
28582
|
+
})
|
|
28583
|
+
]);
|
|
28626
28584
|
}
|
|
28627
28585
|
catch (_e) {
|
|
28628
28586
|
// swallow: flush is best-effort; never throw into app code
|
|
@@ -28793,19 +28751,14 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
28793
28751
|
});
|
|
28794
28752
|
this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.SESSION_SAVE_BUFFER_EVENT, (payload) => {
|
|
28795
28753
|
var _a;
|
|
28796
|
-
|
|
28797
|
-
return;
|
|
28798
|
-
void this._flushBuffer(payload.debugSession._id);
|
|
28754
|
+
this._flushBuffer((_a = payload === null || payload === void 0 ? void 0 : payload.debugSession) === null || _a === void 0 ? void 0 : _a._id);
|
|
28799
28755
|
});
|
|
28800
28756
|
}
|
|
28801
28757
|
async _createExceptionSession(span) {
|
|
28802
28758
|
try {
|
|
28803
28759
|
const session = await this._apiService.createErrorSession({ span });
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
console.log('====================================');
|
|
28807
|
-
if (session) {
|
|
28808
|
-
void this._flushBuffer(session._id);
|
|
28760
|
+
if (session === null || session === void 0 ? void 0 : session._id) {
|
|
28761
|
+
this._flushBuffer(session._id);
|
|
28809
28762
|
}
|
|
28810
28763
|
}
|
|
28811
28764
|
catch (_ignored) { }
|
|
@@ -31710,7 +31663,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31710
31663
|
"use strict";
|
|
31711
31664
|
__webpack_require__.r(__webpack_exports__);
|
|
31712
31665
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31713
|
-
/* harmony export */ captureException: () => (/* binding */ captureException)
|
|
31666
|
+
/* harmony export */ captureException: () => (/* binding */ captureException),
|
|
31667
|
+
/* harmony export */ shouldCaptureException: () => (/* binding */ shouldCaptureException)
|
|
31714
31668
|
/* harmony export */ });
|
|
31715
31669
|
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/context-api.js");
|
|
31716
31670
|
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
@@ -31744,6 +31698,17 @@ var __read = (undefined && undefined.__read) || function (o, n) {
|
|
|
31744
31698
|
}
|
|
31745
31699
|
return ar;
|
|
31746
31700
|
};
|
|
31701
|
+
var __values = (undefined && undefined.__values) || function(o) {
|
|
31702
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
31703
|
+
if (m) return m.call(o);
|
|
31704
|
+
if (o && typeof o.length === "number") return {
|
|
31705
|
+
next: function () {
|
|
31706
|
+
if (o && i >= o.length) o = void 0;
|
|
31707
|
+
return { value: o && o[i++], done: !o };
|
|
31708
|
+
}
|
|
31709
|
+
};
|
|
31710
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
31711
|
+
};
|
|
31747
31712
|
|
|
31748
31713
|
|
|
31749
31714
|
|
|
@@ -31754,7 +31719,7 @@ var __read = (undefined && undefined.__read) || function (o, n) {
|
|
|
31754
31719
|
*/
|
|
31755
31720
|
var captureException = function (error, errorInfo) {
|
|
31756
31721
|
var _a, _b;
|
|
31757
|
-
if (!error) {
|
|
31722
|
+
if (!error || !shouldCaptureException(error)) {
|
|
31758
31723
|
return;
|
|
31759
31724
|
}
|
|
31760
31725
|
var activeContext = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.context.active();
|
|
@@ -31762,7 +31727,7 @@ var captureException = function (error, errorInfo) {
|
|
|
31762
31727
|
var isNewSpan = false;
|
|
31763
31728
|
if (!span || !span.isRecording()) {
|
|
31764
31729
|
span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.getTracer('exception').startSpan(error.name || 'Error', {
|
|
31765
|
-
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)())
|
|
31730
|
+
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)())
|
|
31766
31731
|
});
|
|
31767
31732
|
_opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.setSpan(activeContext, span);
|
|
31768
31733
|
isNewSpan = true;
|
|
@@ -31783,12 +31748,57 @@ var captureException = function (error, errorInfo) {
|
|
|
31783
31748
|
span.recordException(error);
|
|
31784
31749
|
span.setStatus({
|
|
31785
31750
|
code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
|
|
31786
|
-
message: error.message
|
|
31751
|
+
message: error.message
|
|
31787
31752
|
});
|
|
31788
31753
|
if (isNewSpan) {
|
|
31789
31754
|
span.end();
|
|
31790
31755
|
}
|
|
31791
31756
|
};
|
|
31757
|
+
/**
|
|
31758
|
+
* Best-effort deduplication of exceptions that fire multiple times
|
|
31759
|
+
* (e.g. framework handler + global handlers) within a short time window.
|
|
31760
|
+
*/
|
|
31761
|
+
var exceptionDedupeWindowMs = 2000;
|
|
31762
|
+
var recentExceptionFingerprints = new Map();
|
|
31763
|
+
var shouldCaptureException = function (error, _errorInfo) {
|
|
31764
|
+
var e_1, _a;
|
|
31765
|
+
if (!error)
|
|
31766
|
+
return false;
|
|
31767
|
+
var now = Date.now();
|
|
31768
|
+
// Build a fingerprint that is stable enough across repeated emissions
|
|
31769
|
+
// but not so broad that different errors collapse into one.
|
|
31770
|
+
var keyParts = [];
|
|
31771
|
+
keyParts.push(error.name || 'Error');
|
|
31772
|
+
keyParts.push(error.message || '');
|
|
31773
|
+
// First stack line tends to include file/line where it originated.
|
|
31774
|
+
if (typeof error.stack === 'string') {
|
|
31775
|
+
var firstFrame = error.stack.split('\n')[1] || '';
|
|
31776
|
+
keyParts.push(firstFrame.trim());
|
|
31777
|
+
}
|
|
31778
|
+
var fingerprint = keyParts.join('|').slice(0, 500);
|
|
31779
|
+
var lastSeen = recentExceptionFingerprints.get(fingerprint);
|
|
31780
|
+
if (lastSeen && now - lastSeen < exceptionDedupeWindowMs) {
|
|
31781
|
+
return false;
|
|
31782
|
+
}
|
|
31783
|
+
recentExceptionFingerprints.set(fingerprint, now);
|
|
31784
|
+
try {
|
|
31785
|
+
// Cheap cleanup of old entries to avoid unbounded growth.
|
|
31786
|
+
for (var recentExceptionFingerprints_1 = __values(recentExceptionFingerprints), recentExceptionFingerprints_1_1 = recentExceptionFingerprints_1.next(); !recentExceptionFingerprints_1_1.done; recentExceptionFingerprints_1_1 = recentExceptionFingerprints_1.next()) {
|
|
31787
|
+
var _b = __read(recentExceptionFingerprints_1_1.value, 2), key = _b[0], ts = _b[1];
|
|
31788
|
+
if (now - ts > exceptionDedupeWindowMs * 5) {
|
|
31789
|
+
recentExceptionFingerprints.delete(key);
|
|
31790
|
+
}
|
|
31791
|
+
}
|
|
31792
|
+
}
|
|
31793
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
31794
|
+
finally {
|
|
31795
|
+
try {
|
|
31796
|
+
if (recentExceptionFingerprints_1_1 && !recentExceptionFingerprints_1_1.done && (_a = recentExceptionFingerprints_1.return)) _a.call(recentExceptionFingerprints_1);
|
|
31797
|
+
}
|
|
31798
|
+
finally { if (e_1) throw e_1.error; }
|
|
31799
|
+
}
|
|
31800
|
+
return true;
|
|
31801
|
+
};
|
|
31792
31802
|
//# sourceMappingURL=capture-exception.js.map
|
|
31793
31803
|
|
|
31794
31804
|
/***/ }),
|
|
@@ -31849,7 +31859,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31849
31859
|
/* harmony export */ setMessageBody: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setMessageBody),
|
|
31850
31860
|
/* harmony export */ setResourceAttributes: () => (/* reexport safe */ _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__.setResourceAttributes),
|
|
31851
31861
|
/* harmony export */ setRpcRequestMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcRequestMessage),
|
|
31852
|
-
/* harmony export */ setRpcResponseMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcResponseMessage)
|
|
31862
|
+
/* harmony export */ setRpcResponseMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcResponseMessage),
|
|
31863
|
+
/* harmony export */ shouldCaptureException: () => (/* reexport safe */ _capture_exception__WEBPACK_IMPORTED_MODULE_4__.shouldCaptureException)
|
|
31853
31864
|
/* harmony export */ });
|
|
31854
31865
|
/* harmony import */ var _mask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mask */ "../session-recorder-common/dist/esm/sdk/mask.js");
|
|
31855
31866
|
/* harmony import */ var _schemify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./schemify */ "../session-recorder-common/dist/esm/sdk/schemify.js");
|