@@ -47,6 +47,11 @@ export class CoreTracer extends CoreTracerBase implements types.Tracer {
4747
4848 /** Sets the current root span. */
4949 set currentRootSpan ( root : types . Span ) {
50+ this . setCurrentRootSpan ( root ) ;
51+ }
52+
53+ /** Sets the current root span. */
54+ setCurrentRootSpan ( root : types . Span ) {
5055 if ( this . contextManager . active ) {
5156 this . contextManager . set ( 'rootspan' , root ) ;
5257 }
@@ -62,7 +67,6 @@ export class CoreTracer extends CoreTracerBase implements types.Tracer {
6267 const self = this ;
6368 return self . contextManager . runAndReturn ( ( ) => {
6469 return super . startRootSpan ( options , ( root ) => {
65- self . currentRootSpan = root ;
6670 return fn ( root ) ;
6771 } ) ;
6872 } ) ;
@@ -74,7 +78,8 @@ export class CoreTracer extends CoreTracerBase implements types.Tracer {
7478 if ( ! root ) {
7579 return this . logger . debug ( 'cannot start trace - no active trace found' ) ;
7680 }
77- if ( this . currentRootSpan !== root ) {
81+ if ( ! this . currentRootSpan ||
82+ this . currentRootSpan . traceId !== root . traceId ) {
7883 this . logger . debug (
7984 'currentRootSpan != root on notifyStart. Need more investigation.' ) ;
8085 }
@@ -88,7 +93,8 @@ export class CoreTracer extends CoreTracerBase implements types.Tracer {
8893 this . logger . debug ( 'cannot end trace - no active trace found' ) ;
8994 return ;
9095 }
91- if ( this . currentRootSpan !== root ) {
96+ if ( ! this . currentRootSpan ||
97+ this . currentRootSpan . traceId !== root . traceId ) {
9298 this . logger . debug (
9399 'currentRootSpan != root on notifyEnd. Need more investigation.' ) ;
94100 }
0 commit comments