@@ -224,17 +224,14 @@ export class Span implements types.Span {
224224 * @param timestamp A time, in milliseconds. Defaults to Date.now()
225225 */
226226 addAnnotation (
227- description : string , attributes ?: types . Attributes , timestamp = 0 ) {
227+ description : string , attributes : types . Attributes = { } ,
228+ timestamp = Date . now ( ) ) {
228229 if ( this . annotations . length >=
229230 this . activeTraceParams . numberOfAnnontationEventsPerSpan ! ) {
230231 this . annotations . shift ( ) ;
231232 this . droppedAnnotationsCount ++ ;
232233 }
233- this . annotations . push ( {
234- 'description' : description ,
235- 'attributes' : attributes || { } ,
236- 'timestamp' : timestamp ? timestamp : Date . now ( ) ,
237- } as types . Annotation ) ;
234+ this . annotations . push ( { description, attributes, timestamp} ) ;
238235 }
239236
240237 /**
@@ -246,18 +243,13 @@ export class Span implements types.Span {
246243 */
247244 addLink (
248245 traceId : string , spanId : string , type : types . LinkType ,
249- attributes ? : types . Attributes ) {
246+ attributes : types . Attributes = { } ) {
250247 if ( this . links . length >= this . activeTraceParams . numberOfLinksPerSpan ! ) {
251248 this . links . shift ( ) ;
252249 this . droppedLinksCount ++ ;
253250 }
254251
255- this . links . push ( {
256- 'traceId' : traceId ,
257- 'spanId' : spanId ,
258- 'type' : type ,
259- 'attributes' : attributes || { }
260- } as types . Link ) ;
252+ this . links . push ( { traceId, spanId, type, attributes} ) ;
261253 }
262254
263255 /**
@@ -270,7 +262,7 @@ export class Span implements types.Span {
270262 * zero or undefined, assumed to be the same size as uncompressed.
271263 */
272264 addMessageEvent (
273- type : types . MessageEventType , id : number , timestamp = 0 ,
265+ type : types . MessageEventType , id : number , timestamp = Date . now ( ) ,
274266 uncompressedSize ?: number , compressedSize ?: number ) {
275267 if ( this . messageEvents . length >=
276268 this . activeTraceParams . numberOfMessageEventsPerSpan ! ) {
@@ -281,10 +273,10 @@ export class Span implements types.Span {
281273 this . messageEvents . push ( {
282274 type,
283275 id,
284- timestamp : timestamp ? timestamp : Date . now ( ) ,
276+ timestamp,
285277 uncompressedSize,
286278 compressedSize,
287- } as types . MessageEvent ) ;
279+ } ) ;
288280 }
289281
290282 /**
0 commit comments