@@ -12,55 +12,6 @@ import { handleCallbackErrors } from '../utils/handleCallbackErrors';
1212import { hasTracingEnabled } from '../utils/hasTracingEnabled' ;
1313import { spanTimeInputToSeconds , spanToJSON } from '../utils/spanUtils' ;
1414
15- /**
16- * Wraps a function with a transaction/span and finishes the span after the function is done.
17- *
18- * Note that if you have not enabled tracing extensions via `addTracingExtensions`
19- * or you didn't set `tracesSampleRate`, this function will not generate spans
20- * and the `span` returned from the callback will be undefined.
21- *
22- * This function is meant to be used internally and may break at any time. Use at your own risk.
23- *
24- * @internal
25- * @private
26- *
27- * @deprecated Use `startSpan` instead.
28- */
29- export function trace < T > (
30- context : TransactionContext ,
31- callback : ( span ?: Span ) => T ,
32- // eslint-disable-next-line @typescript-eslint/no-empty-function
33- onError : ( error : unknown , span ?: Span ) => void = ( ) => { } ,
34- // eslint-disable-next-line @typescript-eslint/no-empty-function
35- afterFinish : ( ) => void = ( ) => { } ,
36- ) : T {
37- // eslint-disable-next-line deprecation/deprecation
38- const hub = getCurrentHub ( ) ;
39- const scope = getCurrentScope ( ) ;
40- // eslint-disable-next-line deprecation/deprecation
41- const parentSpan = scope . getSpan ( ) ;
42-
43- const ctx = normalizeContext ( context ) ;
44- const activeSpan = createChildSpanOrTransaction ( hub , parentSpan , ctx ) ;
45-
46- // eslint-disable-next-line deprecation/deprecation
47- scope . setSpan ( activeSpan ) ;
48-
49- return handleCallbackErrors (
50- ( ) => callback ( activeSpan ) ,
51- error => {
52- activeSpan && activeSpan . setStatus ( 'internal_error' ) ;
53- onError ( error , activeSpan ) ;
54- } ,
55- ( ) => {
56- activeSpan && activeSpan . end ( ) ;
57- // eslint-disable-next-line deprecation/deprecation
58- scope . setSpan ( parentSpan ) ;
59- afterFinish ( ) ;
60- } ,
61- ) ;
62- }
63-
6415/**
6516 * Wraps a function with a transaction/span and finishes the span after the function is done.
6617 * The created span is the active span and will be used as parent by other spans created inside the function
@@ -105,11 +56,6 @@ export function startSpan<T>(context: StartSpanOptions, callback: (span: Span |
10556 } ) ;
10657}
10758
108- /**
109- * @deprecated Use {@link startSpan} instead.
110- */
111- export const startActiveSpan = startSpan ;
112-
11359/**
11460 * Similar to `Sentry.startSpan`. Wraps a function with a transaction/span, but does not finish the span
11561 * after the function is done automatically. You'll have to call `span.end()` manually.
0 commit comments