|
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, |
@@ -137,13 +138,18 @@ export async function instrumentHandle( |
137 | 138 | * A SvelteKit handle function that wraps the request for Sentry error and |
138 | 139 | * performance monitoring. |
139 | 140 | * |
140 | | - * Some environments require a different continueTrace function. E.g. Node can use |
141 | | - * the Opentelemetry SDK, whereas Cloudflare cannot. |
| 141 | + * Usage: |
| 142 | + * ``` |
| 143 | + * // src/hooks.server.ts |
| 144 | + * import { sentryHandle } from '@sentry/sveltekit'; |
| 145 | + * |
| 146 | + * export const handle = sentryHandle(); |
| 147 | + * |
| 148 | + * // Optionally use the `sequence` function to add additional handlers. |
| 149 | + * // export const handle = sequence(sentryHandle(), yourCustomHandler); |
| 150 | + * ``` |
142 | 151 | */ |
143 | | -export function sentryHandleGeneric( |
144 | | - continueTraceFunction: typeof continueTrace, |
145 | | - handlerOptions?: SentryHandleOptions, |
146 | | -): Handle { |
| 152 | +export function sentryHandle(handlerOptions?: SentryHandleOptions): Handle { |
147 | 153 | const options = { |
148 | 154 | handleUnknownRoutes: false, |
149 | 155 | injectFetchProxyScript: true, |
@@ -173,7 +179,7 @@ export function sentryHandleGeneric( |
173 | 179 | isolationScope.setSDKProcessingMetadata({ |
174 | 180 | normalizedRequest: winterCGRequestToRequestData(input.event.request.clone()), |
175 | 181 | }); |
176 | | - return continueTraceFunction(getTracePropagationData(input.event), () => instrumentHandle(input, options)); |
| 182 | + return continueTrace(getTracePropagationData(input.event), () => instrumentHandle(input, options)); |
177 | 183 | }); |
178 | 184 | }; |
179 | 185 |
|
|
0 commit comments