|
1 |
| -import type { continueTrace, Span } from '@sentry/core'; |
| 1 | +import type { Span } from '@sentry/core'; |
2 | 2 | import {
|
3 | 3 | SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
|
4 | 4 | SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
|
| 5 | + continueTrace, |
5 | 6 | getActiveSpan,
|
6 | 7 | getCurrentScope,
|
7 | 8 | getDefaultIsolationScope,
|
@@ -153,13 +154,18 @@ export function isFetchProxyRequired(version: string): boolean {
|
153 | 154 | * A SvelteKit handle function that wraps the request for Sentry error and
|
154 | 155 | * performance monitoring.
|
155 | 156 | *
|
156 |
| - * Some environments require a different continueTrace function. E.g. Node can use |
157 |
| - * the Opentelemetry SDK, whereas Cloudflare cannot. |
| 157 | + * Usage: |
| 158 | + * ``` |
| 159 | + * // src/hooks.server.ts |
| 160 | + * import { sentryHandle } from '@sentry/sveltekit'; |
| 161 | + * |
| 162 | + * export const handle = sentryHandle(); |
| 163 | + * |
| 164 | + * // Optionally use the `sequence` function to add additional handlers. |
| 165 | + * // export const handle = sequence(sentryHandle(), yourCustomHandler); |
| 166 | + * ``` |
158 | 167 | */
|
159 |
| -export function sentryHandleGeneric( |
160 |
| - continueTraceFunction: typeof continueTrace, |
161 |
| - handlerOptions?: SentryHandleOptions, |
162 |
| -): Handle { |
| 168 | +export function sentryHandle(handlerOptions?: SentryHandleOptions): Handle { |
163 | 169 | const options = {
|
164 | 170 | handleUnknownRoutes: false,
|
165 | 171 | injectFetchProxyScript: true,
|
@@ -189,7 +195,7 @@ export function sentryHandleGeneric(
|
189 | 195 | isolationScope.setSDKProcessingMetadata({
|
190 | 196 | normalizedRequest: winterCGRequestToRequestData(input.event.request.clone()),
|
191 | 197 | });
|
192 |
| - return continueTraceFunction(getTracePropagationData(input.event), () => instrumentHandle(input, options)); |
| 198 | + return continueTrace(getTracePropagationData(input.event), () => instrumentHandle(input, options)); |
193 | 199 | });
|
194 | 200 | };
|
195 | 201 |
|
|
0 commit comments