@@ -359,13 +359,13 @@ export class Span implements SpanInterface, SpanContext {
359
359
*/
360
360
public getTraceContext ( ) : object {
361
361
return dropUndefinedKeys ( {
362
- data : this . data ,
362
+ data : Object . keys ( this . data ) . length > 0 ? this . data : undefined ,
363
363
description : this . description ,
364
364
op : this . op ,
365
365
parent_span_id : this . _parentSpanId ,
366
366
span_id : this . _spanId ,
367
367
status : this . tags . status ,
368
- tags : this . tags ,
368
+ tags : Object . keys ( this . tags ) . length > 0 ? this . tags : undefined ,
369
369
trace_id : this . _traceId ,
370
370
} ) ;
371
371
}
@@ -375,14 +375,14 @@ export class Span implements SpanInterface, SpanContext {
375
375
*/
376
376
public toJSON ( ) : object {
377
377
return dropUndefinedKeys ( {
378
- data : this . data ,
378
+ data : Object . keys ( this . data ) . length > 0 ? this . data : undefined ,
379
379
description : this . description ,
380
380
op : this . op ,
381
381
parent_span_id : this . _parentSpanId ,
382
382
sampled : this . sampled ,
383
383
span_id : this . _spanId ,
384
384
start_timestamp : this . startTimestamp ,
385
- tags : this . tags ,
385
+ tags : Object . keys ( this . tags ) . length > 0 ? this . tags : undefined ,
386
386
timestamp : this . timestamp ,
387
387
trace_id : this . _traceId ,
388
388
transaction : this . transaction ,
0 commit comments