@@ -67,11 +67,6 @@ export class Span implements SpanInterface {
67
67
*/
68
68
public parentSpanId ?: string ;
69
69
70
- /**
71
- * Internal keeper of the status
72
- */
73
- public status ?: SpanStatusType | string ;
74
-
75
70
/**
76
71
* @inheritDoc
77
72
*/
@@ -128,6 +123,8 @@ export class Span implements SpanInterface {
128
123
protected _startTime : number ;
129
124
/** Epoch timestamp in seconds when the span ended. */
130
125
protected _endTime ?: number ;
126
+ /** Internal keeper of the status */
127
+ protected _status ?: SpanStatusType | string ;
131
128
132
129
private _logMessage ?: string ;
133
130
@@ -164,7 +161,7 @@ export class Span implements SpanInterface {
164
161
this . op = spanContext . op ;
165
162
}
166
163
if ( spanContext . status ) {
167
- this . status = spanContext . status ;
164
+ this . _status = spanContext . status ;
168
165
}
169
166
if ( spanContext . endTimestamp ) {
170
167
this . _endTime = spanContext . endTimestamp ;
@@ -302,6 +299,24 @@ export class Span implements SpanInterface {
302
299
this . _endTime = endTime ;
303
300
}
304
301
302
+ /**
303
+ * The status of the span.
304
+ *
305
+ * @deprecated Use `spanToJSON().status` instead to get the status.
306
+ */
307
+ public get status ( ) : SpanStatusType | string | undefined {
308
+ return this . _status ;
309
+ }
310
+
311
+ /**
312
+ * The status of the span.
313
+ *
314
+ * @deprecated Use `.setStatus()` instead to set or update the status.
315
+ */
316
+ public set status ( status : SpanStatusType | string | undefined ) {
317
+ this . _status = status ;
318
+ }
319
+
305
320
/* eslint-enable @typescript-eslint/member-ordering */
306
321
307
322
/** @inheritdoc */
@@ -404,7 +419,7 @@ export class Span implements SpanInterface {
404
419
* @inheritDoc
405
420
*/
406
421
public setStatus ( value : SpanStatusType ) : this {
407
- this . status = value ;
422
+ this . _status = value ;
408
423
return this ;
409
424
}
410
425
@@ -444,7 +459,7 @@ export class Span implements SpanInterface {
444
459
* @inheritDoc
445
460
*/
446
461
public isSuccess ( ) : boolean {
447
- return this . status === 'ok' ;
462
+ return this . _status === 'ok' ;
448
463
}
449
464
450
465
/**
@@ -502,7 +517,7 @@ export class Span implements SpanInterface {
502
517
sampled : this . _sampled ,
503
518
spanId : this . _spanId ,
504
519
startTimestamp : this . _startTime ,
505
- status : this . status ,
520
+ status : this . _status ,
506
521
// eslint-disable-next-line deprecation/deprecation
507
522
tags : this . tags ,
508
523
traceId : this . _traceId ,
@@ -525,7 +540,7 @@ export class Span implements SpanInterface {
525
540
this . _sampled = spanContext . sampled ;
526
541
this . _spanId = spanContext . spanId || this . _spanId ;
527
542
this . _startTime = spanContext . startTimestamp || this . _startTime ;
528
- this . status = spanContext . status ;
543
+ this . _status = spanContext . status ;
529
544
// eslint-disable-next-line deprecation/deprecation
530
545
this . tags = spanContext . tags || { } ;
531
546
this . _traceId = spanContext . traceId || this . _traceId ;
@@ -558,7 +573,7 @@ export class Span implements SpanInterface {
558
573
parent_span_id : this . parentSpanId ,
559
574
span_id : this . _spanId ,
560
575
start_timestamp : this . _startTime ,
561
- status : this . status ,
576
+ status : this . _status ,
562
577
// eslint-disable-next-line deprecation/deprecation
563
578
tags : Object . keys ( this . tags ) . length > 0 ? this . tags : undefined ,
564
579
timestamp : this . _endTime ,
0 commit comments