File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class Tracer {
7
7
protected resolveWaitChunksP : ( ( ) => void ) | undefined ;
8
8
protected ended : boolean = false ;
9
9
protected idGen = new IdSortable ( ) ;
10
+ protected shouldTrace = false ;
10
11
11
12
protected nextId ( ) : SpanId {
12
13
const result = this . idGen . next ( ) ;
@@ -16,7 +17,8 @@ class Tracer {
16
17
return result . value . toMultibase ( 'base32hex' ) as SpanId ;
17
18
}
18
19
19
- protected queueSpanEvent ( evt : SpanEvent ) {
20
+ protected queueSpanEvent ( evt : SpanEvent ) : void {
21
+ if ( ! this . shouldTrace ) return ;
20
22
this . queue . push ( evt ) ;
21
23
if ( this . resolveWaitChunksP != null ) this . resolveWaitChunksP ( ) ;
22
24
}
@@ -75,6 +77,13 @@ class Tracer {
75
77
yield value ;
76
78
}
77
79
}
80
+
81
+ public disableTracing ( ) : void {
82
+ this . shouldTrace = false ;
83
+ this . ended = true ;
84
+ this . resolveWaitChunksP ?.( ) ;
85
+ this . queue = [ ] ;
86
+ }
78
87
}
79
88
80
89
export default Tracer ;
You can’t perform that action at this time.
0 commit comments