@@ -224,31 +224,54 @@ export function getActiveSpan(): Span | undefined {
224
224
return getCurrentScope ( ) . getSpan ( ) ;
225
225
}
226
226
227
- export function continueTrace ( {
228
- sentryTrace,
229
- baggage,
230
- } : {
231
- sentryTrace : Parameters < typeof tracingContextFromHeaders > [ 0 ] ;
232
- baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
233
- } ) : Partial < TransactionContext > ;
234
- export function continueTrace < V > (
235
- {
227
+ interface ContinueTrace {
228
+ /**
229
+ * Continue a trace from `sentry-trace` and `baggage` values.
230
+ * These values can be obtained from incoming request headers,
231
+ * or in the browser from `<meta name="sentry-trace">` and `<meta name="baggage">` HTML tags.
232
+ *
233
+ * @deprecated Use the version of this function taking a callback as second parameter instead:
234
+ *
235
+ * ```
236
+ * Sentry.continueTrace(sentryTrace: '...', baggage: '...' }, () => {
237
+ * // ...
238
+ * })
239
+ * ```
240
+ *
241
+ */
242
+ ( {
236
243
sentryTrace,
237
244
baggage,
238
245
} : {
239
246
sentryTrace : Parameters < typeof tracingContextFromHeaders > [ 0 ] ;
240
247
baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
241
- } ,
242
- callback : ( transactionContext : Partial < TransactionContext > ) => V ,
243
- ) : V ;
244
- /**
245
- * Continue a trace from `sentry-trace` and `baggage` values.
246
- * These values can be obtained from incoming request headers,
247
- * or in the browser from `<meta name="sentry-trace">` and `<meta name="baggage">` HTML tags.
248
- *
249
- * The callback receives a transactionContext that may be used for `startTransaction` or `startSpan`.
250
- */
251
- export function continueTrace < V > (
248
+ } ) : Partial < TransactionContext > ;
249
+
250
+ /**
251
+ * Continue a trace from `sentry-trace` and `baggage` values.
252
+ * These values can be obtained from incoming request headers, or in the browser from `<meta name="sentry-trace">`
253
+ * and `<meta name="baggage">` HTML tags.
254
+ *
255
+ * Spans started with `startSpan`, `startSpanManual` and `startInactiveSpan`, within the callback will automatically
256
+ * be attached to the incoming trace.
257
+ *
258
+ * Deprecation notice: In the next major version of the SDK the provided callback will not receive a transaction
259
+ * context argument.
260
+ */
261
+ < V > (
262
+ {
263
+ sentryTrace,
264
+ baggage,
265
+ } : {
266
+ sentryTrace : Parameters < typeof tracingContextFromHeaders > [ 0 ] ;
267
+ baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
268
+ } ,
269
+ // TODO(v8): Remove parameter from this callback.
270
+ callback : ( transactionContext : Partial < TransactionContext > ) => V ,
271
+ ) : V ;
272
+ }
273
+
274
+ export const continueTrace : ContinueTrace = < V > (
252
275
{
253
276
sentryTrace,
254
277
baggage,
@@ -257,7 +280,7 @@ export function continueTrace<V>(
257
280
baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
258
281
} ,
259
282
callback ?: ( transactionContext : Partial < TransactionContext > ) => V ,
260
- ) : V | Partial < TransactionContext > {
283
+ ) : V | Partial < TransactionContext > => {
261
284
const currentScope = getCurrentScope ( ) ;
262
285
263
286
const { traceparentData, dynamicSamplingContext, propagationContext } = tracingContextFromHeaders (
@@ -283,7 +306,7 @@ export function continueTrace<V>(
283
306
}
284
307
285
308
return callback ( transactionContext ) ;
286
- }
309
+ } ;
287
310
288
311
function createChildSpanOrTransaction (
289
312
hub : Hub ,
0 commit comments