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({
3838 replaysSessionSampleRate : 1.0 ,
3939 replaysOnErrorSampleRate : 0.0 ,
4040
41- debug : ! ! process . env . DEBUG ,
41+ debug : true ,
4242} ) ;
4343
4444const 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 }) => {
66 return event . contexts ?. trace ?. op === 'pageload' ;
77 } ) ;
88
9+ page . on ( 'console' , msg => console . log ( msg . text ( ) ) ) ;
10+
911 await page . goto ( '/' ) ;
1012
1113 const transactionEvent = await transactionEventPromise ;
1214 expect ( transactionEvent . contexts ?. trace ) . toEqual ( {
13- data : expect . objectContaining ( {
15+ data : {
1416 deviceMemory : expect . any ( String ) ,
1517 effectiveConnectionType : expect . any ( String ) ,
1618 hardwareConcurrency : expect . any ( String ) ,
@@ -19,7 +21,7 @@ test('Captures a pageload transaction', async ({ page }) => {
1921 'sentry.origin' : 'auto.pageload.react.reactrouter_v6' ,
2022 'sentry.sample_rate' : 1 ,
2123 'sentry.source' : 'route' ,
22- } ) ,
24+ } ,
2325 op : 'pageload' ,
2426 span_id : expect . any ( String ) ,
2527 trace_id : expect . any ( String ) ,
Original file line number Diff line number Diff line change 11import type { SentrySpan } from '@sentry/core' ;
22import { spanToJSON , startInactiveSpan , withActiveSpan } from '@sentry/core' ;
33import type { Span , SpanTimeInput , StartSpanOptions } from '@sentry/types' ;
4+ import { logger } from '@sentry/utils' ;
5+ import { DEBUG_BUILD } from '../debug-build' ;
46import { WINDOW } from '../types' ;
57
68/**
@@ -20,12 +22,13 @@ export function startAndEndSpan(
2022 startTimeInSeconds : number ,
2123 endTime : SpanTimeInput ,
2224 { ...ctx } : StartSpanOptions ,
23- ) : Span | undefined {
25+ ) : Span {
2426 const parentStartTime = spanToJSON ( parentSpan ) . start_timestamp ;
2527 if ( parentStartTime && parentStartTime > startTimeInSeconds ) {
2628 // We can only do this for SentrySpans...
2729 if ( typeof ( parentSpan as Partial < SentrySpan > ) . updateStartTime === 'function' ) {
2830 ( parentSpan as SentrySpan ) . updateStartTime ( startTimeInSeconds ) ;
31+ DEBUG_BUILD && logger . log ( 'Updated parent span start to start of child span.' , ctx ) ;
2932 }
3033 }
3134
@@ -36,9 +39,7 @@ export function startAndEndSpan(
3639 ...ctx ,
3740 } ) ;
3841
39- if ( span ) {
40- span . end ( endTime ) ;
41- }
42+ span . end ( endTime ) ;
4243
4344 return span ;
4445 } ) ;
You can’t perform that action at this time.
0 commit comments