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');
@@ -215,7 +230,7 @@ export class IdleTransaction extends Transaction {
215
230
}
216
231
217
232
/**
218
-
* Register a callback function that gets excecuted before the transaction finishes.
233
+
* Register a callback function that gets executed before the transaction finishes.
219
234
* Useful for cleanup or if you want to add any additional spans based on current context.
220
235
*
221
236
* This is exposed because users have no other way of running something before an idle transaction
@@ -296,13 +311,24 @@ export class IdleTransaction extends Transaction {
296
311
this._finishReason=reason;
297
312
}
298
313
314
+
/**
315
+
* Permits the IdleTransaction to automatically end itself via the idle timeout and heartbeat mechanisms when the `delayAutoFinishUntilSignal` option was set to `true`.
316
+
*/
317
+
publicsendAutoFinishSignal(): void{
318
+
if(!this._autoFinishAllowed){
319
+
DEBUG_BUILD&&logger.log('[Tracing] Received finish signal for idle transaction.');
320
+
this._restartIdleTimeout();
321
+
this._autoFinishAllowed=true;
322
+
}
323
+
}
324
+
299
325
/**
300
326
* Restarts idle timeout, if there is no running idle timeout it will start one.
0 commit comments