@@ -149,7 +149,13 @@ export class TraceStateMachine<ScopeT extends ScopeBase> {
149
149
// does span satisfy any of the "interruptOn" definitions
150
150
if ( this . context . definition . interruptOn ) {
151
151
for ( const definition of this . context . definition . interruptOn ) {
152
- if ( doesEntryMatchDefinition ( spanAndAnnotation , definition ) ) {
152
+ if (
153
+ doesEntryMatchDefinition (
154
+ spanAndAnnotation ,
155
+ definition ,
156
+ this . context . input . scope ,
157
+ )
158
+ ) {
153
159
return {
154
160
transitionToState : 'interrupted' ,
155
161
interruptionReason : 'matched-on-interrupt' ,
@@ -160,7 +166,13 @@ export class TraceStateMachine<ScopeT extends ScopeBase> {
160
166
161
167
for ( let i = 0 ; i < this . context . definition . requiredToEnd . length ; i ++ ) {
162
168
const definition = this . context . definition . requiredToEnd [ i ] !
163
- if ( doesEntryMatchDefinition ( spanAndAnnotation , definition ) ) {
169
+ if (
170
+ doesEntryMatchDefinition (
171
+ spanAndAnnotation ,
172
+ definition ,
173
+ this . context . input . scope ,
174
+ )
175
+ ) {
164
176
// remove the index of this definition from the list of requiredToEnd
165
177
this . context . requiredToEndIndexChecklist . delete ( i )
166
178
@@ -236,7 +248,11 @@ export class TraceStateMachine<ScopeT extends ScopeBase> {
236
248
for ( const definition of this . context . definition . requiredToEnd ) {
237
249
const { span } = spanAndAnnotation
238
250
if (
239
- doesEntryMatchDefinition ( spanAndAnnotation , definition ) &&
251
+ doesEntryMatchDefinition (
252
+ spanAndAnnotation ,
253
+ definition ,
254
+ this . context . input . scope ,
255
+ ) &&
240
256
definition . isIdle &&
241
257
'isIdle' in span &&
242
258
span . isIdle
@@ -252,7 +268,13 @@ export class TraceStateMachine<ScopeT extends ScopeBase> {
252
268
// does span satisfy any of the "debouncedOn" and if so, restart our debounce timer
253
269
if ( this . context . definition . debounceOn ) {
254
270
for ( const definition of this . context . definition . debounceOn ) {
255
- if ( doesEntryMatchDefinition ( spanAndAnnotation , definition ) ) {
271
+ if (
272
+ doesEntryMatchDefinition (
273
+ spanAndAnnotation ,
274
+ definition ,
275
+ this . context . input . scope ,
276
+ )
277
+ ) {
256
278
// Sometimes spans are processed out of order, we update the lastRelevant if this span ends later
257
279
if (
258
280
spanAndAnnotation . annotation . operationRelativeEndTime >
@@ -367,7 +389,13 @@ export class TraceStateMachine<ScopeT extends ScopeBase> {
367
389
// transition to complete state with the 'matched-on-interrupt' interruptionReason
368
390
if ( this . context . definition . interruptOn ) {
369
391
for ( const definition of this . context . definition . interruptOn ) {
370
- if ( doesEntryMatchDefinition ( spanAndAnnotation , definition ) ) {
392
+ if (
393
+ doesEntryMatchDefinition (
394
+ spanAndAnnotation ,
395
+ definition ,
396
+ this . context . input . scope ,
397
+ )
398
+ ) {
371
399
return {
372
400
transitionToState : 'complete' ,
373
401
interruptionReason : 'matched-on-interrupt' ,
@@ -570,7 +598,11 @@ export class ActiveTrace<ScopeT extends ScopeBase> {
570
598
const matchingRecordedEntries = this . recordedItems . filter (
571
599
( spanAndAnnotation ) =>
572
600
matches . some ( ( matchCriteria ) =>
573
- doesEntryMatchDefinition ( spanAndAnnotation , matchCriteria ) ,
601
+ doesEntryMatchDefinition (
602
+ spanAndAnnotation ,
603
+ matchCriteria ,
604
+ this . input . scope ,
605
+ ) ,
574
606
) ,
575
607
)
576
608
@@ -588,10 +620,14 @@ export class ActiveTrace<ScopeT extends ScopeBase> {
588
620
this . definition . computedSpanDefinitions . forEach ( ( definition ) => {
589
621
const { startSpan, endSpan, name } = definition
590
622
const matchingStartEntry = this . recordedItems . find ( ( spanAndAnnotation ) =>
591
- doesEntryMatchDefinition ( spanAndAnnotation , startSpan ) ,
623
+ doesEntryMatchDefinition (
624
+ spanAndAnnotation ,
625
+ startSpan ,
626
+ this . input . scope ,
627
+ ) ,
592
628
)
593
629
const matchingEndEntry = this . recordedItems . find ( ( spanAndAnnotation ) =>
594
- doesEntryMatchDefinition ( spanAndAnnotation , endSpan ) ,
630
+ doesEntryMatchDefinition ( spanAndAnnotation , endSpan , this . input . scope ) ,
595
631
)
596
632
597
633
if ( matchingStartEntry && matchingEndEntry ) {
0 commit comments