@@ -60,6 +60,14 @@ export class IdleTransaction extends Transaction {
60
60
// Activities store a list of active spans
61
61
public activities : Record < string , boolean > = { } ;
62
62
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
+
63
71
// Track state of activities in previous heartbeat
64
72
private _prevHeartbeatString : string | undefined ;
65
73
@@ -77,14 +85,6 @@ export class IdleTransaction extends Transaction {
77
85
*/
78
86
private _idleTimeoutID : ReturnType < typeof global . setTimeout > | undefined ;
79
87
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
-
88
88
public constructor (
89
89
transactionContext : TransactionContext ,
90
90
private readonly _idleHub ?: Hub ,
@@ -122,7 +122,7 @@ export class IdleTransaction extends Transaction {
122
122
this . _startIdleTimeout ( ) ;
123
123
global . setTimeout ( ( ) => {
124
124
if ( ! this . _finished ) {
125
- this . _finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 3 ] ; /* 'finalTimeout' */
125
+ this . finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 3 ] ; /* 'finalTimeout' */
126
126
this . finish ( ) ;
127
127
}
128
128
} , this . _finalTimeout ) ;
@@ -133,7 +133,7 @@ export class IdleTransaction extends Transaction {
133
133
this . _finished = true ;
134
134
this . activities = { } ;
135
135
136
- this . setTag ( FINISH_REASON_TAG , this . _finishReason ) ;
136
+ this . setTag ( FINISH_REASON_TAG , this . finishReason ) ;
137
137
138
138
if ( this . spanRecorder ) {
139
139
logger . log ( '[Tracing] finishing IdleTransaction' , new Date ( endTimestamp * 1000 ) . toISOString ( ) , this . op ) ;
@@ -233,7 +233,7 @@ export class IdleTransaction extends Transaction {
233
233
this . _cancelIdleTimeout ( ) ;
234
234
this . _idleTimeoutID = global . setTimeout ( ( ) => {
235
235
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' */
237
237
this . finish ( endTimestamp ) ;
238
238
}
239
239
} , this . _idleTimeout ) ;
@@ -294,7 +294,7 @@ export class IdleTransaction extends Transaction {
294
294
if ( this . _heartbeatCounter >= 3 ) {
295
295
logger . log ( `[Tracing] Transaction finished because of no change for 3 heart beats` ) ;
296
296
this . setStatus ( 'deadline_exceeded' ) ;
297
- this . _finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 0 ] ; /* 'heartbeatFailed' */
297
+ this . finishReason = IDLE_TRANSACTION_FINISH_REASONS [ 0 ] ; /* 'heartbeatFailed' */
298
298
this . finish ( ) ;
299
299
} else {
300
300
this . _pingHeartbeat ( ) ;
0 commit comments