@@ -10,7 +10,7 @@ import {
10
10
shouldSkipTracingTest ,
11
11
} from '../../../../utils/helpers' ;
12
12
13
- sentryTest ( 'creates a new trace on each navigation' , async ( { getLocalTestUrl, page } ) => {
13
+ sentryTest ( 'creates a new trace and sample_rand on each navigation' , async ( { getLocalTestUrl, page } ) => {
14
14
if ( shouldSkipTracingTest ( ) ) {
15
15
sentryTest . skip ( ) ;
16
16
}
@@ -49,6 +49,7 @@ sentryTest('creates a new trace on each navigation', async ({ getLocalTestUrl, p
49
49
sample_rate : '1' ,
50
50
sampled : 'true' ,
51
51
trace_id : navigation1TraceContext ?. trace_id ,
52
+ sample_rand : expect . any ( String ) ,
52
53
} ) ;
53
54
54
55
expect ( navigation2TraceContext ) . toMatchObject ( {
@@ -64,9 +65,11 @@ sentryTest('creates a new trace on each navigation', async ({ getLocalTestUrl, p
64
65
sample_rate : '1' ,
65
66
sampled : 'true' ,
66
67
trace_id : navigation2TraceContext ?. trace_id ,
68
+ sample_rand : expect . any ( String ) ,
67
69
} ) ;
68
70
69
71
expect ( navigation1TraceContext ?. trace_id ) . not . toEqual ( navigation2TraceContext ?. trace_id ) ;
72
+ expect ( navigation1TraceHeader ?. sample_rand ) . not . toEqual ( navigation2TraceHeader ?. sample_rand ) ;
70
73
} ) ;
71
74
72
75
sentryTest ( 'error after navigation has navigation traceId' , async ( { getLocalTestUrl, page } ) => {
@@ -101,6 +104,7 @@ sentryTest('error after navigation has navigation traceId', async ({ getLocalTes
101
104
sample_rate : '1' ,
102
105
sampled : 'true' ,
103
106
trace_id : navigationTraceContext ?. trace_id ,
107
+ sample_rand : expect . any ( String ) ,
104
108
} ) ;
105
109
106
110
const errorEventPromise = getFirstSentryEnvelopeRequest < EventAndTraceHeader > (
@@ -124,6 +128,7 @@ sentryTest('error after navigation has navigation traceId', async ({ getLocalTes
124
128
sample_rate : '1' ,
125
129
sampled : 'true' ,
126
130
trace_id : navigationTraceContext ?. trace_id ,
131
+ sample_rand : expect . any ( String ) ,
127
132
} ) ;
128
133
} ) ;
129
134
@@ -168,6 +173,7 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc
168
173
sample_rate : '1' ,
169
174
sampled : 'true' ,
170
175
trace_id : navigationTraceContext ?. trace_id ,
176
+ sample_rand : expect . any ( String ) ,
171
177
} ) ;
172
178
173
179
const errorTraceContext = errorEvent ?. contexts ?. trace ;
@@ -182,6 +188,7 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc
182
188
sample_rate : '1' ,
183
189
sampled : 'true' ,
184
190
trace_id : navigationTraceContext ?. trace_id ,
191
+ sample_rand : expect . any ( String ) ,
185
192
} ) ;
186
193
} ) ;
187
194
@@ -234,6 +241,7 @@ sentryTest(
234
241
sample_rate : '1' ,
235
242
sampled : 'true' ,
236
243
trace_id : navigationTraceContext ?. trace_id ,
244
+ sample_rand : expect . any ( String ) ,
237
245
} ) ;
238
246
239
247
const headers = request . headers ( ) ;
@@ -242,7 +250,7 @@ sentryTest(
242
250
const navigationTraceId = navigationTraceContext ?. trace_id ;
243
251
expect ( headers [ 'sentry-trace' ] ) . toMatch ( new RegExp ( `^${ navigationTraceId } -[0-9a-f]{16}-1$` ) ) ;
244
252
expect ( headers [ 'baggage' ] ) . toEqual (
245
- `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${ navigationTraceId } ,sentry-sample_rate=1,sentry-sampled=true` ,
253
+ `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${ navigationTraceId } ,sentry-sample_rate=1,sentry-sampled=true,sentry-sample_rand= ${ navigationTraceHeader ?. sample_rand } ` ,
246
254
) ;
247
255
} ,
248
256
) ;
@@ -296,6 +304,7 @@ sentryTest(
296
304
sample_rate : '1' ,
297
305
sampled : 'true' ,
298
306
trace_id : navigationTraceContext ?. trace_id ,
307
+ sample_rand : expect . any ( String ) ,
299
308
} ) ;
300
309
301
310
const headers = request . headers ( ) ;
@@ -304,7 +313,7 @@ sentryTest(
304
313
const navigationTraceId = navigationTraceContext ?. trace_id ;
305
314
expect ( headers [ 'sentry-trace' ] ) . toMatch ( new RegExp ( `^${ navigationTraceId } -[0-9a-f]{16}-1$` ) ) ;
306
315
expect ( headers [ 'baggage' ] ) . toEqual (
307
- `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${ navigationTraceId } ,sentry-sample_rate=1,sentry-sampled=true` ,
316
+ `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${ navigationTraceId } ,sentry-sample_rate=1,sentry-sampled=true,sentry-sample_rand= ${ navigationTraceHeader ?. sample_rand } ` ,
308
317
) ;
309
318
} ,
310
319
) ;
0 commit comments