@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.js
CHANGED
|
@@ -24152,7 +24152,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
|
24152
24152
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
24153
24153
|
const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
|
|
24154
24154
|
const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
|
|
24155
|
-
const PACKAGE_VERSION_EXPORT = "1.3.
|
|
24155
|
+
const PACKAGE_VERSION_EXPORT = "1.3.28" || 0;
|
|
24156
24156
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
24157
24157
|
const OTEL_IGNORE_URLS = [
|
|
24158
24158
|
// Traces endpoint
|
|
@@ -24809,31 +24809,30 @@ class NavigationRecorder {
|
|
|
24809
24809
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24810
24810
|
/* harmony export */ CrashBufferSpanProcessor: () => (/* binding */ CrashBufferSpanProcessor)
|
|
24811
24811
|
/* harmony export */ });
|
|
24812
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js");
|
|
24813
24812
|
/* 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");
|
|
24814
24813
|
|
|
24815
|
-
|
|
24816
24814
|
/**
|
|
24817
24815
|
* Implementation of the {@link SpanProcessor} that batches spans exported by
|
|
24818
24816
|
* the SDK then pushes them to the exporter pipeline.
|
|
24819
24817
|
*/
|
|
24820
24818
|
class CrashBufferSpanProcessor {
|
|
24821
|
-
constructor(
|
|
24822
|
-
this._exporter = _exporter;
|
|
24819
|
+
constructor(_crashBuffer, _serializeSpan) {
|
|
24823
24820
|
this._crashBuffer = _crashBuffer;
|
|
24824
24821
|
this._serializeSpan = _serializeSpan;
|
|
24825
24822
|
}
|
|
24826
24823
|
forceFlush() {
|
|
24827
|
-
return
|
|
24824
|
+
return Promise.resolve();
|
|
24828
24825
|
}
|
|
24829
24826
|
onStart(_span, _parentContext) {
|
|
24830
|
-
return
|
|
24827
|
+
return;
|
|
24831
24828
|
}
|
|
24832
24829
|
onEnd(span) {
|
|
24833
|
-
const
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24830
|
+
const _spanContext = span.spanContext();
|
|
24831
|
+
const traceId = _spanContext.traceId;
|
|
24832
|
+
// // Never buffer/export unsampled spans.
|
|
24833
|
+
// if ((_spanContext.traceFlags & TraceFlags.SAMPLED) === 0) {
|
|
24834
|
+
// return
|
|
24835
|
+
// }
|
|
24837
24836
|
if (traceId.startsWith(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX)) {
|
|
24838
24837
|
if (this._crashBuffer) {
|
|
24839
24838
|
this._crashBuffer.appendSpans([
|
|
@@ -24845,10 +24844,9 @@ class CrashBufferSpanProcessor {
|
|
|
24845
24844
|
}
|
|
24846
24845
|
return;
|
|
24847
24846
|
}
|
|
24848
|
-
this._exporter.onEnd(span);
|
|
24849
24847
|
}
|
|
24850
24848
|
shutdown() {
|
|
24851
|
-
return
|
|
24849
|
+
return Promise.resolve();
|
|
24852
24850
|
}
|
|
24853
24851
|
}
|
|
24854
24852
|
|
|
@@ -25091,17 +25089,14 @@ const getElementTextContent = (element) => {
|
|
|
25091
25089
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
25092
25090
|
/* harmony export */ TracerBrowserSDK: () => (/* binding */ TracerBrowserSDK)
|
|
25093
25091
|
/* harmony export */ });
|
|
25094
|
-
/* harmony import */ var
|
|
25092
|
+
/* harmony import */ var _opentelemetry_resources__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @opentelemetry/resources */ "../../node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js");
|
|
25095
25093
|
/* harmony import */ var _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @opentelemetry/core */ "../../node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js");
|
|
25096
|
-
/* harmony import */ var
|
|
25097
|
-
/* harmony import */ var
|
|
25098
|
-
/* harmony import */ var
|
|
25094
|
+
/* 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");
|
|
25095
|
+
/* 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");
|
|
25096
|
+
/* 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");
|
|
25099
25097
|
/* harmony import */ var _opentelemetry_instrumentation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @opentelemetry/instrumentation */ "../../node_modules/@opentelemetry/instrumentation/build/esm/autoLoader.js");
|
|
25100
25098
|
/* 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");
|
|
25101
25099
|
/* 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");
|
|
25102
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
25103
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/context-api.js");
|
|
25104
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/status.js");
|
|
25105
25100
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config/index.ts");
|
|
25106
25101
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/otel/helpers.ts");
|
|
25107
25102
|
/* harmony import */ var _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CrashBufferSpanProcessor */ "./src/otel/CrashBufferSpanProcessor.ts");
|
|
@@ -25116,7 +25111,6 @@ const getElementTextContent = (element) => {
|
|
|
25116
25111
|
|
|
25117
25112
|
|
|
25118
25113
|
|
|
25119
|
-
|
|
25120
25114
|
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);
|
|
25121
25115
|
class TracerBrowserSDK {
|
|
25122
25116
|
constructor() {
|
|
@@ -25142,18 +25136,20 @@ class TracerBrowserSDK {
|
|
|
25142
25136
|
url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
|
|
25143
25137
|
usePostMessageFallback: options.usePostMessageFallback,
|
|
25144
25138
|
});
|
|
25145
|
-
|
|
25146
|
-
|
|
25147
|
-
|
|
25148
|
-
|
|
25149
|
-
|
|
25150
|
-
|
|
25151
|
-
|
|
25139
|
+
const resourceAttributes = (0,_opentelemetry_resources__WEBPACK_IMPORTED_MODULE_5__.resourceFromAttributes)({
|
|
25140
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__.SEMRESATTRS_SERVICE_NAME]: application,
|
|
25141
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__.SEMRESATTRS_SERVICE_VERSION]: version,
|
|
25142
|
+
[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_6__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment,
|
|
25143
|
+
});
|
|
25144
|
+
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.setResourceAttributes(resourceAttributes.attributes);
|
|
25145
|
+
this.tracerProvider = new _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_7__.WebTracerProvider({
|
|
25146
|
+
resource: resourceAttributes,
|
|
25152
25147
|
idGenerator: this.idGenerator,
|
|
25153
25148
|
sampler: new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio),
|
|
25154
25149
|
spanProcessors: [
|
|
25155
25150
|
this._getSpanSessionIdProcessor(),
|
|
25156
|
-
new
|
|
25151
|
+
new _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_8__.BatchSpanProcessor(this.exporter),
|
|
25152
|
+
new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__.CrashBufferSpanProcessor(this.crashBuffer, this.exporter.serializeSpan),
|
|
25157
25153
|
],
|
|
25158
25154
|
});
|
|
25159
25155
|
this.tracerProvider.register({
|
|
@@ -25284,13 +25280,70 @@ class TracerBrowserSDK {
|
|
|
25284
25280
|
}
|
|
25285
25281
|
this.exporter.setApiKey(apiKey);
|
|
25286
25282
|
}
|
|
25287
|
-
|
|
25283
|
+
static _toReadableSpanLike(span) {
|
|
25288
25284
|
var _a;
|
|
25289
|
-
if (
|
|
25290
|
-
|
|
25291
|
-
|
|
25285
|
+
if (span && typeof span.spanContext === 'function' && span.instrumentationScope) {
|
|
25286
|
+
return span;
|
|
25287
|
+
}
|
|
25288
|
+
const spanContext = typeof (span === null || span === void 0 ? void 0 : span.spanContext) === 'function' ? span.spanContext() : span === null || span === void 0 ? void 0 : span._spanContext;
|
|
25289
|
+
const normalizedCtx = spanContext ||
|
|
25290
|
+
{
|
|
25291
|
+
traceId: span === null || span === void 0 ? void 0 : span.traceId,
|
|
25292
|
+
spanId: span === null || span === void 0 ? void 0 : span.spanId,
|
|
25293
|
+
traceFlags: span === null || span === void 0 ? void 0 : span.traceFlags,
|
|
25294
|
+
traceState: span === null || span === void 0 ? void 0 : span.traceState,
|
|
25295
|
+
};
|
|
25296
|
+
const instrumentationScope = (span === null || span === void 0 ? void 0 : span.instrumentationScope) ||
|
|
25297
|
+
(span === null || span === void 0 ? void 0 : span.instrumentationLibrary) ||
|
|
25298
|
+
{ name: 'multiplayer-buffer', version: undefined, schemaUrl: undefined };
|
|
25299
|
+
const normalizedScope = {
|
|
25300
|
+
name: (instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.name) || 'multiplayer-buffer',
|
|
25301
|
+
version: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.version,
|
|
25302
|
+
schemaUrl: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.schemaUrl,
|
|
25303
|
+
};
|
|
25304
|
+
const resource = (span === null || span === void 0 ? void 0 : span.resource) || { attributes: {}, asyncAttributesPending: false };
|
|
25305
|
+
const parentSpanId = span === null || span === void 0 ? void 0 : span.parentSpanId;
|
|
25306
|
+
return {
|
|
25307
|
+
name: (span === null || span === void 0 ? void 0 : span.name) || '',
|
|
25308
|
+
kind: span === null || span === void 0 ? void 0 : span.kind,
|
|
25309
|
+
spanContext: () => normalizedCtx,
|
|
25310
|
+
parentSpanContext: parentSpanId
|
|
25311
|
+
? {
|
|
25312
|
+
traceId: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceId,
|
|
25313
|
+
spanId: parentSpanId,
|
|
25314
|
+
traceFlags: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceFlags,
|
|
25315
|
+
traceState: normalizedCtx === null || normalizedCtx === void 0 ? void 0 : normalizedCtx.traceState,
|
|
25316
|
+
}
|
|
25317
|
+
: undefined,
|
|
25318
|
+
startTime: span === null || span === void 0 ? void 0 : span.startTime,
|
|
25319
|
+
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,
|
|
25320
|
+
duration: span === null || span === void 0 ? void 0 : span.duration,
|
|
25321
|
+
status: span === null || span === void 0 ? void 0 : span.status,
|
|
25322
|
+
attributes: (span === null || span === void 0 ? void 0 : span.attributes) || {},
|
|
25323
|
+
links: (span === null || span === void 0 ? void 0 : span.links) || [],
|
|
25324
|
+
events: (span === null || span === void 0 ? void 0 : span.events) || [],
|
|
25325
|
+
ended: typeof (span === null || span === void 0 ? void 0 : span.ended) === 'boolean' ? span.ended : true,
|
|
25326
|
+
droppedAttributesCount: (span === null || span === void 0 ? void 0 : span.droppedAttributesCount) || 0,
|
|
25327
|
+
droppedEventsCount: (span === null || span === void 0 ? void 0 : span.droppedEventsCount) || 0,
|
|
25328
|
+
droppedLinksCount: (span === null || span === void 0 ? void 0 : span.droppedLinksCount) || 0,
|
|
25329
|
+
resource,
|
|
25330
|
+
instrumentationScope: normalizedScope,
|
|
25331
|
+
};
|
|
25332
|
+
}
|
|
25333
|
+
async exportTraces(spans) {
|
|
25334
|
+
if (!this.exporter) {
|
|
25335
|
+
throw new Error('Trace exporter not initialized');
|
|
25336
|
+
}
|
|
25337
|
+
if (!spans || spans.length === 0) {
|
|
25338
|
+
return Promise.resolve();
|
|
25292
25339
|
}
|
|
25293
|
-
|
|
25340
|
+
const readableSpans = spans.map((s) => TracerBrowserSDK._toReadableSpanLike(s));
|
|
25341
|
+
return new Promise((resolve) => {
|
|
25342
|
+
var _a;
|
|
25343
|
+
(_a = this.exporter) === null || _a === void 0 ? void 0 : _a.exportBuffer(readableSpans, (result) => {
|
|
25344
|
+
resolve(result);
|
|
25345
|
+
});
|
|
25346
|
+
});
|
|
25294
25347
|
}
|
|
25295
25348
|
/**
|
|
25296
25349
|
* Capture an exception as an error span/event.
|
|
@@ -25298,42 +25351,7 @@ class TracerBrowserSDK {
|
|
|
25298
25351
|
* Otherwise, a short-lived span will be created to hold the exception event.
|
|
25299
25352
|
*/
|
|
25300
25353
|
captureException(error, errorInfo) {
|
|
25301
|
-
|
|
25302
|
-
if (!error)
|
|
25303
|
-
return;
|
|
25304
|
-
// Prefer attaching to the active span to keep correlation intact
|
|
25305
|
-
try {
|
|
25306
|
-
const activeSpan = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__.trace.getSpan(_opentelemetry_api__WEBPACK_IMPORTED_MODULE_12__.context.active());
|
|
25307
|
-
if (activeSpan) {
|
|
25308
|
-
this._recordException(activeSpan, error, errorInfo);
|
|
25309
|
-
(_a = this.tracerProvider) === null || _a === void 0 ? void 0 : _a.forceFlush();
|
|
25310
|
-
return;
|
|
25311
|
-
}
|
|
25312
|
-
// eslint-disable-next-line
|
|
25313
|
-
}
|
|
25314
|
-
catch (_ignored) { }
|
|
25315
|
-
// Fallback: create a short-lived span to hold the exception details
|
|
25316
|
-
try {
|
|
25317
|
-
const tracer = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_11__.trace.getTracer('exception');
|
|
25318
|
-
const span = tracer.startSpan(error.name || 'Error');
|
|
25319
|
-
this._recordException(span, error, errorInfo);
|
|
25320
|
-
span.end();
|
|
25321
|
-
(_b = this.tracerProvider) === null || _b === void 0 ? void 0 : _b.forceFlush();
|
|
25322
|
-
// eslint-disable-next-line
|
|
25323
|
-
}
|
|
25324
|
-
catch (_ignored) { }
|
|
25325
|
-
}
|
|
25326
|
-
_recordException(span, error, errorInfo) {
|
|
25327
|
-
span.recordException(error);
|
|
25328
|
-
span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__.SpanStatusCode.ERROR, message: error.message });
|
|
25329
|
-
span.setAttribute('exception.type', error.name || 'Error');
|
|
25330
|
-
span.setAttribute('exception.message', error.message);
|
|
25331
|
-
span.setAttribute('exception.stacktrace', error.stack || '');
|
|
25332
|
-
if (errorInfo) {
|
|
25333
|
-
Object.entries(errorInfo).forEach(([key, value]) => {
|
|
25334
|
-
span.setAttribute(`error_info.${key}`, value);
|
|
25335
|
-
});
|
|
25336
|
-
}
|
|
25354
|
+
_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.captureException(error, errorInfo);
|
|
25337
25355
|
}
|
|
25338
25356
|
_getSpanSessionIdProcessor() {
|
|
25339
25357
|
return {
|
|
@@ -26178,7 +26196,9 @@ class ApiService {
|
|
|
26178
26196
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26179
26197
|
/* harmony export */ CrashBufferService: () => (/* binding */ CrashBufferService)
|
|
26180
26198
|
/* harmony export */ });
|
|
26181
|
-
/* harmony import */ var
|
|
26199
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/status.js");
|
|
26200
|
+
/* harmony import */ var _rrweb_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rrweb/types */ "../../node_modules/@rrweb/types/dist/types.js");
|
|
26201
|
+
|
|
26182
26202
|
|
|
26183
26203
|
class CrashBufferService {
|
|
26184
26204
|
constructor(db, tabId, windowMs) {
|
|
@@ -26211,12 +26231,16 @@ class CrashBufferService {
|
|
|
26211
26231
|
}, undefined);
|
|
26212
26232
|
}
|
|
26213
26233
|
async appendEvent(payload, _windowMs) {
|
|
26234
|
+
var _a;
|
|
26214
26235
|
this.lastSeenEventTs = Math.max(this.lastSeenEventTs, payload.ts || 0);
|
|
26215
26236
|
if (!this.isActive)
|
|
26216
26237
|
return;
|
|
26217
26238
|
const isFullSnapshot = Boolean(payload.isFullSnapshot);
|
|
26218
|
-
|
|
26219
|
-
|
|
26239
|
+
const eventType = (_a = payload === null || payload === void 0 ? void 0 : payload.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
26240
|
+
const isMeta = eventType === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta;
|
|
26241
|
+
if (this.requiresFullSnapshot && !isFullSnapshot && !isMeta) {
|
|
26242
|
+
// rrweb replayable prefix is Meta -> FullSnapshot.
|
|
26243
|
+
// While waiting for the first FullSnapshot, we still keep the Meta event (but drop incrementals).
|
|
26220
26244
|
return;
|
|
26221
26245
|
}
|
|
26222
26246
|
await this._safe(async () => {
|
|
@@ -26229,8 +26253,8 @@ class CrashBufferService {
|
|
|
26229
26253
|
}, undefined);
|
|
26230
26254
|
if (isFullSnapshot && this.requiresFullSnapshot) {
|
|
26231
26255
|
// Ensure this snapshot becomes the first replayable event.
|
|
26232
|
-
//
|
|
26233
|
-
await this._safe(() => this.db.
|
|
26256
|
+
// Keep Meta + FullSnapshot (if present) and prune everything older.
|
|
26257
|
+
await this._safe(() => this.db.pruneOlderThanWithRrwebSnapshotAnchor(this.tabId, payload.ts), undefined);
|
|
26234
26258
|
this.requiresFullSnapshot = false;
|
|
26235
26259
|
}
|
|
26236
26260
|
else if (isFullSnapshot) {
|
|
@@ -26248,7 +26272,7 @@ class CrashBufferService {
|
|
|
26248
26272
|
await this._safe(async () => {
|
|
26249
26273
|
const records = payload.map((p) => {
|
|
26250
26274
|
var _a, _b;
|
|
26251
|
-
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) ===
|
|
26275
|
+
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) {
|
|
26252
26276
|
errorEvent = { ts: p.ts, span: p.span };
|
|
26253
26277
|
}
|
|
26254
26278
|
return {
|
|
@@ -26293,6 +26317,7 @@ class CrashBufferService {
|
|
|
26293
26317
|
}
|
|
26294
26318
|
}
|
|
26295
26319
|
async snapshot(_windowMs, now = Date.now()) {
|
|
26320
|
+
var _a, _b;
|
|
26296
26321
|
const toTs = now;
|
|
26297
26322
|
const fromTs = Math.max(0, toTs - this.windowMs);
|
|
26298
26323
|
// Always include a full snapshot "anchor" if one exists at/before the window start.
|
|
@@ -26308,10 +26333,37 @@ class CrashBufferService {
|
|
|
26308
26333
|
const rrwebSorted = rrweb
|
|
26309
26334
|
.sort((a, b) => a.ts - b.ts)
|
|
26310
26335
|
.map((r) => ({ ts: r.ts, isFullSnapshot: r.isFullSnapshot, event: r.event }));
|
|
26311
|
-
// Hard guarantee: snapshot payload starts with
|
|
26336
|
+
// Hard guarantee: snapshot payload starts with Meta -> FullSnapshot (or is empty).
|
|
26312
26337
|
const firstFullSnapshotIdx = rrwebSorted.findIndex((e) => Boolean(e.isFullSnapshot));
|
|
26313
|
-
|
|
26314
|
-
|
|
26338
|
+
if (firstFullSnapshotIdx < 0) {
|
|
26339
|
+
return {
|
|
26340
|
+
rrwebEvents: [],
|
|
26341
|
+
otelSpans: [],
|
|
26342
|
+
attrs: attrs
|
|
26343
|
+
? {
|
|
26344
|
+
sessionAttributes: attrs.sessionAttributes,
|
|
26345
|
+
resourceAttributes: attrs.resourceAttributes,
|
|
26346
|
+
userAttributes: attrs.userAttributes,
|
|
26347
|
+
}
|
|
26348
|
+
: null,
|
|
26349
|
+
windowMs: this.windowMs,
|
|
26350
|
+
fromTs,
|
|
26351
|
+
toTs,
|
|
26352
|
+
};
|
|
26353
|
+
}
|
|
26354
|
+
// Prefer including the Meta event immediately preceding the first FullSnapshot.
|
|
26355
|
+
let startIdx = firstFullSnapshotIdx;
|
|
26356
|
+
for (let i = firstFullSnapshotIdx - 1; i >= 0; i--) {
|
|
26357
|
+
const t = (_b = (_a = rrwebSorted[i]) === null || _a === void 0 ? void 0 : _a.event) === null || _b === void 0 ? void 0 : _b.eventType;
|
|
26358
|
+
if (t === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta) {
|
|
26359
|
+
startIdx = i;
|
|
26360
|
+
break;
|
|
26361
|
+
}
|
|
26362
|
+
}
|
|
26363
|
+
const rrwebEvents = rrwebSorted.slice(startIdx);
|
|
26364
|
+
// Align spans with the rrweb replay start (Meta if present, otherwise FullSnapshot).
|
|
26365
|
+
// Important: we return `fromTs` to consumers and many UIs compute relative offsets from it,
|
|
26366
|
+
// so `fromTs` must match the first rrweb event timestamp we return.
|
|
26315
26367
|
const replayStartTs = rrwebEvents.length > 0 ? rrwebEvents[0].ts : fromTs;
|
|
26316
26368
|
const otelSpans = spans
|
|
26317
26369
|
.filter((s) => typeof (s === null || s === void 0 ? void 0 : s.ts) === 'number' && s.ts >= replayStartTs)
|
|
@@ -26398,12 +26450,14 @@ class CrashBufferService {
|
|
|
26398
26450
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26399
26451
|
/* harmony export */ IndexedDBService: () => (/* binding */ IndexedDBService)
|
|
26400
26452
|
/* harmony export */ });
|
|
26453
|
+
/* harmony import */ var _rrweb_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rrweb/types */ "../../node_modules/@rrweb/types/dist/types.js");
|
|
26401
26454
|
const dbName = 'mpEventsDB';
|
|
26402
26455
|
const dbVersion = 2;
|
|
26403
26456
|
const legacyStoreName = 'mpEventsStore';
|
|
26404
26457
|
const rrwebEventsStore = 'rrwebEvents';
|
|
26405
26458
|
const otelSpansStore = 'otelSpans';
|
|
26406
26459
|
const attrsStore = 'crashBufferAttrs';
|
|
26460
|
+
|
|
26407
26461
|
class IndexedDBService {
|
|
26408
26462
|
constructor() {
|
|
26409
26463
|
this.dbPromise = this.openDB();
|
|
@@ -26611,6 +26665,40 @@ class IndexedDBService {
|
|
|
26611
26665
|
req.onerror = () => reject(req.error);
|
|
26612
26666
|
});
|
|
26613
26667
|
}
|
|
26668
|
+
/**
|
|
26669
|
+
* Returns the last (highest-ts) Meta event record at/before `cutoffTs`.
|
|
26670
|
+
*
|
|
26671
|
+
* rrweb replays expect the stream to begin with:
|
|
26672
|
+
* - Meta
|
|
26673
|
+
* - FullSnapshot
|
|
26674
|
+
*
|
|
26675
|
+
* We persist packed events (plus a small wrapper) so we detect Meta via `record.event.eventType`.
|
|
26676
|
+
*/
|
|
26677
|
+
async getLastRrwebMetaBefore(tabId, cutoffTs) {
|
|
26678
|
+
const db = await this.dbPromise;
|
|
26679
|
+
const range = IDBKeyRange.bound([tabId, 0], [tabId, cutoffTs]);
|
|
26680
|
+
return new Promise((resolve, reject) => {
|
|
26681
|
+
const tx = db.transaction(rrwebEventsStore, 'readonly');
|
|
26682
|
+
const idx = tx.objectStore(rrwebEventsStore).index('tabId_ts');
|
|
26683
|
+
const req = idx.openCursor(range, 'prev');
|
|
26684
|
+
req.onsuccess = () => {
|
|
26685
|
+
var _a;
|
|
26686
|
+
const cursor = req.result;
|
|
26687
|
+
if (!cursor) {
|
|
26688
|
+
resolve(null);
|
|
26689
|
+
return;
|
|
26690
|
+
}
|
|
26691
|
+
const value = cursor.value;
|
|
26692
|
+
const eventType = (_a = value === null || value === void 0 ? void 0 : value.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
26693
|
+
if (eventType === _rrweb_types__WEBPACK_IMPORTED_MODULE_0__.EventType.Meta) {
|
|
26694
|
+
resolve(value);
|
|
26695
|
+
return;
|
|
26696
|
+
}
|
|
26697
|
+
cursor.continue();
|
|
26698
|
+
};
|
|
26699
|
+
req.onerror = () => reject(req.error);
|
|
26700
|
+
});
|
|
26701
|
+
}
|
|
26614
26702
|
async getOtelSpansWindow(tabId, fromTs, toTs) {
|
|
26615
26703
|
const db = await this.dbPromise;
|
|
26616
26704
|
const range = IDBKeyRange.bound([tabId, fromTs], [tabId, toTs]);
|
|
@@ -26657,15 +26745,24 @@ class IndexedDBService {
|
|
|
26657
26745
|
}
|
|
26658
26746
|
/**
|
|
26659
26747
|
* Prune older data while keeping rrweb replayability:
|
|
26660
|
-
* - rrweb: keep the last FullSnapshot at/before cutoff as an "anchor"
|
|
26748
|
+
* - rrweb: keep the last Meta + FullSnapshot pair at/before cutoff as an "anchor"
|
|
26661
26749
|
* - spans: prune strictly by cutoff
|
|
26662
26750
|
*/
|
|
26663
26751
|
async pruneOlderThanWithRrwebSnapshotAnchor(tabId, cutoffTs) {
|
|
26664
26752
|
const db = await this.dbPromise;
|
|
26665
26753
|
const anchor = await this.getLastRrwebFullSnapshotBefore(tabId, cutoffTs);
|
|
26666
|
-
// rrweb: delete everything strictly older than the anchor
|
|
26754
|
+
// rrweb: delete everything strictly older than the anchor meta event (if any),
|
|
26755
|
+
// otherwise strictly older than the anchor snapshot (keep the anchor itself).
|
|
26756
|
+
//
|
|
26757
|
+
// This preserves rrweb's expected replay prefix:
|
|
26758
|
+
// Meta -> FullSnapshot
|
|
26759
|
+
const anchorMeta = anchor ? await this.getLastRrwebMetaBefore(tabId, anchor.ts) : null;
|
|
26667
26760
|
// spans: delete everything older than cutoffTs
|
|
26668
|
-
const rrwebCutoffTs = typeof (
|
|
26761
|
+
const rrwebCutoffTs = typeof (anchorMeta === null || anchorMeta === void 0 ? void 0 : anchorMeta.ts) === 'number'
|
|
26762
|
+
? Math.max(0, anchorMeta.ts - 1)
|
|
26763
|
+
: typeof (anchor === null || anchor === void 0 ? void 0 : anchor.ts) === 'number'
|
|
26764
|
+
? Math.max(0, anchor.ts - 1)
|
|
26765
|
+
: cutoffTs;
|
|
26669
26766
|
const rrwebRange = IDBKeyRange.bound([tabId, 0], [tabId, rrwebCutoffTs]);
|
|
26670
26767
|
const spansRange = IDBKeyRange.bound([tabId, 0], [tabId, cutoffTs]);
|
|
26671
26768
|
const pruneStore = (store, range) => new Promise((resolve, reject) => {
|
|
@@ -27297,6 +27394,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27297
27394
|
return;
|
|
27298
27395
|
if (!payload.span)
|
|
27299
27396
|
return;
|
|
27397
|
+
console.log('error-span-appended', payload);
|
|
27300
27398
|
this._createExceptionSession(payload.span);
|
|
27301
27399
|
});
|
|
27302
27400
|
this._registerCrashBufferLifecycleHandlers();
|
|
@@ -27532,11 +27630,6 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27532
27630
|
return null;
|
|
27533
27631
|
this._isFlushingBuffer = true;
|
|
27534
27632
|
try {
|
|
27535
|
-
// await this._crashBuffer.setAttrs({
|
|
27536
|
-
// sessionAttributes: this.sessionAttributes,
|
|
27537
|
-
// resourceAttributes: getNavigatorInfo(),
|
|
27538
|
-
// userAttributes: this._userAttributes
|
|
27539
|
-
// })
|
|
27540
27633
|
const snapshot = await this._crashBuffer.snapshot();
|
|
27541
27634
|
if (snapshot.rrwebEvents.length === 0 && snapshot.otelSpans.length === 0) {
|
|
27542
27635
|
return null;
|
|
@@ -27549,6 +27642,8 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27549
27642
|
this._apiService.exportEvents(sessionId, { events }),
|
|
27550
27643
|
this._apiService.updateSessionAttributes(sessionId, {
|
|
27551
27644
|
name: this._getSessionName(),
|
|
27645
|
+
// startedAt: new Date(snapshot.rrwebEvents[0].ts).toISOString(),
|
|
27646
|
+
// stoppedAt: new Date().toISOString(),
|
|
27552
27647
|
sessionAttributes: this.sessionAttributes,
|
|
27553
27648
|
resourceAttributes: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getNavigatorInfo)(),
|
|
27554
27649
|
userAttributes: this._userAttributes || undefined
|
|
@@ -27733,6 +27828,9 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
|
|
|
27733
27828
|
async _createExceptionSession(span) {
|
|
27734
27829
|
try {
|
|
27735
27830
|
const session = await this._apiService.createErrorSession({ span });
|
|
27831
|
+
console.log('====================================');
|
|
27832
|
+
console.log(span);
|
|
27833
|
+
console.log('====================================');
|
|
27736
27834
|
if (session) {
|
|
27737
27835
|
void this._flushBuffer(session._id);
|
|
27738
27836
|
}
|
|
@@ -30020,12 +30118,14 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
|
|
|
30020
30118
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30021
30119
|
/* harmony export */ SessionRecorderTraceIdRatioBasedSampler: () => (/* binding */ SessionRecorderTraceIdRatioBasedSampler)
|
|
30022
30120
|
/* harmony export */ });
|
|
30023
|
-
/* harmony import */ var
|
|
30024
|
-
/* harmony import */ var
|
|
30121
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js");
|
|
30122
|
+
/* 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");
|
|
30123
|
+
/* 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");
|
|
30025
30124
|
/* harmony import */ var _constants_constants_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/constants.base */ "../session-recorder-common/dist/esm/constants/constants.base.js");
|
|
30026
30125
|
|
|
30027
30126
|
|
|
30028
30127
|
|
|
30128
|
+
|
|
30029
30129
|
var SessionRecorderTraceIdRatioBasedSampler = /** @class */ (function () {
|
|
30030
30130
|
function SessionRecorderTraceIdRatioBasedSampler(_ratio) {
|
|
30031
30131
|
if (_ratio === void 0) { _ratio = 0; }
|
|
@@ -30033,20 +30133,25 @@ var SessionRecorderTraceIdRatioBasedSampler = /** @class */ (function () {
|
|
|
30033
30133
|
this._ratio = this._normalize(_ratio);
|
|
30034
30134
|
this._upperBound = Math.floor(this._ratio * 0xffffffff);
|
|
30035
30135
|
}
|
|
30036
|
-
SessionRecorderTraceIdRatioBasedSampler.prototype.shouldSample = function (context, traceId) {
|
|
30136
|
+
SessionRecorderTraceIdRatioBasedSampler.prototype.shouldSample = function (context, traceId, spanName, spanKind, attributes, links) {
|
|
30137
|
+
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]) {
|
|
30138
|
+
return {
|
|
30139
|
+
decision: _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.RECORD_AND_SAMPLED,
|
|
30140
|
+
};
|
|
30141
|
+
}
|
|
30037
30142
|
if (traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_DEBUG_PREFIX)
|
|
30038
30143
|
|| traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX)
|
|
30039
|
-
|
|
30144
|
+
|| traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX)
|
|
30040
30145
|
// || traceId.startsWith(MULTIPLAYER_TRACE_CONTINUOUS_SESSION_CACHE_PREFIX)
|
|
30041
30146
|
) {
|
|
30042
30147
|
return {
|
|
30043
|
-
decision:
|
|
30148
|
+
decision: _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.RECORD_AND_SAMPLED,
|
|
30044
30149
|
};
|
|
30045
30150
|
}
|
|
30046
|
-
var decision =
|
|
30047
|
-
if ((0,
|
|
30151
|
+
var decision = _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.NOT_RECORD;
|
|
30152
|
+
if ((0,_opentelemetry_api__WEBPACK_IMPORTED_MODULE_3__.isValidTraceId)(traceId)
|
|
30048
30153
|
&& this._accumulate(traceId) < this._upperBound) {
|
|
30049
|
-
decision =
|
|
30154
|
+
decision = _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_2__.SamplingDecision.RECORD_AND_SAMPLED;
|
|
30050
30155
|
}
|
|
30051
30156
|
return { decision: decision };
|
|
30052
30157
|
};
|
|
@@ -30147,7 +30252,7 @@ var MULTIPLAYER_TRACE_PREFIX_MAP = (_a = {},
|
|
|
30147
30252
|
_a[_type__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL] = MULTIPLAYER_TRACE_DEBUG_PREFIX,
|
|
30148
30253
|
_a);
|
|
30149
30254
|
var MULTIPLAYER_TRACE_DEBUG_SESSION_SHORT_ID_LENGTH = 8;
|
|
30150
|
-
var MULTIPLAYER_TRACE_CLIENT_ID_LENGTH =
|
|
30255
|
+
var MULTIPLAYER_TRACE_CLIENT_ID_LENGTH = 4;
|
|
30151
30256
|
/**
|
|
30152
30257
|
* @deprecated Use MULTIPLAYER_OTEL_DEFAULT_TRACES_EXPORTER_HTTP_URL instead
|
|
30153
30258
|
*/
|
|
@@ -30297,46 +30402,48 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
30297
30402
|
this.postMessageTargetOrigin = postMessageTargetOrigin;
|
|
30298
30403
|
this.exporter = this._createExporter();
|
|
30299
30404
|
}
|
|
30300
|
-
SessionRecorderBrowserTraceExporter.prototype.
|
|
30405
|
+
SessionRecorderBrowserTraceExporter.prototype._export = function (spans, resultCallback) {
|
|
30301
30406
|
var _this = this;
|
|
30302
|
-
// Filter spans to only include those with Multiplayer trace prefixes
|
|
30303
|
-
var filteredSpans = spans.filter(function (span) {
|
|
30304
|
-
var traceId = span.spanContext().traceId;
|
|
30305
|
-
return (traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_DEBUG_PREFIX) ||
|
|
30306
|
-
traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX));
|
|
30307
|
-
});
|
|
30308
30407
|
// Only proceed if there are filtered spans
|
|
30309
|
-
if (
|
|
30408
|
+
if (spans.length === 0) {
|
|
30310
30409
|
resultCallback({ code: 0 });
|
|
30311
30410
|
return;
|
|
30312
30411
|
}
|
|
30313
30412
|
if (this.usePostMessage) {
|
|
30314
|
-
this.exportViaPostMessage(
|
|
30413
|
+
this.exportViaPostMessage(spans, resultCallback);
|
|
30315
30414
|
return;
|
|
30316
30415
|
}
|
|
30317
|
-
this.exporter.export(
|
|
30416
|
+
this.exporter.export(spans, function (result) {
|
|
30318
30417
|
if (result.code === 0) {
|
|
30319
30418
|
resultCallback(result);
|
|
30320
30419
|
}
|
|
30321
30420
|
else if (_this.config.usePostMessageFallback) {
|
|
30322
30421
|
_this.usePostMessage = true;
|
|
30323
|
-
_this.exportViaPostMessage(
|
|
30422
|
+
_this.exportViaPostMessage(spans, resultCallback);
|
|
30324
30423
|
}
|
|
30325
30424
|
else {
|
|
30326
30425
|
resultCallback(result);
|
|
30327
30426
|
}
|
|
30328
30427
|
});
|
|
30329
30428
|
};
|
|
30330
|
-
SessionRecorderBrowserTraceExporter.prototype.
|
|
30331
|
-
|
|
30429
|
+
SessionRecorderBrowserTraceExporter.prototype.export = function (spans, resultCallback) {
|
|
30430
|
+
// Filter spans to only include those with Multiplayer trace prefixes
|
|
30431
|
+
var filteredSpans = spans.filter(function (span) {
|
|
30432
|
+
var traceId = span.spanContext().traceId;
|
|
30433
|
+
return (traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_DEBUG_PREFIX) ||
|
|
30434
|
+
traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX));
|
|
30435
|
+
});
|
|
30436
|
+
this._export(filteredSpans, resultCallback);
|
|
30332
30437
|
};
|
|
30333
|
-
SessionRecorderBrowserTraceExporter.prototype.exportBuffer = function (spans) {
|
|
30334
|
-
var
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
resolve(result);
|
|
30338
|
-
});
|
|
30438
|
+
SessionRecorderBrowserTraceExporter.prototype.exportBuffer = function (spans, resultCallback) {
|
|
30439
|
+
var filteredSpans = spans.filter(function (span) {
|
|
30440
|
+
var traceId = span.spanContext().traceId;
|
|
30441
|
+
return traceId.startsWith(_constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX);
|
|
30339
30442
|
});
|
|
30443
|
+
this._export(filteredSpans, resultCallback);
|
|
30444
|
+
};
|
|
30445
|
+
SessionRecorderBrowserTraceExporter.prototype.shutdown = function () {
|
|
30446
|
+
return this.exporter.shutdown();
|
|
30340
30447
|
};
|
|
30341
30448
|
SessionRecorderBrowserTraceExporter.prototype.exportViaPostMessage = function (spans, resultCallback) {
|
|
30342
30449
|
var _this = this;
|
|
@@ -30357,8 +30464,42 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
30357
30464
|
}
|
|
30358
30465
|
};
|
|
30359
30466
|
SessionRecorderBrowserTraceExporter.prototype.serializeSpan = function (span) {
|
|
30467
|
+
var _a;
|
|
30360
30468
|
var spanContext = span.spanContext();
|
|
30361
|
-
|
|
30469
|
+
var instrumentationScope =
|
|
30470
|
+
// OTel SDK (modern)
|
|
30471
|
+
span.instrumentationScope ||
|
|
30472
|
+
// Older SDKs
|
|
30473
|
+
span.instrumentationLibrary || { name: 'unknown', version: undefined, schemaUrl: undefined };
|
|
30474
|
+
var normalizedScope = {
|
|
30475
|
+
name: (instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.name) || 'unknown',
|
|
30476
|
+
version: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.version,
|
|
30477
|
+
schemaUrl: instrumentationScope === null || instrumentationScope === void 0 ? void 0 : instrumentationScope.schemaUrl,
|
|
30478
|
+
};
|
|
30479
|
+
return {
|
|
30480
|
+
_spanContext: spanContext,
|
|
30481
|
+
traceId: spanContext.traceId,
|
|
30482
|
+
spanId: spanContext.spanId,
|
|
30483
|
+
name: span.name,
|
|
30484
|
+
kind: span.kind,
|
|
30485
|
+
links: span.links,
|
|
30486
|
+
ended: span.ended,
|
|
30487
|
+
events: span.events,
|
|
30488
|
+
status: span.status,
|
|
30489
|
+
endTime: span.endTime,
|
|
30490
|
+
startTime: span.startTime,
|
|
30491
|
+
duration: span.duration,
|
|
30492
|
+
attributes: span.attributes,
|
|
30493
|
+
parentSpanId: (_a = span.parentSpanContext) === null || _a === void 0 ? void 0 : _a.spanId,
|
|
30494
|
+
droppedAttributesCount: span.droppedAttributesCount,
|
|
30495
|
+
droppedEventsCount: span.droppedEventsCount,
|
|
30496
|
+
droppedLinksCount: span.droppedLinksCount,
|
|
30497
|
+
instrumentationScope: normalizedScope,
|
|
30498
|
+
resource: {
|
|
30499
|
+
attributes: span.resource.attributes,
|
|
30500
|
+
asyncAttributesPending: span.resource.asyncAttributesPending,
|
|
30501
|
+
},
|
|
30502
|
+
};
|
|
30362
30503
|
};
|
|
30363
30504
|
SessionRecorderBrowserTraceExporter.prototype._createExporter = function () {
|
|
30364
30505
|
return new _opentelemetry_exporter_trace_otlp_http__WEBPACK_IMPORTED_MODULE_1__.OTLPTraceExporter({
|
|
@@ -30483,26 +30624,82 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
|
|
|
30483
30624
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30484
30625
|
/* harmony export */ captureException: () => (/* binding */ captureException)
|
|
30485
30626
|
/* harmony export */ });
|
|
30486
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
30487
30627
|
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/context-api.js");
|
|
30488
|
-
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace
|
|
30628
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace-api.js");
|
|
30629
|
+
/* harmony import */ var _opentelemetry_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @opentelemetry/api */ "../../node_modules/@opentelemetry/api/build/esm/trace/status.js");
|
|
30630
|
+
/* 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");
|
|
30631
|
+
/* 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");
|
|
30632
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
30633
|
+
__assign = Object.assign || function(t) {
|
|
30634
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
30635
|
+
s = arguments[i];
|
|
30636
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
30637
|
+
t[p] = s[p];
|
|
30638
|
+
}
|
|
30639
|
+
return t;
|
|
30640
|
+
};
|
|
30641
|
+
return __assign.apply(this, arguments);
|
|
30642
|
+
};
|
|
30643
|
+
var __read = (undefined && undefined.__read) || function (o, n) {
|
|
30644
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
30645
|
+
if (!m) return o;
|
|
30646
|
+
var i = m.call(o), r, ar = [], e;
|
|
30647
|
+
try {
|
|
30648
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30649
|
+
}
|
|
30650
|
+
catch (error) { e = { error: error }; }
|
|
30651
|
+
finally {
|
|
30652
|
+
try {
|
|
30653
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
30654
|
+
}
|
|
30655
|
+
finally { if (e) throw e.error; }
|
|
30656
|
+
}
|
|
30657
|
+
return ar;
|
|
30658
|
+
};
|
|
30659
|
+
|
|
30660
|
+
|
|
30489
30661
|
|
|
30490
30662
|
/**
|
|
30491
30663
|
* @description Add error to current span
|
|
30492
30664
|
* @param {Error} error
|
|
30493
30665
|
* @returns {void}
|
|
30494
30666
|
*/
|
|
30495
|
-
var captureException = function (error) {
|
|
30496
|
-
|
|
30497
|
-
|
|
30498
|
-
var span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_0__.trace.getSpan(_opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.context.active());
|
|
30499
|
-
if (!span)
|
|
30667
|
+
var captureException = function (error, errorInfo) {
|
|
30668
|
+
var _a, _b;
|
|
30669
|
+
if (!error) {
|
|
30500
30670
|
return;
|
|
30671
|
+
}
|
|
30672
|
+
var activeContext = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_1__.context.active();
|
|
30673
|
+
var span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.getSpan(activeContext);
|
|
30674
|
+
var isNewSpan = false;
|
|
30675
|
+
if (!span || !span.isRecording()) {
|
|
30676
|
+
span = _opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.getTracer('exception').startSpan(error.name || 'Error', {
|
|
30677
|
+
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)()),
|
|
30678
|
+
});
|
|
30679
|
+
_opentelemetry_api__WEBPACK_IMPORTED_MODULE_2__.trace.setSpan(activeContext, span);
|
|
30680
|
+
isNewSpan = true;
|
|
30681
|
+
}
|
|
30682
|
+
else {
|
|
30683
|
+
span.setAttributes((_b = {},
|
|
30684
|
+
_b[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_MESSAGE] = error.message,
|
|
30685
|
+
_b[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_STACKTRACE] = error.stack,
|
|
30686
|
+
_b[_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_3__.ATTR_EXCEPTION_TYPE] = error.name,
|
|
30687
|
+
_b));
|
|
30688
|
+
}
|
|
30689
|
+
if (errorInfo) {
|
|
30690
|
+
Object.entries(errorInfo).forEach(function (_a) {
|
|
30691
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
30692
|
+
span.setAttribute("error_info.".concat(key), value);
|
|
30693
|
+
});
|
|
30694
|
+
}
|
|
30501
30695
|
span.recordException(error);
|
|
30502
30696
|
span.setStatus({
|
|
30503
|
-
code:
|
|
30697
|
+
code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
|
|
30504
30698
|
message: error.message,
|
|
30505
30699
|
});
|
|
30700
|
+
if (isNewSpan) {
|
|
30701
|
+
span.end();
|
|
30702
|
+
}
|
|
30506
30703
|
};
|
|
30507
30704
|
//# sourceMappingURL=capture-exception.js.map
|
|
30508
30705
|
|
|
@@ -30544,6 +30741,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30544
30741
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30545
30742
|
/* harmony export */ captureException: () => (/* reexport safe */ _capture_exception__WEBPACK_IMPORTED_MODULE_4__.captureException),
|
|
30546
30743
|
/* harmony export */ getIdGenerator: () => (/* reexport safe */ _id_generator__WEBPACK_IMPORTED_MODULE_3__.getIdGenerator),
|
|
30744
|
+
/* harmony export */ getResourceAttributes: () => (/* reexport safe */ _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__.getResourceAttributes),
|
|
30547
30745
|
/* harmony export */ isGzip: () => (/* reexport safe */ _is_gzip__WEBPACK_IMPORTED_MODULE_2__.isGzip),
|
|
30548
30746
|
/* harmony export */ mask: () => (/* reexport safe */ _mask__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
30549
30747
|
/* harmony export */ saveContinuousSession: () => (/* reexport safe */ _save_continuous_deb_session__WEBPACK_IMPORTED_MODULE_6__.saveContinuousSession),
|
|
@@ -30558,6 +30756,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30558
30756
|
/* harmony export */ setHttpResponseBody: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setHttpResponseBody),
|
|
30559
30757
|
/* harmony export */ setHttpResponseHeaders: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setHttpResponseHeaders),
|
|
30560
30758
|
/* harmony export */ setMessageBody: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setMessageBody),
|
|
30759
|
+
/* harmony export */ setResourceAttributes: () => (/* reexport safe */ _set_resource_attributes__WEBPACK_IMPORTED_MODULE_7__.setResourceAttributes),
|
|
30561
30760
|
/* harmony export */ setRpcRequestMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcRequestMessage),
|
|
30562
30761
|
/* harmony export */ setRpcResponseMessage: () => (/* reexport safe */ _set_attribute__WEBPACK_IMPORTED_MODULE_5__.setRpcResponseMessage)
|
|
30563
30762
|
/* harmony export */ });
|
|
@@ -30568,6 +30767,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30568
30767
|
/* harmony import */ var _capture_exception__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./capture-exception */ "../session-recorder-common/dist/esm/sdk/capture-exception.js");
|
|
30569
30768
|
/* harmony import */ var _set_attribute__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./set-attribute */ "../session-recorder-common/dist/esm/sdk/set-attribute.js");
|
|
30570
30769
|
/* 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");
|
|
30770
|
+
/* 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");
|
|
30771
|
+
|
|
30571
30772
|
|
|
30572
30773
|
|
|
30573
30774
|
|
|
@@ -31046,6 +31247,27 @@ var setGrpcResponseMessage = function (body, options) {
|
|
|
31046
31247
|
|
|
31047
31248
|
/***/ }),
|
|
31048
31249
|
|
|
31250
|
+
/***/ "../session-recorder-common/dist/esm/sdk/set-resource-attributes.js":
|
|
31251
|
+
/*!**************************************************************************!*\
|
|
31252
|
+
!*** ../session-recorder-common/dist/esm/sdk/set-resource-attributes.js ***!
|
|
31253
|
+
\**************************************************************************/
|
|
31254
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
31255
|
+
|
|
31256
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31257
|
+
/* harmony export */ getResourceAttributes: () => (/* binding */ getResourceAttributes),
|
|
31258
|
+
/* harmony export */ setResourceAttributes: () => (/* binding */ setResourceAttributes)
|
|
31259
|
+
/* harmony export */ });
|
|
31260
|
+
var resourceAttributes = {};
|
|
31261
|
+
var setResourceAttributes = function (attributes) {
|
|
31262
|
+
resourceAttributes = attributes;
|
|
31263
|
+
};
|
|
31264
|
+
var getResourceAttributes = function () {
|
|
31265
|
+
return resourceAttributes;
|
|
31266
|
+
};
|
|
31267
|
+
//# sourceMappingURL=set-resource-attributes.js.map
|
|
31268
|
+
|
|
31269
|
+
/***/ }),
|
|
31270
|
+
|
|
31049
31271
|
/***/ "../session-recorder-common/dist/esm/type/crash-buffer.js":
|
|
31050
31272
|
/*!****************************************************************!*\
|
|
31051
31273
|
!*** ../session-recorder-common/dist/esm/type/crash-buffer.js ***!
|