Skip to content

Commit bc88ec4

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 0276c03 commit bc88ec4

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
@@ -139,9 +139,9 @@ export class Span implements SpanInterface {
139139
this._traceId = spanContext.traceId || uuid4();
140140
this._spanId = spanContext.spanId || uuid4().substring(16);
141141
this.startTimestamp = spanContext.startTimestamp || timestampInSeconds();
142-
this.tags = spanContext.tags || {};
143-
this.data = spanContext.data || {};
144-
this.attributes = spanContext.attributes || {};
142+
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
143+
this.data = spanContext.data ? { ...spanContext.data } : {};
144+
this.attributes = spanContext.attributes ? { ...spanContext.attributes } : {};
145145
this.instrumenter = spanContext.instrumenter || 'sentry';
146146
this.origin = spanContext.origin || 'manual';
147147
// eslint-disable-next-line deprecation/deprecation

0 commit comments

Comments
 (0)