Skip to content

Commit 97f48ff

Browse files
committed
ref(sveltekit): Clean up sub-request check
1 parent aa38e37 commit 97f48ff

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/sveltekit/src/server/handle.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,13 @@ export function sentryHandle(handlerOptions?: SentryHandleOptions): Handle {
100100
};
101101

102102
const sentryRequestHandler: Handle = input => {
103-
// event.isSubRequest was added in SvelteKit 1.21.0 and we can use it to check
104-
// if we should create a new execution context or not.
105103
// In case of a same-origin `fetch` call within a server`load` function,
106104
// SvelteKit will actually just re-enter the `handle` function and set `isSubRequest`
107105
// to `true` so that no additional network call is made.
108106
// We want the `http.server` span of that nested call to be a child span of the
109107
// currently active span instead of a new root span to correctly reflect this
110108
// behavior.
111-
// As a fallback for Kit < 1.21.0, we check if there is an active span only if there's none,
112-
// we create a new execution context.
113-
const isSubRequest = typeof input.event.isSubRequest === 'boolean' ? input.event.isSubRequest : !!getActiveSpan();
114-
115-
if (isSubRequest) {
109+
if (input.event.isSubRequest) {
116110
return instrumentHandle(input, options);
117111
}
118112

0 commit comments

Comments
 (0)