Skip to content

Commit 6781325

Browse files
committed
fix(core): Ensure we copy passed in span data/tags/attributes
So we do not mutate this if we update data there.
1 parent d305c8d commit 6781325

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/tracing/span.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ export class Span implements SpanInterface {
137137
this._traceId = spanContext.traceId || uuid4();
138138
this._spanId = spanContext.spanId || uuid4().substring(16);
139139
this.startTimestamp = spanContext.startTimestamp || timestampInSeconds();
140-
this.tags = spanContext.tags || {};
141-
this.data = spanContext.data || {};
142-
this.attributes = spanContext.attributes || {};
140+
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
141+
this.data = spanContext.data ? { ...spanContext.data } : {};
142+
this.attributes = spanContext.attributes ? { ...spanContext.attributes } : {};
143143
this.instrumenter = spanContext.instrumenter || 'sentry';
144144
this.origin = spanContext.origin || 'manual';
145145
// eslint-disable-next-line deprecation/deprecation

0 commit comments

Comments
 (0)