File tree 2 files changed +5
-1
lines changed
nextjs/src/client/routing
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export function appRouterInstrumentNavigation(client: Client): void {
61
61
WINDOW . addEventListener ( 'popstate' , ( ) => {
62
62
if ( currentNavigationSpan && currentNavigationSpan . isRecording ( ) ) {
63
63
currentNavigationSpan . updateName ( WINDOW . location . pathname ) ;
64
+ currentNavigationSpan . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , 'url' ) ;
64
65
} else {
65
66
currentNavigationSpan = startBrowserTracingNavigationSpan ( client , {
66
67
name : WINDOW . location . pathname ,
@@ -105,9 +106,11 @@ export function appRouterInstrumentNavigation(client: Client): void {
105
106
106
107
if ( routerFunctionName === 'push' ) {
107
108
span ?. updateName ( transactionNameifyRouterArgument ( argArray [ 0 ] ) ) ;
109
+ span ?. setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , 'url' ) ;
108
110
span ?. setAttribute ( 'navigation.type' , 'router.push' ) ;
109
111
} else if ( routerFunctionName === 'replace' ) {
110
112
span ?. updateName ( transactionNameifyRouterArgument ( argArray [ 0 ] ) ) ;
113
+ span ?. setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , 'url' ) ;
111
114
span ?. setAttribute ( 'navigation.type' , 'router.replace' ) ;
112
115
} else if ( routerFunctionName === 'back' ) {
113
116
span ?. setAttribute ( 'navigation.type' , 'router.back' ) ;
Original file line number Diff line number Diff line change @@ -82,13 +82,14 @@ function withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<Rou
82
82
const rootSpan = getActiveRootSpan ( ) ;
83
83
84
84
if ( rootSpan ) {
85
- const { op, description } = spanToJSON ( rootSpan ) ;
85
+ const { op, description, data } = spanToJSON ( rootSpan ) ;
86
86
87
87
// We only need to update navigation spans that have been created by
88
88
// a browser back-button navigation (stored as `-1` by solid router)
89
89
// everything else was already instrumented correctly in `useBeforeLeave`
90
90
if ( op === 'navigation' && description === '-1' ) {
91
91
rootSpan . updateName ( name ) ;
92
+ rootSpan . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , data && data [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] ) ;
92
93
}
93
94
}
94
95
} ) ;
You can’t perform that action at this time.
0 commit comments