@@ -50,7 +50,6 @@ export class Tracing implements types.Tracing {
5050 return this . singletonInstance || ( this . singletonInstance = new this ( ) ) ;
5151 }
5252
53- // TODO: tracing interface should be updated
5453 /** Gets active status */
5554 get active ( ) : boolean {
5655 return this . activeLocal ;
@@ -62,9 +61,9 @@ export class Tracing implements types.Tracing {
6261 }
6362
6463 /**
65- * Starts the tracing.
66- * @param userConfig A configuration object to start the tracing.
67- * @returns The started tracing .
64+ * Starts tracing.
65+ * @param userConfig A configuration object to start tracing.
66+ * @returns The started Tracing instance .
6867 */
6968 start ( userConfig ?: types . Config ) : types . Tracing {
7069 this . configLocal = extend (
@@ -96,7 +95,6 @@ export class Tracing implements types.Tracing {
9695 this . pluginLoader . unloadPlugins ( ) ;
9796 this . configLocal = null ;
9897 this . logger = null ;
99- // TODO: maybe some exporter logic when stop tracing
10098 }
10199
102100
@@ -108,37 +106,30 @@ export class Tracing implements types.Tracing {
108106
109107 /**
110108 * Registers an exporter to send the collected traces to.
111- * @param exporter THe exporter to send the traces to.
109+ * @param exporter The exporter to send the traces to.
112110 */
113111 registerExporter ( exporter : types . Exporter ) : types . Tracing {
114112 if ( exporter ) {
115113 if ( this . configLocal . exporter ) {
116- this . unRegisterExporter ( this . configLocal . exporter ) ;
114+ this . unregisterExporter ( this . configLocal . exporter ) ;
117115 }
118116 this . configLocal . exporter = exporter ;
119117 this . tracer . registerSpanEventListener ( exporter ) ;
120118 } else {
121- // TODO: if unRegisterExporter go public, this logic may not be
122- // necessary - register a null to unRegister
123119 if ( this . configLocal . exporter ) {
124- this . unRegisterExporter ( this . configLocal . exporter ) ;
120+ this . unregisterExporter ( this . configLocal . exporter ) ;
125121 }
126122 }
127123 return this ;
128124 }
129125
130126
131127 /**
132- * Registers an exporter to send the collected traces to .
133- * @param exporter THe exporter to send the traces to.
128+ * Unregisters an exporter.
129+ * @param exporter The exporter to stop sending traces to.
134130 */
135- // TODO: maybe this method should be added to Tracing interface
136- private unRegisterExporter ( exporter : types . Exporter ) : types . Tracing {
137- // TODO: maybe an unRegisterEndSpanListener method should be added to Tracer
138- const index = this . tracer . eventListeners . indexOf ( exporter , 0 ) ;
139- if ( index > - 1 ) {
140- this . tracer . eventListeners . splice ( index , 1 ) ;
141- }
131+ unregisterExporter ( exporter : types . Exporter ) : types . Tracing {
132+ this . tracer . unregisterSpanEventListener ( exporter ) ;
142133 this . configLocal . exporter = null ;
143134 return this ;
144135 }
0 commit comments