@@ -66,11 +66,6 @@ export class Span implements SpanInterface {
66
66
*/
67
67
public parentSpanId ?: string ;
68
68
69
- /**
70
- * Internal keeper of the status
71
- */
72
- public status ?: SpanStatusType | string ;
73
-
74
69
/**
75
70
* @inheritDoc
76
71
*/
@@ -125,6 +120,8 @@ export class Span implements SpanInterface {
125
120
protected _startTime : number ;
126
121
/** Epoch timestamp in seconds when the span ended. */
127
122
protected _endTime ?: number ;
123
+ /** Internal keeper of the status */
124
+ protected _status ?: SpanStatusType | string ;
128
125
129
126
private _logMessage ?: string ;
130
127
@@ -161,7 +158,7 @@ export class Span implements SpanInterface {
161
158
this . op = spanContext . op ;
162
159
}
163
160
if ( spanContext . status ) {
164
- this . status = spanContext . status ;
161
+ this . _status = spanContext . status ;
165
162
}
166
163
if ( spanContext . endTimestamp ) {
167
164
this . _endTime = spanContext . endTimestamp ;
@@ -299,6 +296,24 @@ export class Span implements SpanInterface {
299
296
this . _endTime = endTime ;
300
297
}
301
298
299
+ /**
300
+ * The status of the span.
301
+ *
302
+ * @deprecated Use `spanToJSON().status` instead to get the status.
303
+ */
304
+ public get status ( ) : SpanStatusType | string | undefined {
305
+ return this . _status ;
306
+ }
307
+
308
+ /**
309
+ * The status of the span.
310
+ *
311
+ * @deprecated Use `.setStatus()` instead to set or update the status.
312
+ */
313
+ public set status ( status : SpanStatusType | string | undefined ) {
314
+ this . _status = status ;
315
+ }
316
+
302
317
/* eslint-enable @typescript-eslint/member-ordering */
303
318
304
319
/** @inheritdoc */
@@ -398,7 +413,7 @@ export class Span implements SpanInterface {
398
413
* @inheritDoc
399
414
*/
400
415
public setStatus ( value : SpanStatusType ) : this {
401
- this . status = value ;
416
+ this . _status = value ;
402
417
return this ;
403
418
}
404
419
@@ -438,7 +453,7 @@ export class Span implements SpanInterface {
438
453
* @inheritDoc
439
454
*/
440
455
public isSuccess ( ) : boolean {
441
- return this . status === 'ok' ;
456
+ return this . _status === 'ok' ;
442
457
}
443
458
444
459
/**
@@ -496,7 +511,7 @@ export class Span implements SpanInterface {
496
511
sampled : this . _sampled ,
497
512
spanId : this . _spanId ,
498
513
startTimestamp : this . _startTime ,
499
- status : this . status ,
514
+ status : this . _status ,
500
515
// eslint-disable-next-line deprecation/deprecation
501
516
tags : this . tags ,
502
517
traceId : this . _traceId ,
@@ -519,7 +534,7 @@ export class Span implements SpanInterface {
519
534
this . _sampled = spanContext . sampled ;
520
535
this . _spanId = spanContext . spanId || this . _spanId ;
521
536
this . _startTime = spanContext . startTimestamp || this . _startTime ;
522
- this . status = spanContext . status ;
537
+ this . _status = spanContext . status ;
523
538
// eslint-disable-next-line deprecation/deprecation
524
539
this . tags = spanContext . tags || { } ;
525
540
this . _traceId = spanContext . traceId || this . _traceId ;
@@ -552,7 +567,7 @@ export class Span implements SpanInterface {
552
567
parent_span_id : this . parentSpanId ,
553
568
span_id : this . _spanId ,
554
569
start_timestamp : this . _startTime ,
555
- status : this . status ,
570
+ status : this . _status ,
556
571
// eslint-disable-next-line deprecation/deprecation
557
572
tags : Object . keys ( this . tags ) . length > 0 ? this . tags : undefined ,
558
573
timestamp : this . _endTime ,
0 commit comments