Skip to content
Prev Previous commit
Next Next commit
let orphan spans get tracestate headers also
  • Loading branch information
lobsterkatie committed Feb 17, 2021
commit 628d33ab516a9d36ba6d487afd21a851349ba1c0
7 changes: 6 additions & 1 deletion packages/tracing/src/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ export class Span implements SpanInterface {
*/
public getTraceHeaders(): TraceHeaders {
// tracestates live on the transaction, so if this is a free-floating span, there won't be one
const tracestate = this.transaction && `sentry=${this.transaction.metadata?.tracestate?.sentry}`;
let tracestate;
if (this.transaction) {
tracestate = this.transaction.metadata?.tracestate?.sentry;
} else {
tracestate = this._getNewTracestate();
}

return {
'sentry-trace': this.toTraceparent(),
Expand Down