@@ -38,20 +38,30 @@ export class Span implements SpanInterface, SpanProps {
38
38
public timestamp ?: number ;
39
39
40
40
/**
41
- * Set the transaction of the Span.
41
+ * Transaction of the Span.
42
42
*/
43
43
public transaction ?: string ;
44
44
45
45
/**
46
- * Set the operation of the Span.
46
+ * Operation of the Span.
47
47
*/
48
48
public op ?: string ;
49
49
50
50
/**
51
- * Set the description of the Span.
51
+ * Description of the Span.
52
52
*/
53
53
public description ?: string ;
54
54
55
+ /**
56
+ * Tags of the Span.
57
+ */
58
+ public tags ?: { [ key : string ] : string } ;
59
+
60
+ /**
61
+ * Data of the Span.
62
+ */
63
+ public data ?: { [ key : string ] : any } ;
64
+
55
65
/**
56
66
* List of spans that were finalized
57
67
*/
@@ -83,13 +93,19 @@ export class Span implements SpanInterface, SpanProps {
83
93
if ( spanProps . description ) {
84
94
this . description = spanProps . description ;
85
95
}
96
+ if ( spanProps . data ) {
97
+ this . data = spanProps . data ;
98
+ }
99
+ if ( spanProps . tags ) {
100
+ this . tags = spanProps . tags ;
101
+ }
86
102
}
87
103
88
104
/** JSDoc */
89
105
public newSpan ( spanProps ?: Pick < SpanProps , Exclude < keyof SpanProps , 'spanId' > > ) : Span {
90
106
const span = new Span ( {
91
107
...spanProps ,
92
- parentSpanId : this . _parentSpanId ,
108
+ parentSpanId : this . _spanId ,
93
109
sampled : this . sampled ,
94
110
traceId : this . _traceId ,
95
111
} ) ;
@@ -140,10 +156,12 @@ export class Span implements SpanInterface, SpanProps {
140
156
*/
141
157
public getTraceContext ( ) : object {
142
158
return {
159
+ data : this . data ,
143
160
description : this . description ,
144
161
op : this . op ,
145
162
parent_span_id : this . _parentSpanId ,
146
163
span_id : this . _spanId ,
164
+ tags : this . tags ,
147
165
trace_id : this . _traceId ,
148
166
} ;
149
167
}
@@ -153,12 +171,14 @@ export class Span implements SpanInterface, SpanProps {
153
171
*/
154
172
public toJSON ( ) : object {
155
173
return {
174
+ data : this . data ,
156
175
description : this . description ,
157
176
op : this . op ,
158
177
parent_span_id : this . _parentSpanId ,
159
178
sampled : this . sampled ,
160
179
span_id : this . _spanId ,
161
180
start_timestamp : this . startTimestamp ,
181
+ tags : this . tags ,
162
182
timestamp : this . timestamp ,
163
183
trace_id : this . _traceId ,
164
184
transaction : this . transaction ,
0 commit comments