Skip to content

Commit 48c6f29

Browse files
committed
rename variable, propagate transaction property
1 parent 27c51c4 commit 48c6f29

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/tracing/src/span.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,21 @@ export class Span implements SpanInterface, SpanContext {
166166
public startChild(
167167
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId'>>,
168168
): Span {
169-
const span = new Span({
169+
const childSpan = new Span({
170170
...spanContext,
171171
parentSpanId: this.spanId,
172172
sampled: this.sampled,
173173
traceId: this.traceId,
174174
});
175175

176-
span.spanRecorder = this.spanRecorder;
177-
if (span.spanRecorder) {
178-
span.spanRecorder.add(span);
176+
childSpan.spanRecorder = this.spanRecorder;
177+
if (childSpan.spanRecorder) {
178+
childSpan.spanRecorder.add(childSpan);
179179
}
180180

181-
return span;
181+
childSpan.transaction = this.transaction;
182+
183+
return childSpan;
182184
}
183185

184186
/**

0 commit comments

Comments
 (0)