1414 * limitations under the License.
1515 */
1616
17+ import { Logger } from '../../common/types' ;
1718import { Clock } from '../../internal/clock' ;
1819import { debug , randomSpanId } from '../../internal/util' ;
19- import { Sampler } from '../sampler/types' ;
20-
21- import { Annotation , Attributes , Link , MessageEvent , Span , TraceContext } from './types' ;
22- import { Logger } from '../../common/types' ;
20+ import * as types from './types' ;
2321
2422/** Defines a base model for spans. */
25- export abstract class SpanBaseModel implements Span {
23+ export abstract class SpanBaseModel implements types . Span {
2624 protected className : string ;
2725 /** The clock used to mesure the beginning and ending of a span */
2826 private clock : Clock = null ;
@@ -37,13 +35,13 @@ export abstract class SpanBaseModel implements Span {
3735 /** An object to log information to */
3836 logger : Logger ;
3937 /** A set of attributes, each in the format [KEY]:[VALUE] */
40- attributes : Attributes = { } ;
38+ attributes : types . Attributes = { } ;
4139 /** A text annotation with a set of attributes. */
42- annotations : Annotation [ ] = [ ] ;
40+ annotations : types . Annotation [ ] = [ ] ;
4341 /** An event describing a message sent/received between Spans */
44- messageEvents : MessageEvent [ ] = [ ] ;
42+ messageEvents : types . MessageEvent [ ] = [ ] ;
4543 /** Pointers from the current span to another span */
46- links : Link [ ] = [ ] ;
44+ links : types . Link [ ] = [ ] ;
4745 /** If the parent span is in another process. */
4846 remoteParent : boolean ;
4947 /** The span ID of this span's parent. If it's a root span, must be empty */
@@ -115,12 +113,12 @@ export abstract class SpanBaseModel implements Span {
115113 }
116114
117115 /** Gives the TraceContext of the span. */
118- get traceContext ( ) : TraceContext {
116+ get traceContext ( ) : types . TraceContext {
119117 return {
120118 traceId : this . traceId . toString ( ) ,
121119 spanId : this . id . toString ( ) ,
122120 parentSpanId : this . parentSpanId
123- } as TraceContext ;
121+ } as types . TraceContext ;
124122 }
125123
126124 /**
@@ -139,12 +137,12 @@ export abstract class SpanBaseModel implements Span {
139137 * @param attributes A set of attributes on the annotation.
140138 */
141139 addAnnotation (
142- description : string , timestamp : number , attributes ?: Attributes ) {
140+ description : string , timestamp : number , attributes ?: types . Attributes ) {
143141 this . annotations . push ( {
144142 'description' : description ,
145143 'timestamp' : timestamp ,
146144 'attributes' : attributes ,
147- } as Annotation ) ;
145+ } as types . Annotation ) ;
148146 }
149147
150148 /**
@@ -155,13 +153,13 @@ export abstract class SpanBaseModel implements Span {
155153 * @param attributes A set of attributes on the link.
156154 */
157155 addLink (
158- traceId : string , spanId : string , type : string , attributes ?: Attributes ) {
156+ traceId : string , spanId : string , type : string , attributes ?: types . Attributes ) {
159157 this . links . push ( {
160158 'traceId' : traceId ,
161159 'spanId' : spanId ,
162160 'type' : type ,
163161 'attributes' : attributes
164- } as Link ) ;
162+ } as types . Link ) ;
165163 }
166164
167165 /**
@@ -173,7 +171,7 @@ export abstract class SpanBaseModel implements Span {
173171 this . messageEvents . push ( {
174172 'type' : type ,
175173 'id' : id ,
176- } as MessageEvent ) ;
174+ } as types . MessageEvent ) ;
177175 }
178176
179177 /** Starts the span. */
0 commit comments