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 {
77 protected resolveWaitChunksP : ( ( ) => void ) | undefined ;
88 protected ended : boolean = false ;
99 protected idGen = new IdSortable ( ) ;
10+ protected shouldTrace = false ;
1011
1112 protected nextId ( ) : SpanId {
1213 const result = this . idGen . next ( ) ;
@@ -16,7 +17,8 @@ class Tracer {
1617 return result . value . toMultibase ( 'base32hex' ) as SpanId ;
1718 }
1819
19- protected queueSpanEvent ( evt : SpanEvent ) {
20+ protected queueSpanEvent ( evt : SpanEvent ) : void {
21+ if ( ! this . shouldTrace ) return ;
2022 this . queue . push ( evt ) ;
2123 if ( this . resolveWaitChunksP != null ) this . resolveWaitChunksP ( ) ;
2224 }
@@ -75,6 +77,13 @@ class Tracer {
7577 yield value ;
7678 }
7779 }
80+
81+ public disableTracing ( ) : void {
82+ this . shouldTrace = false ;
83+ this . ended = true ;
84+ this . resolveWaitChunksP ?.( ) ;
85+ this . queue = [ ] ;
86+ }
7887}
7988
8089export default Tracer ;
You can’t perform that action at this time.
0 commit comments