@@ -12,7 +12,7 @@ import type { Span, Transaction } from '@sentry/types';
1212import { GLOBAL_OBJ , browserPerformanceTimeOrigin , timestampInSeconds } from '@sentry/utils' ;
1313
1414import type { BrowserClient } from '..' ;
15- import { getActiveTransaction } from '..' ;
15+ import { getActiveSpan , startInactiveSpan } from '..' ;
1616import type { EmberRouterMain , EmberSentryConfig , GlobalConfig , OwnConfig , StartTransactionFunction } from '../types' ;
1717
1818type SentryTestRouterService = RouterService & {
@@ -149,10 +149,9 @@ export function _instrumentEmberRouter(
149149 'routing.instrumentation' : '@sentry/ember' ,
150150 } ,
151151 } ) ;
152- // eslint-disable-next-line deprecation/deprecation
153- transitionSpan = activeTransaction ?. startChild ( {
152+ transitionSpan = startInactiveSpan ( {
154153 op : 'ui.ember.transition' ,
155- description : `route:${ fromRoute } -> route:${ toRoute } ` ,
154+ name : `route:${ fromRoute } -> route:${ toRoute } ` ,
156155 origin : 'auto.ui.ember' ,
157156 } ) ;
158157 } ) ;
@@ -196,9 +195,8 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
196195 if ( previousInstance ) {
197196 return ;
198197 }
199- // eslint-disable-next-line deprecation/deprecation
200- const activeTransaction = getActiveTransaction ( ) ;
201- if ( ! activeTransaction ) {
198+ const activeSpan = getActiveSpan ( ) ;
199+ if ( ! activeSpan ) {
202200 return ;
203201 }
204202 if ( currentQueueSpan ) {
@@ -213,24 +211,20 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
213211 const minQueueDuration = minimumRunloopQueueDuration ?? 5 ;
214212
215213 if ( ( now - currentQueueStart ) * 1000 >= minQueueDuration ) {
216- activeTransaction
217- // eslint-disable-next-line deprecation/deprecation
218- ?. startChild ( {
219- op : `ui.ember.runloop.${ queue } ` ,
220- origin : 'auto.ui.ember' ,
221- startTimestamp : currentQueueStart ,
222- endTimestamp : now ,
223- } )
224- . end ( ) ;
214+ startInactiveSpan ( {
215+ name : 'runloop' ,
216+ op : `ui.ember.runloop.${ queue } ` ,
217+ origin : 'auto.ui.ember' ,
218+ startTimestamp : currentQueueStart ,
219+ } ) ?. end ( now ) ;
225220 }
226221 currentQueueStart = undefined ;
227222 }
228223
229224 // Setup for next queue
230225
231- // eslint-disable-next-line deprecation/deprecation
232- const stillActiveTransaction = getActiveTransaction ( ) ;
233- if ( ! stillActiveTransaction ) {
226+ const stillActiveSpan = getActiveSpan ( ) ;
227+ if ( ! stillActiveSpan ) {
234228 return ;
235229 }
236230 currentQueueStart = timestampInSeconds ( ) ;
@@ -290,16 +284,12 @@ function processComponentRenderAfter(
290284 const componentRenderDuration = now - begin . now ;
291285
292286 if ( componentRenderDuration * 1000 >= minComponentDuration ) {
293- // eslint-disable-next-line deprecation/deprecation
294- const activeTransaction = getActiveTransaction ( ) ;
295- // eslint-disable-next-line deprecation/deprecation
296- activeTransaction ?. startChild ( {
287+ startInactiveSpan ( {
288+ name : payload . containerKey || payload . object ,
297289 op,
298- description : payload . containerKey || payload . object ,
299290 origin : 'auto.ui.ember' ,
300291 startTimestamp : begin . now ,
301- endTimestamp : now ,
302- } ) ;
292+ } ) ?. end ( now ) ;
303293 }
304294}
305295
@@ -377,15 +367,12 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
377367 const startTimestamp = ( measure . startTime + browserPerformanceTimeOrigin ) / 1000 ;
378368 const endTimestamp = startTimestamp + measure . duration / 1000 ;
379369
380- // eslint-disable-next-line deprecation/deprecation
381- const transaction = getActiveTransaction ( ) ;
382- // eslint-disable-next-line deprecation/deprecation
383- const span = transaction ?. startChild ( {
370+ startInactiveSpan ( {
384371 op : 'ui.ember.init' ,
372+ name : 'init' ,
385373 origin : 'auto.ui.ember' ,
386374 startTimestamp,
387- } ) ;
388- span ?. end ( endTimestamp ) ;
375+ } ) ?. end ( endTimestamp ) ;
389376 performance . clearMarks ( startName ) ;
390377 performance . clearMarks ( endName ) ;
391378
0 commit comments