@@ -60,6 +60,14 @@ export class IdleTransaction extends Transaction {
6060 // Activities store a list of active spans
6161 public activities : Record < string , boolean > = { } ;
6262
63+ /**
64+ *
65+ * Defaults to `externalFinish`, which means transaction.finish() was called outside of the idle transaction (for example,
66+ * by a navigation transaction ending the previous pageload/navigation in some routing instrumentation).
67+ * @default 'externalFinish'
68+ */
69+ public finishReason : typeof IDLE_TRANSACTION_FINISH_REASONS [ number ] = IDLE_TRANSACTION_FINISH_REASONS [ 4 ] ;
70+
6371 // Track state of activities in previous heartbeat
6472 private _prevHeartbeatString : string | undefined ;
6573
@@ -77,14 +85,6 @@ export class IdleTransaction extends Transaction {
7785 */
7886 private _idleTimeoutID : ReturnType < typeof global . setTimeout > | undefined ;
7987
80- /**
81- *
82- * Defaults to `externalFinish`, which means transaction.finish() was called outside of the idle transaction (for example,
83- * by a navigation transaction ending the previous pageload/navigation in some routing instrumentation).
84- * @default 'externalFinish'
85- */
86- private _finishReason : typeof IDLE_TRANSACTION_FINISH_REASONS [ number ] = IDLE_TRANSACTION_FINISH_REASONS [ 4 ] ;
87-
8888 public constructor (
8989 transactionContext : TransactionContext ,
9090 private readonly _idleHub ?: Hub ,
@@ -122,7 +122,7 @@ export class IdleTransaction extends Transaction {
122122 this . _startIdleTimeout ( ) ;
123123 global . setTimeout ( ( ) => {
124124 if ( ! this . _finished ) {
125- this . _finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 3 ] ; /* 'finalTimeout' */
125+ this . finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 3 ] ; /* 'finalTimeout' */
126126 this . finish ( ) ;
127127 }
128128 } , this . _finalTimeout ) ;
@@ -133,7 +133,7 @@ export class IdleTransaction extends Transaction {
133133 this . _finished = true ;
134134 this . activities = { } ;
135135
136- this . setTag ( FINISH_REASON_TAG , this . _finishReason ) ;
136+ this . setTag ( FINISH_REASON_TAG , this . finishReason ) ;
137137
138138 if ( this . spanRecorder ) {
139139 logger . log ( '[Tracing] finishing IdleTransaction' , new Date ( endTimestamp * 1000 ) . toISOString ( ) , this . op ) ;
@@ -233,7 +233,7 @@ export class IdleTransaction extends Transaction {
233233 this . _cancelIdleTimeout ( ) ;
234234 this . _idleTimeoutID = global . setTimeout ( ( ) => {
235235 if ( ! this . _finished && Object . keys ( this . activities ) . length === 0 ) {
236- this . _finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 1 ] ; /* 'idleTimeout' */
236+ this . finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 1 ] ; /* 'idleTimeout' */
237237 this . finish ( endTimestamp ) ;
238238 }
239239 } , this . _idleTimeout ) ;
@@ -294,7 +294,7 @@ export class IdleTransaction extends Transaction {
294294 if ( this . _heartbeatCounter >= 3 ) {
295295 logger . log ( `[Tracing] Transaction finished because of no change for 3 heart beats` ) ;
296296 this . setStatus ( 'deadline_exceeded' ) ;
297- this . _finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 0 ] ; /* 'heartbeatFailed' */
297+ this . finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 0 ] ; /* 'heartbeatFailed' */
298298 this . finish ( ) ;
299299 } else {
300300 this . _pingHeartbeat ( ) ;
0 commit comments