File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
dev-packages/e2e-tests/test-applications/react-create-hash-router
packages/browser-utils/src/metrics Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ Sentry.init({
38
38
replaysSessionSampleRate : 1.0 ,
39
39
replaysOnErrorSampleRate : 0.0 ,
40
40
41
- debug : ! ! process . env . DEBUG ,
41
+ debug : true ,
42
42
} ) ;
43
43
44
44
const sentryCreateHashRouter = Sentry . wrapCreateBrowserRouter ( createHashRouter ) ;
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ test('Captures a pageload transaction', async ({ page }) => {
6
6
return event . contexts ?. trace ?. op === 'pageload' ;
7
7
} ) ;
8
8
9
+ page . on ( 'console' , msg => console . log ( msg . text ( ) ) ) ;
10
+
9
11
await page . goto ( '/' ) ;
10
12
11
13
const transactionEvent = await transactionEventPromise ;
12
14
expect ( transactionEvent . contexts ?. trace ) . toEqual ( {
13
- data : expect . objectContaining ( {
15
+ data : {
14
16
deviceMemory : expect . any ( String ) ,
15
17
effectiveConnectionType : expect . any ( String ) ,
16
18
hardwareConcurrency : expect . any ( String ) ,
@@ -19,7 +21,7 @@ test('Captures a pageload transaction', async ({ page }) => {
19
21
'sentry.origin' : 'auto.pageload.react.reactrouter_v6' ,
20
22
'sentry.sample_rate' : 1 ,
21
23
'sentry.source' : 'route' ,
22
- } ) ,
24
+ } ,
23
25
op : 'pageload' ,
24
26
span_id : expect . any ( String ) ,
25
27
trace_id : expect . any ( String ) ,
Original file line number Diff line number Diff line change 1
1
import type { SentrySpan } from '@sentry/core' ;
2
2
import { spanToJSON , startInactiveSpan , withActiveSpan } from '@sentry/core' ;
3
3
import type { Span , SpanTimeInput , StartSpanOptions } from '@sentry/types' ;
4
+ import { logger } from '@sentry/utils' ;
5
+ import { DEBUG_BUILD } from '../debug-build' ;
4
6
import { WINDOW } from '../types' ;
5
7
6
8
/**
@@ -20,12 +22,13 @@ export function startAndEndSpan(
20
22
startTimeInSeconds : number ,
21
23
endTime : SpanTimeInput ,
22
24
{ ...ctx } : StartSpanOptions ,
23
- ) : Span | undefined {
25
+ ) : Span {
24
26
const parentStartTime = spanToJSON ( parentSpan ) . start_timestamp ;
25
27
if ( parentStartTime && parentStartTime > startTimeInSeconds ) {
26
28
// We can only do this for SentrySpans...
27
29
if ( typeof ( parentSpan as Partial < SentrySpan > ) . updateStartTime === 'function' ) {
28
30
( parentSpan as SentrySpan ) . updateStartTime ( startTimeInSeconds ) ;
31
+ DEBUG_BUILD && logger . log ( 'Updated parent span start to start of child span.' , ctx ) ;
29
32
}
30
33
}
31
34
@@ -36,9 +39,7 @@ export function startAndEndSpan(
36
39
...ctx ,
37
40
} ) ;
38
41
39
- if ( span ) {
40
- span . end ( endTime ) ;
41
- }
42
+ span . end ( endTime ) ;
42
43
43
44
return span ;
44
45
} ) ;
You can’t perform that action at this time.
0 commit comments