2
2
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ,
3
3
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ,
4
4
getActiveSpan ,
5
+ getDefaultIsolationScope ,
6
+ getIsolationScope ,
5
7
getRootSpan ,
6
8
setHttpStatus ,
7
9
spanToTraceHeader ,
@@ -10,11 +12,12 @@ import {
10
12
import { startSpan } from '@sentry/core' ;
11
13
import { captureException , continueTrace } from '@sentry/node' ;
12
14
import type { Span } from '@sentry/types' ;
13
- import { dynamicSamplingContextToSentryBaggageHeader , objectify } from '@sentry/utils' ;
15
+ import { dynamicSamplingContextToSentryBaggageHeader , logger , objectify } from '@sentry/utils' ;
14
16
import type { Handle , ResolveOptions } from '@sveltejs/kit' ;
15
17
16
18
import { getDynamicSamplingContextFromSpan } from '@sentry/opentelemetry' ;
17
19
20
+ import { DEBUG_BUILD } from '../common/debug-build' ;
18
21
import { isHttpError , isRedirect } from '../common/utils' ;
19
22
import { flushIfServerless , getTracePropagationData } from './utils' ;
20
23
@@ -183,6 +186,14 @@ async function instrumentHandle(
183
186
return resolve ( event ) ;
184
187
}
185
188
189
+ const routeName = `${ event . request . method } ${ event . route ?. id || event . url . pathname } ` ;
190
+
191
+ if ( getIsolationScope ( ) !== getDefaultIsolationScope ( ) ) {
192
+ getIsolationScope ( ) . setTransactionName ( routeName ) ;
193
+ } else {
194
+ DEBUG_BUILD && logger . warn ( 'Isolation scope is default isolation scope - skipping setting transactionName' ) ;
195
+ }
196
+
186
197
try {
187
198
const resolveResult = await startSpan (
188
199
{
@@ -192,7 +203,7 @@ async function instrumentHandle(
192
203
[ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : event . route ?. id ? 'route' : 'url' ,
193
204
'http.method' : event . request . method ,
194
205
} ,
195
- name : ` ${ event . request . method } ${ event . route ?. id || event . url . pathname } ` ,
206
+ name : routeName ,
196
207
} ,
197
208
async ( span ?: Span ) => {
198
209
const res = await resolve ( event , {
0 commit comments