@@ -96,7 +96,8 @@ export class TransactionActivity implements Integration {
96
96
return TransactionActivity . _enabled ;
97
97
}
98
98
// This happens only in test cases where the integration isn't initalized properly
99
- if ( ! TransactionActivity . options || isNaN ( TransactionActivity . options . tracesSampleRate ) ) {
99
+ // tslint:disable-next-line: strict-type-predicates
100
+ if ( ! TransactionActivity . options || typeof TransactionActivity . options . tracesSampleRate !== 'number' ) {
100
101
return false ;
101
102
}
102
103
TransactionActivity . _enabled = Math . random ( ) > TransactionActivity . options . tracesSampleRate ? false : true ;
@@ -111,6 +112,7 @@ export class TransactionActivity implements Integration {
111
112
// Tracing is not enabled
112
113
return undefined ;
113
114
}
115
+
114
116
const activeTransaction = TransactionActivity . _activeTransaction ;
115
117
116
118
if ( activeTransaction ) {
@@ -140,9 +142,11 @@ export class TransactionActivity implements Integration {
140
142
141
143
TransactionActivity . _activeTransaction = span ;
142
144
143
- hub . configureScope ( ( scope : Scope ) => {
144
- scope . setSpan ( span ) ;
145
- } ) ;
145
+ // We need to do this workaround here and not use configureScope
146
+ // Reason being at the time we start the inital transaction we do not have a client bound on the hub yet
147
+ // therefore configureScope wouldn't be executed and we would miss setting the transaction
148
+ // tslint:disable-next-line: no-unsafe-any
149
+ ( hub as any ) . getScope ( ) . setSpan ( span ) ;
146
150
147
151
// The reason we do this here is because of cached responses
148
152
// If we start and transaction without an activity it would never finish since there is no activity
@@ -185,6 +189,10 @@ export class TransactionActivity implements Integration {
185
189
// Tracing is not enabled
186
190
return 0 ;
187
191
}
192
+
193
+ // We want to clear the timeout also here since we push a new activity
194
+ clearTimeout ( TransactionActivity . _debounce ) ;
195
+
188
196
const _getCurrentHub = TransactionActivity . _getCurrentHub ;
189
197
if ( spanContext && _getCurrentHub ) {
190
198
const hub = _getCurrentHub ( ) ;
@@ -211,6 +219,7 @@ export class TransactionActivity implements Integration {
211
219
// Tracing is not enabled
212
220
return ;
213
221
}
222
+
214
223
const activity = TransactionActivity . _activities [ id ] ;
215
224
if ( activity ) {
216
225
if ( activity . span ) {
0 commit comments