You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We set the transaction here on the scope so error events pick up the trace
@@ -131,7 +143,10 @@ export class IdleTransaction extends Transaction {
131
143
_idleHub.getScope().setSpan(this);
132
144
}
133
145
134
-
this._restartIdleTimeout();
146
+
if(!delayAutoFinishUntilSignal){
147
+
this._restartIdleTimeout();
148
+
}
149
+
135
150
setTimeout(()=>{
136
151
if(!this._finished){
137
152
this.setStatus('deadline_exceeded');
@@ -217,7 +232,7 @@ export class IdleTransaction extends Transaction {
217
232
}
218
233
219
234
/**
220
-
* Register a callback function that gets excecuted before the transaction finishes.
235
+
* Register a callback function that gets executed before the transaction finishes.
221
236
* Useful for cleanup or if you want to add any additional spans based on current context.
222
237
*
223
238
* This is exposed because users have no other way of running something before an idle transaction
@@ -298,6 +313,17 @@ export class IdleTransaction extends Transaction {
298
313
this._finishReason=reason;
299
314
}
300
315
316
+
/**
317
+
* Permits the IdleTransaction to automatically end itself via the idle timeout and heartbeat mechanisms when the `delayAutoFinishUntilSignal` option was set to `true`.
318
+
*/
319
+
publicsendAutoFinishSignal(): void{
320
+
if(!this._autoFinishAllowed){
321
+
DEBUG_BUILD&&logger.log('[Tracing] Received finish signal for idle transaction.');
322
+
this._restartIdleTimeout();
323
+
this._autoFinishAllowed=true;
324
+
}
325
+
}
326
+
301
327
/**
302
328
* Restarts idle timeout, if there is no running idle timeout it will start one.
303
329
*/
@@ -337,8 +363,10 @@ export class IdleTransaction extends Transaction {
0 commit comments