File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ export class Span implements SpanInterface {
126
126
if ( spanContext . parentSpanId ) {
127
127
this . parentSpanId = spanContext . parentSpanId ;
128
128
}
129
- // We want to include booleans as well here
129
+ // check this way instead of the normal way to make sure we don't miss cases where sampled = false
130
130
if ( 'sampled' in spanContext ) {
131
131
this . sampled = spanContext . sampled ;
132
132
}
@@ -241,11 +241,9 @@ export class Span implements SpanInterface {
241
241
* @inheritDoc
242
242
*/
243
243
public toTraceparent ( ) : string {
244
- let sampledString = '' ;
245
- if ( this . sampled !== undefined ) {
246
- sampledString = this . sampled ? '-1' : '-0' ;
247
- }
248
- return `${ this . traceId } -${ this . spanId } ${ sampledString } ` ;
244
+ logger . warn ( 'Direct use of `span.toTraceparent` is deprecated. Use `span.getTraceHeaders` instead.' ) ;
245
+
246
+ return this . _toSentrytrace ( ) ;
249
247
}
250
248
251
249
/**
Original file line number Diff line number Diff line change @@ -149,8 +149,12 @@ export interface Span extends SpanContext {
149
149
*/
150
150
isSuccess ( ) : boolean ;
151
151
152
- /** Return a traceparent compatible header string */
153
- toTraceparent ( ) : string ;
152
+ /**
153
+ * Return a traceparent-compatible header string
154
+ *
155
+ * @deprecated Do not use `span.toTraceparnt` directly. Use `span.getTraceHeaders` instead.
156
+ */
157
+ toTraceparent ( ) : string ; // TODO (kmclb) make this private
154
158
155
159
/** Returns the current span properties as a `SpanContext` */
156
160
toContext ( ) : SpanContext ;
You can’t perform that action at this time.
0 commit comments