File tree Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
15
15
} from 'sentry/utils/replays/replayDataUtils' ;
16
16
import type {
17
17
RecordingEvent ,
18
+ RecordingOptions ,
18
19
ReplayError ,
19
20
ReplayRecord ,
20
21
ReplaySpan ,
@@ -151,11 +152,26 @@ export default class ReplayReader {
151
152
152
153
getMemorySpans = memoize ( ( ) => this . sortedSpans . filter ( isMemorySpan ) ) ;
153
154
154
- isNetworkDetailsSetup = memoize ( ( ) =>
155
- this . getNetworkSpans ( ) . some (
155
+ sdkConfig = memoize ( ( ) => {
156
+ const found = this . rrwebEvents . find (
157
+ event => event . type === 5 && event . data . tag === 'options'
158
+ ) as undefined | RecordingOptions ;
159
+ return found ?. data ?. payload ;
160
+ } ) ;
161
+
162
+ isNetworkDetailsSetup = memoize ( ( ) => {
163
+ const config = this . sdkConfig ( ) ;
164
+ if ( config ) {
165
+ return this . sdkConfig ( ) ?. networkDetailHasUrls ;
166
+ }
167
+
168
+ // Network data was added in JS SDK 7.50.0 while sdkConfig was added in v7.51.1
169
+ // So even if we don't have the config object, we should still fallback and
170
+ // look for spans with network data, as that means things are setup!
171
+ return this . getNetworkSpans ( ) . some (
156
172
span =>
157
173
Object . keys ( span . data . request ?. headers || { } ) . length ||
158
174
Object . keys ( span . data . response ?. headers || { } ) . length
159
- )
160
- ) ;
175
+ ) ;
176
+ } ) ;
161
177
}
Original file line number Diff line number Diff line change 1
- import type { eventWithTime } from '@sentry-internal/rrweb/typings/types' ;
1
+ import type { customEvent , eventWithTime } from '@sentry-internal/rrweb/typings/types' ;
2
2
import type { Duration } from 'moment' ;
3
3
4
4
import type { RawCrumb } from 'sentry/types/breadcrumbs' ;
@@ -155,6 +155,19 @@ export interface Highlight {
155
155
}
156
156
157
157
export type RecordingEvent = eventWithTime ;
158
+ export type RecordingOptions = customEvent < {
159
+ blockAllMedia : boolean ;
160
+ errorSampleRate : number ;
161
+ maskAllInputs : boolean ;
162
+ maskAllText : boolean ;
163
+ networkCaptureBodies : boolean ;
164
+ networkDetailHasUrls : boolean ;
165
+ networkRequestHasHeaders : boolean ;
166
+ networkResponseHasHeaders : boolean ;
167
+ sessionSampleRate : number ;
168
+ useCompression : boolean ;
169
+ useCompressionOption : boolean ;
170
+ } > ;
158
171
159
172
export interface ReplaySpan < T = Record < string , any > > {
160
173
data : T ;
You can’t perform that action at this time.
0 commit comments