@multiplayer-app/session-recorder-browser 1.3.26 → 1.3.28
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 +348 -124
- package/dist/exporters/index.js +1 -1
- package/dist/exporters/index.js.LICENSE.txt +12 -0
- package/dist/exporters/index.js.map +1 -1
- package/dist/index.js +346 -124
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +347 -124
- package/dist/index.umd.js.map +1 -1
- package/dist/otel/CrashBufferSpanProcessor.d.ts +2 -3
- package/dist/otel/CrashBufferSpanProcessor.d.ts.map +1 -1
- package/dist/otel/CrashBufferSpanProcessor.js +11 -12
- package/dist/otel/CrashBufferSpanProcessor.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 +73 -50
- package/dist/otel/index.js.map +1 -1
- package/dist/services/crashBuffer.service.d.ts.map +1 -1
- package/dist/services/crashBuffer.service.js +40 -7
- package/dist/services/crashBuffer.service.js.map +1 -1
- package/dist/services/indexedDb.service.d.ts +11 -1
- package/dist/services/indexedDb.service.d.ts.map +1 -1
- package/dist/services/indexedDb.service.js +47 -3
- package/dist/services/indexedDb.service.js.map +1 -1
- package/dist/session-recorder.d.ts.map +1 -1
- package/dist/session-recorder.js +6 -5
- package/dist/session-recorder.js.map +1 -1
- package/package.json +2 -2
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.
|
|
24329
|
+
const PACKAGE_VERSION_EXPORT = "1.3.28" || 0;
|
|
24330
24330
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
24331
24331
|
const OTEL_IGNORE_URLS = [
|
|
24332
24332
|
// Traces endpoint
|
|
@@ -24995,31 +24995,30 @@ class NavigationRecorder {
|
|
|
24995
24995
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24996
24996
|
/* harmony export */ CrashBufferSpanProcessor: () => (/* binding */ CrashBufferSpanProcessor)
|
|
24997
24997
|
/* harmony export */ });
|
|
24998
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js");
|
|
24999
24998
|
/* 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");
|
|
25000
24999
|
|
|
25001
|
-
|
|
25002
25000
|
/**
|
|
25003
25001
|
* Implementation of the {@link SpanProcessor} that batches spans exported by
|
|
25004
25002
|
* the SDK then pushes them to the exporter pipeline.
|
|
25005
25003
|
*/
|
|
25006
25004
|
class CrashBufferSpanProcessor {
|
|
25007
|
-
constructor(
|
|
25008
|
-
this._exporter = _exporter;
|
|
25005
|
+
constructor(_crashBuffer, _serializeSpan) {
|
|
25009
25006
|
this._crashBuffer = _crashBuffer;
|
|
25010
25007
|
this._serializeSpan = _serializeSpan;
|
|
25011
25008
|
}
|
|
25012
25009
|
forceFlush() {
|
|
25013
|
-
return
|
|
25010
|
+
return Promise.resolve();
|
|
25014
25011
|
}
|
|
25015
25012
|
onStart(_span, _parentContext) {
|
|
25016
|
-
return
|
|
25013
|
+
return;
|
|
25017
25014
|
}
|
|
25018
25015
|
onEnd(span) {
|
|
25019
|
-
const
|
|
25020
|
-
|
|
25021
|
-
|
|
25022
|
-
|
|
25016
|
+
const _spanContext = span.spanContext();
|
|
25017
|
+
const traceId = _spanContext.traceId;
|
|
25018
|
+
// // Never buffer/export unsampled spans.
|
|
25019
|
+
// if ((_spanContext.traceFlags & TraceFlags.SAMPLED) === 0) {
|
|
25020
|
+
// return
|
|
25021
|
+
// }
|
|
25023
25022
|
if (traceId.startsWith(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX)) {
|
|
25024
25023
|
if (this._crashBuffer) {
|
|
25025
25024
|
this._crashBuffer.appendSpans([
|
|
@@ -25031,10 +25030,9 @@ class CrashBufferSpanProcessor {
|
|
|
25031
25030
|
}
|
|
25032
25031
|
return;
|
|
25033
25032
|
}
|
|
25034
|
-
this._exporter.onEnd(span);
|
|
25035
25033
|
}
|
|
25036
25034
|
shutdown() {
|
|
25037
|
-
return
|
|
25035
|
+
return Promise.resolve();
|
|
25038
25036
|
}
|
|
25039
25037
|
}
|
|
25040
25038
|
|
|
@@ -25279,17 +25277,14 @@ const getElementTextContent = (element) => {
|
|
|
25279
25277
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
25280
25278
|
/* harmony export */ TracerBrowserSDK: () => (/* binding */ TracerBrowserSDK)
|
|
25281
25279
|
/* harmony export */ });
|
|
25282
|
-
/* harmony import */ var
|
|
25280
|
+
/* harmony import */ var _opentelemetry_resources__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @opentelemetry/resources */ "../../node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js");
|
|
25283
25281
|
/* harmony import */ var _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @opentelemetry/core */ "../../node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js");
|
|
25284
|
-
/* harmony import */ var
|
|
25285
|
-
/* harmony import */ var
|
|
25286
|
-
/* harmony import */ var
|
|
25282
|
+
/* harmony import */ var _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @opentelemetry/sdk-trace-web */ "../../node_modules/@opentelemetry/sdk-trace-web/build/esm/WebTracerProvider.js");
|
|
25283
|
+
/* harmony import */ var _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @opentelemetry/sdk-trace-base */ "../../node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js");
|
|
25284
|
+
/* harmony import */ var _opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @opentelemetry/semantic-conventions */ "../../node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js");
|
|
25287
25285
|
/* harmony import */ var _opentelemetry_instrumentation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @opentelemetry/instrumentation */ "../../node_modules/@opentelemetry/instrumentation/build/esm/autoLoader.js");
|
|
25288
25286
|
/* 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");
|
|
25289
25287
|
/* harmony import */ var _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiplayer-app/session-recorder-common */ "../session-recorder-common/dist/esm/index-browser.js");
|
|
25290
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
25291
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/context-api.js");
|
|
25292
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/status.js");
|
|
25293
25288
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config/index.ts");
|
|
25294
25289
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/otel/helpers.ts");
|
|
25295
25290
|
/* harmony import */ var _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CrashBufferSpanProcessor */ "./src/otel/CrashBufferSpanProcessor.ts");
|
|
@@ -25304,7 +25299,6 @@ const getElementTextContent = (element) => {
|
|
|
25304
25299
|
|
|
25305
25300
|
|
|
25306
25301
|
|
|
25307
|
-
|
|
25308
25302
|
const clientIdGenerator = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.getIdGenerator(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.MULTIPLAYER_TRACE_CLIENT_ID_LENGTH);
|
|
25309
25303
|
class TracerBrowserSDK {
|
|
25310
25304
|
constructor() {
|
|
@@ -25330,18 +25324,20 @@ class TracerBrowserSDK {
|
|
|
25330
25324
|
url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
|
|
25331
25325
|
usePostMessageFallback: options.usePostMessageFallback,
|
|
25332
25326
|
});
|
|
25333
|
-
|
|
25334
|
-
|
|
25335
|
-
|
|
25336
|
-
|
|
25337
|
-
|
|
25338
|
-
|
|
25339
|
-
|
|
25327
|
+
const resourceAttributes = (0,_opentelemetry_resources__WEBPACK_IMPORTED_MODULE_5__.resourceFromAttributes)({
|
|
25328
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__.SEMRESATTRS_SERVICE_NAME]: application,
|
|
25329
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__.SEMRESATTRS_SERVICE_VERSION]: version,
|
|
25330
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment,
|
|
25331
|
+
});
|
|
25332
|
+
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.setResourceAttributes(resourceAttributes.attributes);
|
|
25333
|
+
this.tracerProvider = new _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_7__.WebTracerProvider({
|
|
25334
|
+
resource: resourceAttributes,
|
|
25340
25335
|
idGenerator: this.idGenerator,
|
|
25341
25336
|
sampler: new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio),
|
|
25342
25337
|
spanProcessors: [
|
|
25343
25338
|
this._getSpanSessionIdProcessor(),
|
|
25344
|
-
new
|
|
25339
|
+
new _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_8__.BatchSpanProcessor(this.exporter),
|
|
25340
|
+
new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__.CrashBufferSpanProcessor(this.crashBuffer, this.exporter.serializeSpan),
|
|
25345
25341
|
],
|
|
25346
25342
|
});
|
|
25347
25343
|
this.tracerProvider.register({
|
|
@@ -25472,13 +25468,70 @@ class TracerBrowserSDK {
|
|
|
25472
25468
|
}
|
|
25473
25469
|
this.exporter.setApiKey(apiKey);
|
|
25474
25470
|
}
|
|
25475
|
-
|
|
25471
|
+
static _toReadableSpanLike(span) {
|
|
25476
25472
|
var _a;
|
|
25477
|
-
if (
|
|
25478
|
-
|
|
25479
|
-
|
|
25473
|
+
if (span && typeof span.spanContext === 'function' && span.instrumentationScope) {
|
|
25474
|
+
return span;
|
|
25475
|
+
}
|
|
25476
|
+
const spanContext = typeof (span === null || span === void 0 ? void 0 : span.spanContext) === 'function' ? span.spanContext() : span === null || span === void 0 ? void 0 : span._spanContext;
|
|
25477
|
+
const normalizedCtx = spanContext ||
|
|
25478
|
+
{
|
|
25479
|
+
traceId: span === null || span === void 0 ? void 0 : span.traceId,
|
|
25480
|
+
spanId: span === null || span === void 0 ? void 0 : span.spanId,
|
|
25481
|
+
traceFlags: span === null || span === void 0 ? void 0 : span.traceFlags,
|
|
25482
|
+
traceState: span === null || span === void 0 ? void 0 : span.traceState,
|
|
25483
|
+
};
|
|
25484
|
+
const instrumentationScope = (span === null || span === void 0 ? void 0 : span.instrumentationScope) ||
|
|
25485
|
+
(span === null || span === void 0 ? void 0 : span.instrumentationLibrary) ||
|
|
25486
|
+
{ name: 'multiplayer-buffer', version: undefined, schemaUrl: undefined };
|
|
25487
|
+
const normalizedScope = {
|
|
25488
|
+
name: (instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.name) || 'multiplayer-buffer',
|
|
25489
|
+
version: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.version,
|
|
25490
|
+
schemaUrl: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.schemaUrl,
|
|
25491
|
+
};
|
|
25492
|
+
const resource = (span === null || span === void 0 ? void 0 : span.resource) || { attributes: {}, asyncAttributesPending: false };
|
|
25493
|
+
const parentSpanId = span === null || span === void 0 ? void 0 : span.parentSpanId;
|
|
25494
|
+
return {
|
|
25495
|
+
name: (span === null || span === void 0 ? void 0 : span.name) || '',
|
|
25496
|
+
kind: span === null || span === void 0 ? void 0 : span.kind,
|
|
25497
|
+
spanContext: () => normalizedCtx,
|
|
25498
|
+
parentSpanContext: parentSpanId
|
|
25499
|
+
? {
|
|
25500
|
+
traceId: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceId,
|
|
25501
|
+
spanId: parentSpanId,
|
|
25502
|
+
traceFlags: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceFlags,
|
|
25503
|
+
traceState: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceState,
|
|
25504
|
+
}
|
|
25505
|
+
: undefined,
|
|
25506
|
+
startTime: span === null || span === void 0 ? void 0 : span.startTime,
|
|
25507
|
+
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,
|
|
25508
|
+
duration: span === null || span === void 0 ? void 0 : span.duration,
|
|
25509
|
+
status: span === null || span === void 0 ? void 0 : span.status,
|
|
25510
|
+
attributes: (span === null || span === void 0 ? void 0 : span.attributes) || {},
|
|
25511
|
+
links: (span === null || span === void 0 ? void 0 : span.links) || [],
|
|
25512
|
+
events: (span === null || span === void 0 ? void 0 : span.events) || [],
|
|
25513
|
+
ended: typeof (span === null || span === void 0 ? void 0 : span.ended) === 'boolean' ? span.ended : true,
|
|
25514
|
+
droppedAttributesCount: (span === null || span === void 0 ? void 0 : span.droppedAttributesCount) || 0,
|
|
25515
|
+
droppedEventsCount: (span === null || span === void 0 ? void 0 : span.droppedEventsCount) || 0,
|
|
25516
|
+
droppedLinksCount: (span === null || span === void 0 ? void 0 : span.droppedLinksCount) || 0,
|
|
25517
|
+
resource,
|
|
25518
|
+
instrumentationScope: normalizedScope,
|
|
25519
|
+
};
|
|
25520
|
+
}
|
|
25521
|
+
async exportTraces(spans) {
|
|
25522
|
+
if (!this.exporter) {
|
|
25523
|
+
throw new Error('Trace exporter not initialized');
|
|
25524
|
+
}
|
|
25525
|
+
if (!spans || spans.length === 0) {
|
|
25526
|
+
return Promise.resolve();
|
|
25480
25527
|
}
|
|
25481
|
-
|
|
25528
|
+
const readableSpans = spans.map((s) => TracerBrowserSDK._toReadableSpanLike(s));
|
|
25529
|
+
return new Promise((resolve) => {
|
|
25530
|
+
var _a;
|
|
25531
|
+
(_a = this.exporter) === null || _a === void 0 ? void 0 : _a.exportBuffer(readableSpans, (result) => {
|
|
25532
|
+
resolve(result);
|
|
25533
|
+
});
|
|
25534
|
+
});
|
|
25482
25535
|
}
|
|
25483
25536
|
/**
|
|
25484
25537
|
* Capture an exception as an error span/event.
|
|
@@ -25486,42 +25539,7 @@ class TracerBrowserSDK {
|
|
|
25486
25539
|
* Otherwise, a short-lived span will be created to hold the exception event.
|
|
25487
25540
|
*/
|
|
25488
25541
|
captureException(error, errorInfo) {
|
|
25489
|
-
|
|
25490
|
-
if (!error)
|
|
25491
|
-
return;
|
|
25492
|
-
// Prefer attaching to the active span to keep correlation intact
|
|
25493
|
-
try {
|
|
25494
|
-
const activeSpan = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__.trace.getSpan(_opentelemetry_api__WEBPACK_IMPORTED_MODULE_12__.context.active());
|
|
25495
|
-
if (activeSpan) {
|
|
25496
|
-
this._recordException(activeSpan, error, errorInfo);
|
|
25497
|
-
(_a = this.tracerProvider) === null || _a === void 0 ? void 0 : _a.forceFlush();
|
|
25498
|
-
return;
|
|
25499
|
-
}
|
|
25500
|
-
// eslint-disable-next-line
|
|
25501
|
-
}
|
|
25502
|
-
catch (_ignored) { }
|
|
25503
|
-
// Fallback: create a short-lived span to hold the exception details
|
|
25504
|
-
try {
|
|
25505
|
-
const tracer = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__.trace.getTracer('exception');
|
|
25506
|
-
const span = tracer.startSpan(error.name || 'Error');
|
|
25507
|
-
this._recordException(span, error, errorInfo);
|
|
25508
|
-
span.end();
|
|
25509
|
-
(_b = this.tracerProvider) === null || _b === void 0 ? void 0 : _b.forceFlush();
|
|
25510
|
-
// eslint-disable-next-line
|
|
25511
|
-
}
|
|
25512
|
-
catch (_ignored) { }
|
|
25513
|
-
}
|
|
25514
|
-
_recordException(span, error, errorInfo) {
|
|
25515
|
-
span.recordException(error);
|
|
25516
|
-
span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__.SpanStatusCode.ERROR, message: error.message });
|
|
25517
|
-
span.setAttribute('exception.type', error.name || 'Error');
|
|
25518
|
-
span.setAttribute('exception.message', error.message);
|
|
25519
|
-
span.setAttribute('exception.stacktrace', error.stack || '');
|
|
25520
|
-
if (errorInfo) {
|
|
25521
|
-
Object.entries(errorInfo).forEach(([key, value]) => {
|
|
25522
|
-
span.setAttribute(`error_info.${key}`, value);
|
|
25523
|
-
});
|
|
25524
|
-
}
|
|
25542
|
+
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.captureException(error, errorInfo);
|
|
25525
25543
|
}
|
|
25526
25544
|
_getSpanSessionIdProcessor() {
|
|
25527
25545
|
return {
|
|
@@ -26373,7 +26391,9 @@ class ApiService {
|
|
|
26373
26391
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26374
26392
|
/* harmony export */ CrashBufferService: () => (/* binding */ CrashBufferService)
|
|
26375
26393
|
/* harmony export */ });
|
|
26376
|
-
/* harmony import */ var
|
|
26394
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/status.js");
|
|
26395
|
+
/* harmony import */ var _rrweb_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rrweb/types */ "../../node_modules/@rrweb/types/dist/types.js");
|
|
26396
|
+
|
|
26377
26397
|
|
|
26378
26398
|
class CrashBufferService {
|
|
26379
26399
|
constructor(db, tabId, windowMs) {
|
|
@@ -26406,12 +26426,16 @@ class CrashBufferService {
|
|
|
26406
26426
|
}, undefined);
|
|
26407
26427
|
}
|
|
26408
26428
|
async appendEvent(payload, _windowMs) {
|
|
26429
|
+
var _a;
|
|
26409
26430
|
this.lastSeenEventTs = Math.max(this.lastSeenEventTs, payload.ts || 0);
|
|
26410
26431
|
if (!this.isActive)
|
|
26411
26432
|
return;
|
|
26412
26433
|
const isFullSnapshot = Boolean(payload.isFullSnapshot);
|
|
26413
|
-
|
|
26414
|
-
|
|
26434
|
+
const eventType = (_a = payload === null || payload === void 0 ? void 0 : payload.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
26435
|
+
const isMeta = eventType === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta;
|
|
26436
|
+
if (this.requiresFullSnapshot && !isFullSnapshot && !isMeta) {
|
|
26437
|
+
// rrweb replayable prefix is Meta -> FullSnapshot.
|
|
26438
|
+
// While waiting for the first FullSnapshot, we still keep the Meta event (but drop incrementals).
|
|
26415
26439
|
return;
|
|
26416
26440
|
}
|
|
26417
26441
|
await this._safe(async () => {
|
|
@@ -26424,8 +26448,8 @@ class CrashBufferService {
|
|
|
26424
26448
|
}, undefined);
|
|
26425
26449
|
if (isFullSnapshot && this.requiresFullSnapshot) {
|
|
26426
26450
|
// Ensure this snapshot becomes the first replayable event.
|
|
26427
|
-
//
|
|
26428
|
-
await this._safe(() => this.db.
|
|
26451
|
+
// Keep Meta + FullSnapshot (if present) and prune everything older.
|
|
26452
|
+
await this._safe(() => this.db.pruneOlderThanWithRrwebSnapshotAnchor(this.tabId, payload.ts), undefined);
|
|
26429
26453
|
this.requiresFullSnapshot = false;
|
|
26430
26454
|
}
|
|
26431
26455
|
else if (isFullSnapshot) {
|
|
@@ -26443,7 +26467,7 @@ class CrashBufferService {
|
|
|
26443
26467
|
await this._safe(async () => {
|
|
26444
26468
|
const records = payload.map((p) => {
|
|
26445
26469
|
var _a, _b;
|
|
26446
|
-
if (!errorEvent && ((_b = (_a = p === null || p === void 0 ? void 0 : p.span) === null || _a === void 0 ? void 0 : _a.status) === null || _b === void 0 ? void 0 : _b.code) ===
|
|
26470
|
+
if (!errorEvent && ((_b = (_a = p === null || p === void 0 ? void 0 : p.span) === null || _a === void 0 ? void 0 : _a.status) === null || _b === void 0 ? void 0 : _b.code) === _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.SpanStatusCode.ERROR) {
|
|
26447
26471
|
errorEvent = { ts: p.ts, span: p.span };
|
|
26448
26472
|
}
|
|
26449
26473
|
return {
|
|
@@ -26488,6 +26512,7 @@ class CrashBufferService {
|
|
|
26488
26512
|
}
|
|
26489
26513
|
}
|
|
26490
26514
|
async snapshot(_windowMs, now = Date.now()) {
|
|
26515
|
+
var _a, _b;
|
|
26491
26516
|
const toTs = now;
|
|
26492
26517
|
const fromTs = Math.max(0, toTs - this.windowMs);
|
|
26493
26518
|
// Always include a full snapshot "anchor" if one exists at/before the window start.
|
|
@@ -26503,10 +26528,37 @@ class CrashBufferService {
|
|
|
26503
26528
|
const rrwebSorted = rrweb
|
|
26504
26529
|
.sort((a, b) => a.ts - b.ts)
|
|
26505
26530
|
.map((r) => ({ ts: r.ts, isFullSnapshot: r.isFullSnapshot, event: r.event }));
|
|
26506
|
-
// Hard guarantee: snapshot payload starts with
|
|
26531
|
+
// Hard guarantee: snapshot payload starts with Meta -> FullSnapshot (or is empty).
|
|
26507
26532
|
const firstFullSnapshotIdx = rrwebSorted.findIndex((e) => Boolean(e.isFullSnapshot));
|
|
26508
|
-
|
|
26509
|
-
|
|
26533
|
+
if (firstFullSnapshotIdx < 0) {
|
|
26534
|
+
return {
|
|
26535
|
+
rrwebEvents: [],
|
|
26536
|
+
otelSpans: [],
|
|
26537
|
+
attrs: attrs
|
|
26538
|
+
? {
|
|
26539
|
+
sessionAttributes: attrs.sessionAttributes,
|
|
26540
|
+
resourceAttributes: attrs.resourceAttributes,
|
|
26541
|
+
userAttributes: attrs.userAttributes,
|
|
26542
|
+
}
|
|
26543
|
+
: null,
|
|
26544
|
+
windowMs: this.windowMs,
|
|
26545
|
+
fromTs,
|
|
26546
|
+
toTs,
|
|
26547
|
+
};
|
|
26548
|
+
}
|
|
26549
|
+
// Prefer including the Meta event immediately preceding the first FullSnapshot.
|
|
26550
|
+
let startIdx = firstFullSnapshotIdx;
|
|
26551
|
+
for (let i = firstFullSnapshotIdx - 1; i >= 0; i--) {
|
|
26552
|
+
const t = (_b = (_a = rrwebSorted[i]) === null || _a === void 0 ? void 0 : _a.event) === null || _b === void 0 ? void 0 : _b.eventType;
|
|
26553
|
+
if (t === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta) {
|
|
26554
|
+
startIdx = i;
|
|
26555
|
+
break;
|
|
26556
|
+
}
|
|
26557
|
+
}
|
|
26558
|
+
const rrwebEvents = rrwebSorted.slice(startIdx);
|
|
26559
|
+
// Align spans with the rrweb replay start (Meta if present, otherwise FullSnapshot).
|
|
26560
|
+
// Important: we return `fromTs` to consumers and many UIs compute relative offsets from it,
|
|
26561
|
+
// so `fromTs` must match the first rrweb event timestamp we return.
|
|
26510
26562
|
const replayStartTs = rrwebEvents.length > 0 ? rrwebEvents[0].ts : fromTs;
|
|
26511
26563
|
const otelSpans = spans
|
|
26512
26564
|
.filter((s) => typeof (s === null || s === void 0 ? void 0 : s.ts) === 'number' && s.ts >= replayStartTs)
|
|
@@ -26594,12 +26646,14 @@ class CrashBufferService {
|
|
|
26594
26646
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26595
26647
|
/* harmony export */ IndexedDBService: () => (/* binding */ IndexedDBService)
|
|
26596
26648
|
/* harmony export */ });
|
|
26649
|
+
/* harmony import */ var _rrweb_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rrweb/types */ "../../node_modules/@rrweb/types/dist/types.js");
|
|
26597
26650
|
const dbName = 'mpEventsDB';
|
|
26598
26651
|
const dbVersion = 2;
|
|
26599
26652
|
const legacyStoreName = 'mpEventsStore';
|
|
26600
26653
|
const rrwebEventsStore = 'rrwebEvents';
|
|
26601
26654
|
const otelSpansStore = 'otelSpans';
|
|
26602
26655
|
const attrsStore = 'crashBufferAttrs';
|
|
26656
|
+
|
|
26603
26657
|
class IndexedDBService {
|
|
26604
26658
|
constructor() {
|
|
26605
26659
|
this.dbPromise = this.openDB();
|
|
@@ -26807,6 +26861,40 @@ class IndexedDBService {
|
|
|
26807
26861
|
req.onerror = () => reject(req.error);
|
|
26808
26862
|
});
|
|
26809
26863
|
}
|
|
26864
|
+
/**
|
|
26865
|
+
* Returns the last (highest-ts) Meta event record at/before `cutoffTs`.
|
|
26866
|
+
*
|
|
26867
|
+
* rrweb replays expect the stream to begin with:
|
|
26868
|
+
* - Meta
|
|
26869
|
+
* - FullSnapshot
|
|
26870
|
+
*
|
|
26871
|
+
* We persist packed events (plus a small wrapper) so we detect Meta via `record.event.eventType`.
|
|
26872
|
+
*/
|
|
26873
|
+
async getLastRrwebMetaBefore(tabId, cutoffTs) {
|
|
26874
|
+
const db = await this.dbPromise;
|
|
26875
|
+
const range = IDBKeyRange.bound([tabId, 0], [tabId, cutoffTs]);
|
|
26876
|
+
return new Promise((resolve, reject) => {
|
|
26877
|
+
const tx = db.transaction(rrwebEventsStore, 'readonly');
|
|
26878
|
+
const idx = tx.objectStore(rrwebEventsStore).index('tabId_ts');
|
|
26879
|
+
const req = idx.openCursor(range, 'prev');
|
|
26880
|
+
req.onsuccess = () => {
|
|
26881
|
+
var _a;
|
|
26882
|
+
const cursor = req.result;
|
|
26883
|
+
if (!cursor) {
|
|
26884
|
+
resolve(null);
|
|
26885
|
+
return;
|
|
26886
|
+
}
|
|
26887
|
+
const value = cursor.value;
|
|
26888
|
+
const eventType = (_a = value === null || value === void 0 ? void 0 : value.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
26889
|
+
if (eventType === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta) {
|
|
26890
|
+
resolve(value);
|
|
26891
|
+
return;
|
|
26892
|
+
}
|
|
26893
|
+
cursor.continue();
|
|
26894
|
+
};
|
|
26895
|
+
req.onerror = () => reject(req.error);
|
|
26896
|
+
});
|
|
26897
|
+
}
|
|
26810
26898
|
async getOtelSpansWindow(tabId, fromTs, toTs) {
|
|
26811
26899
|
const db = await this.dbPromise;
|
|
26812
26900
|
const range = IDBKeyRange.bound([tabId, fromTs], [tabId, toTs]);
|
|
@@ -26853,15 +26941,24 @@ class IndexedDBService {
|
|
|
26853
26941
|
}
|
|
26854
26942
|
/**
|
|
26855
26943
|
* Prune older data while keeping rrweb replayability:
|
|
26856
|
-
* - rrweb: keep the last FullSnapshot at/before cutoff as an "anchor"
|
|
26944
|
+
* - rrweb: keep the last Meta + FullSnapshot pair at/before cutoff as an "anchor"
|
|
26857
26945
|
* - spans: prune strictly by cutoff
|
|
26858
26946
|
*/
|
|
26859
26947
|
async pruneOlderThanWithRrwebSnapshotAnchor(tabId, cutoffTs) {
|
|
26860
26948
|
const db = await this.dbPromise;
|
|
26861
26949
|
const anchor = await this.getLastRrwebFullSnapshotBefore(tabId, cutoffTs);
|
|
26862
|
-
// rrweb: delete everything strictly older than the anchor
|
|
26950
|
+
// rrweb: delete everything strictly older than the anchor meta event (if any),
|
|
26951
|
+
// otherwise strictly older than the anchor snapshot (keep the anchor itself).
|
|
26952
|
+
//
|
|
26953
|
+
// This preserves rrweb's expected replay prefix:
|
|
26954
|
+
// Meta -> FullSnapshot
|
|
26955
|
+
const anchorMeta = anchor ? await this.getLastRrwebMetaBefore(tabId, anchor.ts) : null;
|
|
26863
26956
|
// spans: delete everything older than cutoffTs
|
|
26864
|
-
const rrwebCutoffTs = typeof (
|
|
26957
|
+
const rrwebCutoffTs = typeof (anchorMeta === null || anchorMeta === void 0 ? void 0 : anchorMeta.ts) === 'number'
|
|
26958
|
+
? Math.max(0, anchorMeta.ts - 1)
|
|
26959
|
+
: typeof (anchor === null || anchor === void 0 ? void 0 : anchor.ts) === 'number'
|
|
26960
|
+
? Math.max(0, anchor.ts - 1)
|
|
26961
|
+
: cutoffTs;
|
|
26865
26962
|
const rrwebRange = IDBKeyRange.bound([tabId, 0], [tabId, rrwebCutoffTs]);
|
|
26866
26963
|
const spansRange = IDBKeyRange.bound([tabId, 0], [tabId, cutoffTs]);
|
|
26867
26964
|
const pruneStore = (store, range) => new Promise((resolve, reject) => {
|
|
@@ -27496,6 +27593,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27496
27593
|
return;
|
|
27497
27594
|
if (!payload.span)
|
|
27498
27595
|
return;
|
|
27596
|
+
console.log('error-span-appended', payload);
|
|
27499
27597
|
this._createExceptionSession(payload.span);
|
|
27500
27598
|
});
|
|
27501
27599
|
this._registerCrashBufferLifecycleHandlers();
|
|
@@ -27731,11 +27829,6 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27731
27829
|
return null;
|
|
27732
27830
|
this._isFlushingBuffer = true;
|
|
27733
27831
|
try {
|
|
27734
|
-
// await this._crashBuffer.setAttrs({
|
|
27735
|
-
// sessionAttributes: this.sessionAttributes,
|
|
27736
|
-
// resourceAttributes: getNavigatorInfo(),
|
|
27737
|
-
// userAttributes: this._userAttributes
|
|
27738
|
-
// })
|
|
27739
27832
|
const snapshot = await this._crashBuffer.snapshot();
|
|
27740
27833
|
if (snapshot.rrwebEvents.length === 0 && snapshot.otelSpans.length === 0) {
|
|
27741
27834
|
return null;
|
|
@@ -27748,6 +27841,8 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27748
27841
|
this._apiService.exportEvents(sessionId, { events }),
|
|
27749
27842
|
this._apiService.updateSessionAttributes(sessionId, {
|
|
27750
27843
|
name: this._getSessionName(),
|
|
27844
|
+
// startedAt: new Date(snapshot.rrwebEvents[0].ts).toISOString(),
|
|
27845
|
+
// stoppedAt: new Date().toISOString(),
|
|
27751
27846
|
sessionAttributes: this.sessionAttributes,
|
|
27752
27847
|
resourceAttributes: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getNavigatorInfo)(),
|
|
27753
27848
|
userAttributes: this._userAttributes || undefined
|
|
@@ -27932,6 +28027,9 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27932
28027
|
async _createExceptionSession(span) {
|
|
27933
28028
|
try {
|
|
27934
28029
|
const session = await this._apiService.createErrorSession({ span });
|
|
28030
|
+
console.log('====================================');
|
|
28031
|
+
console.log(span);
|
|
28032
|
+
console.log('====================================');
|
|
27935
28033
|
if (session) {
|
|
27936
28034
|
void this._flushBuffer(session._id);
|
|
27937
28035
|
}
|
|
@@ -30246,12 +30344,14 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
|
|
|
30246
30344
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30247
30345
|
/* harmony export */ SessionRecorderTraceIdRatioBasedSampler: () => (/* binding */ SessionRecorderTraceIdRatioBasedSampler)
|
|
30248
30346
|
/* harmony export */ });
|
|
30249
|
-
/* harmony import */ var
|
|
30250
|
-
/* harmony import */ var
|
|
30347
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js");
|
|
30348
|
+
/* harmony import */ var _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/sdk-trace-base */ "../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js");
|
|
30349
|
+
/* harmony import */ var _opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/semantic-conventions */ "../../node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js");
|
|
30251
30350
|
/* harmony import */ var _constants_constants_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/constants.base */ "../session-recorder-common/dist/esm/constants/constants.base.js");
|
|
30252
30351
|
|
|
30253
30352
|
|
|
30254
30353
|
|
|
30354
|
+
|
|
30255
30355
|
var SessionRecorderTraceIdRatioBasedSampler = /** @class */ (function () {
|
|
30256
30356
|
function SessionRecorderTraceIdRatioBasedSampler(_ratio) {
|
|
30257
30357
|
if (_ratio === void 0) { _ratio = 0; }
|
|
@@ -30259,20 +30359,25 @@ var SessionRecorderTraceIdRatioBasedSampler = /** @class */ (function () {
|
|
|
30259
30359
|
this._ratio = this._normalize(_ratio);
|
|
30260
30360
|
this._upperBound = Math.floor(this._ratio * 0xffffffff);
|
|
30261
30361
|
}
|
|
30262
|
-
SessionRecorderTraceIdRatioBasedSampler.prototype.shouldSample = function (context, traceId) {
|
|
30362
|
+
SessionRecorderTraceIdRatioBasedSampler.prototype.shouldSample = function (context, traceId, spanName, spanKind, attributes, links) {
|
|
30363
|
+
if (attributes[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_1__.ATTR_EXCEPTION_MESSAGE] || attributes[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_1__.ATTR_EXCEPTION_STACKTRACE] || attributes[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_1__.ATTR_EXCEPTION_TYPE]) {
|
|
30364
|
+
return {
|
|
30365
|
+
decision: _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.RECORD_AND_SAMPLED,
|
|
30366
|
+
};
|
|
30367
|
+
}
|
|
30263
30368
|
if (traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_DEBUG_PREFIX)
|
|
30264
30369
|
|| traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX)
|
|
30265
|
-
|
|
30370
|
+
|| traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX)
|
|
30266
30371
|
// || traceId.startsWith(MULTIPLAYER_TRACE_CONTINUOUS_SESSION_CACHE_PREFIX)
|
|
30267
30372
|
) {
|
|
30268
30373
|
return {
|
|
30269
|
-
decision:
|
|
30374
|
+
decision: _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.RECORD_AND_SAMPLED,
|
|
30270
30375
|
};
|
|
30271
30376
|
}
|
|
30272
|
-
var decision =
|
|
30273
|
-
if ((0,
|
|
30377
|
+
var decision = _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.NOT_RECORD;
|
|
30378
|
+
if ((0,_opentelemetry_api__WEBPACK_IMPORTED_MODULE_3__.isValidTraceId)(traceId)
|
|
30274
30379
|
&& this._accumulate(traceId) < this._upperBound) {
|
|
30275
|
-
decision =
|
|
30380
|
+
decision = _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.RECORD_AND_SAMPLED;
|
|
30276
30381
|
}
|
|
30277
30382
|
return { decision: decision };
|
|
30278
30383
|
};
|
|
@@ -30374,7 +30479,7 @@ var MULTIPLAYER_TRACE_PREFIX_MAP = (_a = {},
|
|
|
30374
30479
|
_a[_type__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL] = MULTIPLAYER_TRACE_DEBUG_PREFIX,
|
|
30375
30480
|
_a);
|
|
30376
30481
|
var MULTIPLAYER_TRACE_DEBUG_SESSION_SHORT_ID_LENGTH = 8;
|
|
30377
|
-
var MULTIPLAYER_TRACE_CLIENT_ID_LENGTH =
|
|
30482
|
+
var MULTIPLAYER_TRACE_CLIENT_ID_LENGTH = 4;
|
|
30378
30483
|
/**
|
|
30379
30484
|
* @deprecated Use MULTIPLAYER_OTEL_DEFAULT_TRACES_EXPORTER_HTTP_URL instead
|
|
30380
30485
|
*/
|
|
@@ -30526,46 +30631,48 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
30526
30631
|
this.postMessageTargetOrigin = postMessageTargetOrigin;
|
|
30527
30632
|
this.exporter = this._createExporter();
|
|
30528
30633
|
}
|
|
30529
|
-
SessionRecorderBrowserTraceExporter.prototype.
|
|
30634
|
+
SessionRecorderBrowserTraceExporter.prototype._export = function (spans, resultCallback) {
|
|
30530
30635
|
var _this = this;
|
|
30531
|
-
// Filter spans to only include those with Multiplayer trace prefixes
|
|
30532
|
-
var filteredSpans = spans.filter(function (span) {
|
|
30533
|
-
var traceId = span.spanContext().traceId;
|
|
30534
|
-
return (traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_DEBUG_PREFIX) ||
|
|
30535
|
-
traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX));
|
|
30536
|
-
});
|
|
30537
30636
|
// Only proceed if there are filtered spans
|
|
30538
|
-
if (
|
|
30637
|
+
if (spans.length === 0) {
|
|
30539
30638
|
resultCallback({ code: 0 });
|
|
30540
30639
|
return;
|
|
30541
30640
|
}
|
|
30542
30641
|
if (this.usePostMessage) {
|
|
30543
|
-
this.exportViaPostMessage(
|
|
30642
|
+
this.exportViaPostMessage(spans, resultCallback);
|
|
30544
30643
|
return;
|
|
30545
30644
|
}
|
|
30546
|
-
this.exporter.export(
|
|
30645
|
+
this.exporter.export(spans, function (result) {
|
|
30547
30646
|
if (result.code === 0) {
|
|
30548
30647
|
resultCallback(result);
|
|
30549
30648
|
}
|
|
30550
30649
|
else if (_this.config.usePostMessageFallback) {
|
|
30551
30650
|
_this.usePostMessage = true;
|
|
30552
|
-
_this.exportViaPostMessage(
|
|
30651
|
+
_this.exportViaPostMessage(spans, resultCallback);
|
|
30553
30652
|
}
|
|
30554
30653
|
else {
|
|
30555
30654
|
resultCallback(result);
|
|
30556
30655
|
}
|
|
30557
30656
|
});
|
|
30558
30657
|
};
|
|
30559
|
-
SessionRecorderBrowserTraceExporter.prototype.
|
|
30560
|
-
|
|
30658
|
+
SessionRecorderBrowserTraceExporter.prototype.export = function (spans, resultCallback) {
|
|
30659
|
+
// Filter spans to only include those with Multiplayer trace prefixes
|
|
30660
|
+
var filteredSpans = spans.filter(function (span) {
|
|
30661
|
+
var traceId = span.spanContext().traceId;
|
|
30662
|
+
return (traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_DEBUG_PREFIX) ||
|
|
30663
|
+
traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX));
|
|
30664
|
+
});
|
|
30665
|
+
this._export(filteredSpans, resultCallback);
|
|
30561
30666
|
};
|
|
30562
|
-
SessionRecorderBrowserTraceExporter.prototype.exportBuffer = function (spans) {
|
|
30563
|
-
var
|
|
30564
|
-
|
|
30565
|
-
|
|
30566
|
-
resolve(result);
|
|
30567
|
-
});
|
|
30667
|
+
SessionRecorderBrowserTraceExporter.prototype.exportBuffer = function (spans, resultCallback) {
|
|
30668
|
+
var filteredSpans = spans.filter(function (span) {
|
|
30669
|
+
var traceId = span.spanContext().traceId;
|
|
30670
|
+
return traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX);
|
|
30568
30671
|
});
|
|
30672
|
+
this._export(filteredSpans, resultCallback);
|
|
30673
|
+
};
|
|
30674
|
+
SessionRecorderBrowserTraceExporter.prototype.shutdown = function () {
|
|
30675
|
+
return this.exporter.shutdown();
|
|
30569
30676
|
};
|
|
30570
30677
|
SessionRecorderBrowserTraceExporter.prototype.exportViaPostMessage = function (spans, resultCallback) {
|
|
30571
30678
|
var _this = this;
|
|
@@ -30586,8 +30693,42 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
30586
30693
|
}
|
|
30587
30694
|
};
|
|
30588
30695
|
SessionRecorderBrowserTraceExporter.prototype.serializeSpan = function (span) {
|
|
30696
|
+
var _a;
|
|
30589
30697
|
var spanContext = span.spanContext();
|
|
30590
|
-
|
|
30698
|
+
var instrumentationScope =
|
|
30699
|
+
// OTel SDK (modern)
|
|
30700
|
+
span.instrumentationScope ||
|
|
30701
|
+
// Older SDKs
|
|
30702
|
+
span.instrumentationLibrary || { name: 'unknown', version: undefined, schemaUrl: undefined };
|
|
30703
|
+
var normalizedScope = {
|
|
30704
|
+
name: (instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.name) || 'unknown',
|
|
30705
|
+
version: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.version,
|
|
30706
|
+
schemaUrl: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.schemaUrl,
|
|
30707
|
+
};
|
|
30708
|
+
return {
|
|
30709
|
+
_spanContext: spanContext,
|
|
30710
|
+
traceId: spanContext.traceId,
|
|
30711
|
+
spanId: spanContext.spanId,
|
|
30712
|
+
name: span.name,
|
|
30713
|
+
kind: span.kind,
|
|
30714
|
+
links: span.links,
|
|
30715
|
+
ended: span.ended,
|
|
30716
|
+
events: span.events,
|
|
30717
|
+
status: span.status,
|
|
30718
|
+
endTime: span.endTime,
|
|
30719
|
+
startTime: span.startTime,
|
|
30720
|
+
duration: span.duration,
|
|
30721
|
+
attributes: span.attributes,
|
|
30722
|
+
parentSpanId: (_a = span.parentSpanContext) === null || _a === void 0 ? void 0 : _a.spanId,
|
|
30723
|
+
droppedAttributesCount: span.droppedAttributesCount,
|
|
30724
|
+
droppedEventsCount: span.droppedEventsCount,
|
|
30725
|
+
droppedLinksCount: span.droppedLinksCount,
|
|
30726
|
+
instrumentationScope: normalizedScope,
|
|
30727
|
+
resource: {
|
|
30728
|
+
attributes: span.resource.attributes,
|
|
30729
|
+
asyncAttributesPending: span.resource.asyncAttributesPending,
|
|
30730
|
+
},
|
|
30731
|
+
};
|
|
30591
30732
|
};
|
|
30592
30733
|
SessionRecorderBrowserTraceExporter.prototype._createExporter = function () {
|
|
30593
30734
|
return new _opentelemetry_exporter_trace_otlp_http__WEBPACK_IMPORTED_MODULE_1__.OTLPTraceExporter({
|
|
@@ -30715,26 +30856,82 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
30715
30856
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30716
30857
|
/* harmony export */ captureException: () => (/* binding */ captureException)
|
|
30717
30858
|
/* harmony export */ });
|
|
30718
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
30719
30859
|
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/context-api.js");
|
|
30720
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace
|
|
30860
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
30861
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/status.js");
|
|
30862
|
+
/* harmony import */ var _opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @opentelemetry/semantic-conventions */ "../../node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js");
|
|
30863
|
+
/* harmony import */ var _set_resource_attributes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./set-resource-attributes */ "../session-recorder-common/dist/esm/sdk/set-resource-attributes.js");
|
|
30864
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
30865
|
+
__assign = Object.assign || function(t) {
|
|
30866
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
30867
|
+
s = arguments[i];
|
|
30868
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
30869
|
+
t[p] = s[p];
|
|
30870
|
+
}
|
|
30871
|
+
return t;
|
|
30872
|
+
};
|
|
30873
|
+
return __assign.apply(this, arguments);
|
|
30874
|
+
};
|
|
30875
|
+
var __read = (undefined && undefined.__read) || function (o, n) {
|
|
30876
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
30877
|
+
if (!m) return o;
|
|
30878
|
+
var i = m.call(o), r, ar = [], e;
|
|
30879
|
+
try {
|
|
30880
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30881
|
+
}
|
|
30882
|
+
catch (error) { e = { error: error }; }
|
|
30883
|
+
finally {
|
|
30884
|
+
try {
|
|
30885
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
30886
|
+
}
|
|
30887
|
+
finally { if (e) throw e.error; }
|
|
30888
|
+
}
|
|
30889
|
+
return ar;
|
|
30890
|
+
};
|
|
30891
|
+
|
|
30892
|
+
|
|
30721
30893
|
|
|
30722
30894
|
/**
|
|
30723
30895
|
* @description Add error to current span
|
|
30724
30896
|
* @param {Error} error
|
|
30725
30897
|
* @returns {void}
|
|
30726
30898
|
*/
|
|
30727
|
-
var captureException = function (error) {
|
|
30728
|
-
|
|
30729
|
-
|
|
30730
|
-
var span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_0__.trace.getSpan(_opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.context.active());
|
|
30731
|
-
if (!span)
|
|
30899
|
+
var captureException = function (error, errorInfo) {
|
|
30900
|
+
var _a, _b;
|
|
30901
|
+
if (!error) {
|
|
30732
30902
|
return;
|
|
30903
|
+
}
|
|
30904
|
+
var activeContext = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.context.active();
|
|
30905
|
+
var span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.getSpan(activeContext);
|
|
30906
|
+
var isNewSpan = false;
|
|
30907
|
+
if (!span || !span.isRecording()) {
|
|
30908
|
+
span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.getTracer('exception').startSpan(error.name || 'Error', {
|
|
30909
|
+
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)()),
|
|
30910
|
+
});
|
|
30911
|
+
_opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.setSpan(activeContext, span);
|
|
30912
|
+
isNewSpan = true;
|
|
30913
|
+
}
|
|
30914
|
+
else {
|
|
30915
|
+
span.setAttributes((_b = {},
|
|
30916
|
+
_b[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_MESSAGE] = error.message,
|
|
30917
|
+
_b[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_STACKTRACE] = error.stack,
|
|
30918
|
+
_b[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_TYPE] = error.name,
|
|
30919
|
+
_b));
|
|
30920
|
+
}
|
|
30921
|
+
if (errorInfo) {
|
|
30922
|
+
Object.entries(errorInfo).forEach(function (_a) {
|
|
30923
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
30924
|
+
span.setAttribute("error_info.".concat(key), value);
|
|
30925
|
+
});
|
|
30926
|
+
}
|
|
30733
30927
|
span.recordException(error);
|
|
30734
30928
|
span.setStatus({
|
|
30735
|
-
code:
|
|
30929
|
+
code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
|
|
30736
30930
|
message: error.message,
|
|
30737
30931
|
});
|
|
30932
|
+
if (isNewSpan) {
|
|
30933
|
+
span.end();
|
|
30934
|
+
}
|
|
30738
30935
|
};
|
|
30739
30936
|
//# sourceMappingURL=capture-exception.js.map
|
|
30740
30937
|
|
|
@@ -30778,6 +30975,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30778
30975
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30779
30976
|
/* harmony export */ captureException: () => (/* reexport safe */ _capture_exception__WEBPACK_IMPORTED_MODULE_4__.captureException),
|
|
30780
30977
|
/* harmony export */ getIdGenerator: () => (/* reexport safe */ _id_generator__WEBPACK_IMPORTED_MODULE_3__.getIdGenerator),
|
|
30978
|
+
/* harmony export */ getResourceAttributes: () => (/* reexport safe */ _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__.getResourceAttributes),
|
|
30781
30979
|
/* harmony export */ isGzip: () => (/* reexport safe */ _is_gzip__WEBPACK_IMPORTED_MODULE_2__.isGzip),
|
|
30782
30980
|
/* harmony export */ mask: () => (/* reexport safe */ _mask__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
30783
30981
|
/* harmony export */ saveContinuousSession: () => (/* reexport safe */ _save_continuous_deb_session__WEBPACK_IMPORTED_MODULE_6__.saveContinuousSession),
|
|
@@ -30792,6 +30990,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30792
30990
|
/* harmony export */ setHttpResponseBody: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setHttpResponseBody),
|
|
30793
30991
|
/* harmony export */ setHttpResponseHeaders: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setHttpResponseHeaders),
|
|
30794
30992
|
/* harmony export */ setMessageBody: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setMessageBody),
|
|
30993
|
+
/* harmony export */ setResourceAttributes: () => (/* reexport safe */ _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__.setResourceAttributes),
|
|
30795
30994
|
/* harmony export */ setRpcRequestMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcRequestMessage),
|
|
30796
30995
|
/* harmony export */ setRpcResponseMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcResponseMessage)
|
|
30797
30996
|
/* harmony export */ });
|
|
@@ -30802,6 +31001,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30802
31001
|
/* harmony import */ var _capture_exception__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./capture-exception */ "../session-recorder-common/dist/esm/sdk/capture-exception.js");
|
|
30803
31002
|
/* harmony import */ var _set_attribute__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./set-attribute */ "../session-recorder-common/dist/esm/sdk/set-attribute.js");
|
|
30804
31003
|
/* harmony import */ var _save_continuous_deb_session__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./save-continuous-deb-session */ "../session-recorder-common/dist/esm/sdk/save-continuous-deb-session.js");
|
|
31004
|
+
/* harmony import */ var _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./set-resource-attributes */ "../session-recorder-common/dist/esm/sdk/set-resource-attributes.js");
|
|
31005
|
+
|
|
30805
31006
|
|
|
30806
31007
|
|
|
30807
31008
|
|
|
@@ -31285,6 +31486,28 @@ var setGrpcResponseMessage = function (body, options) {
|
|
|
31285
31486
|
|
|
31286
31487
|
/***/ }),
|
|
31287
31488
|
|
|
31489
|
+
/***/ "../session-recorder-common/dist/esm/sdk/set-resource-attributes.js":
|
|
31490
|
+
/*!**************************************************************************!*\
|
|
31491
|
+
!*** ../session-recorder-common/dist/esm/sdk/set-resource-attributes.js ***!
|
|
31492
|
+
\**************************************************************************/
|
|
31493
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
31494
|
+
|
|
31495
|
+
"use strict";
|
|
31496
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31497
|
+
/* harmony export */ getResourceAttributes: () => (/* binding */ getResourceAttributes),
|
|
31498
|
+
/* harmony export */ setResourceAttributes: () => (/* binding */ setResourceAttributes)
|
|
31499
|
+
/* harmony export */ });
|
|
31500
|
+
var resourceAttributes = {};
|
|
31501
|
+
var setResourceAttributes = function (attributes) {
|
|
31502
|
+
resourceAttributes = attributes;
|
|
31503
|
+
};
|
|
31504
|
+
var getResourceAttributes = function () {
|
|
31505
|
+
return resourceAttributes;
|
|
31506
|
+
};
|
|
31507
|
+
//# sourceMappingURL=set-resource-attributes.js.map
|
|
31508
|
+
|
|
31509
|
+
/***/ }),
|
|
31510
|
+
|
|
31288
31511
|
/***/ "../session-recorder-common/dist/esm/type/crash-buffer.js":
|
|
31289
31512
|
/*!****************************************************************!*\
|
|
31290
31513
|
!*** ../session-recorder-common/dist/esm/type/crash-buffer.js ***!
|