|
@@ -20,7 +20,6 @@ import hydrateSpans from 'sentry/utils/replays/hydrateSpans';
|
|
|
import {
|
|
|
breadcrumbFactory,
|
|
|
replayTimestamps,
|
|
|
- rrwebEventListFactory,
|
|
|
spansFactory,
|
|
|
} from 'sentry/utils/replays/replayDataUtils';
|
|
|
import splitAttachmentsByType from 'sentry/utils/replays/splitAttachmentsByType';
|
|
@@ -32,12 +31,11 @@ import type {
|
|
|
RecordingFrame,
|
|
|
SpanFrame,
|
|
|
} from 'sentry/utils/replays/types';
|
|
|
-import {BreadcrumbCategories, EventType} from 'sentry/utils/replays/types';
|
|
|
+import {BreadcrumbCategories} from 'sentry/utils/replays/types';
|
|
|
import type {
|
|
|
MemorySpan,
|
|
|
NetworkSpan,
|
|
|
RecordingEvent,
|
|
|
- RecordingOptions,
|
|
|
ReplayCrumb,
|
|
|
ReplayError,
|
|
|
ReplayRecord,
|
|
@@ -183,10 +181,6 @@ export default class ReplayReader {
|
|
|
rawBreadcrumbs as ReplayCrumb[],
|
|
|
this.sortedSpans
|
|
|
);
|
|
|
- this.rrwebEvents = rrwebEventListFactory(
|
|
|
- replayRecord,
|
|
|
- rawRRWebEvents as RecordingEvent[]
|
|
|
- );
|
|
|
|
|
|
this.replayRecord = replayRecord;
|
|
|
}
|
|
@@ -203,7 +197,6 @@ export default class ReplayReader {
|
|
|
private rawErrors: ReplayError[];
|
|
|
private sortedSpans: ReplaySpan[];
|
|
|
private replayRecord: ReplayRecord;
|
|
|
- private rrwebEvents: RecordingEvent[];
|
|
|
private breadcrumbs: Crumb[];
|
|
|
|
|
|
toJSON = () => this._cacheKey;
|
|
@@ -291,7 +284,24 @@ export default class ReplayReader {
|
|
|
|
|
|
getSDKOptions = () => this._optionFrame;
|
|
|
|
|
|
- // TODO: move isNetworkDetailsSetup() up here? or extract it
|
|
|
+ isNetworkDetailsSetup = memoize(() => {
|
|
|
+ const sdkOptions = this.getSDKOptions();
|
|
|
+ if (sdkOptions) {
|
|
|
+ return sdkOptions.networkDetailHasUrls;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Network data was added in JS SDK 7.50.0 while sdkConfig was added in v7.51.1
|
|
|
+ // So even if we don't have the config object, we should still fallback and
|
|
|
+ // look for spans with network data, as that means things are setup!
|
|
|
+ return this.getNetworkFrames().some(
|
|
|
+ frame =>
|
|
|
+ // We'd need to `filter()` before calling `some()` in order for TS to be happy
|
|
|
+ // @ts-expect-error
|
|
|
+ Object.keys(frame?.data?.request?.headers ?? {}).length ||
|
|
|
+ // @ts-expect-error
|
|
|
+ Object.keys(frame?.data?.response?.headers ?? {}).length
|
|
|
+ );
|
|
|
+ });
|
|
|
|
|
|
/*********************/
|
|
|
/** OLD STUFF BELOW **/
|
|
@@ -336,29 +346,6 @@ export default class ReplayReader {
|
|
|
getNetworkSpans = memoize(() => this.sortedSpans.filter(isNetworkSpan));
|
|
|
|
|
|
getMemorySpans = memoize(() => this.sortedSpans.filter(isMemorySpan));
|
|
|
-
|
|
|
- sdkConfig = memoize(() => {
|
|
|
- const found = this.rrwebEvents.find(
|
|
|
- event => event.type === EventType.Custom && event.data.tag === 'options'
|
|
|
- ) as undefined | RecordingOptions;
|
|
|
- return found?.data?.payload;
|
|
|
- });
|
|
|
-
|
|
|
- isNetworkDetailsSetup = memoize(() => {
|
|
|
- const config = this.sdkConfig();
|
|
|
- if (config) {
|
|
|
- return this.sdkConfig()?.networkDetailHasUrls;
|
|
|
- }
|
|
|
-
|
|
|
- // Network data was added in JS SDK 7.50.0 while sdkConfig was added in v7.51.1
|
|
|
- // So even if we don't have the config object, we should still fallback and
|
|
|
- // look for spans with network data, as that means things are setup!
|
|
|
- return this.getNetworkSpans().some(
|
|
|
- span =>
|
|
|
- Object.keys(span.data.request?.headers || {}).length ||
|
|
|
- Object.keys(span.data.response?.headers || {}).length
|
|
|
- );
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
const isMemorySpan = (span: ReplaySpan): span is MemorySpan => {
|