Skip to content

Commit 6f4ea02

Browse files
committed
simplify ctor logic
1 parent 74460e2 commit 6f4ea02

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

packages/core/src/tracing/span.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ export class Span implements SpanInterface {
130130
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
131131
// eslint-disable-next-line deprecation/deprecation
132132
this.data = spanContext.data ? { ...spanContext.data } : {};
133-
this._attributes = spanContext.attributes ? { ...spanContext.attributes } : {};
134133
// eslint-disable-next-line deprecation/deprecation
135134
this.instrumenter = spanContext.instrumenter || 'sentry';
136135

137-
this.setAttribute(
138-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
139-
spanContext.origin || this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] || 'manual',
140-
);
136+
this._attributes = {
137+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanContext.origin || 'manual',
138+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op,
139+
...spanContext.attributes,
140+
};
141141

142142
// eslint-disable-next-line deprecation/deprecation
143143
this._name = spanContext.name || spanContext.description;
@@ -149,9 +149,6 @@ export class Span implements SpanInterface {
149149
if ('sampled' in spanContext) {
150150
this._sampled = spanContext.sampled;
151151
}
152-
if (spanContext.op) {
153-
this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, spanContext.op);
154-
}
155152
if (spanContext.status) {
156153
this._status = spanContext.status;
157154
}

packages/core/src/tracing/trace.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,5 @@ function normalizeContext(context: StartSpanOptions): TransactionContext {
391391
return ctx;
392392
}
393393

394-
// TODO (v8): Remove this normalization once we remove top-level context.origin
395-
// eslint-disable-next-line deprecation/deprecation
396-
if (context.origin) {
397-
context.attributes = {
398-
// eslint-disable-next-line deprecation/deprecation
399-
'sentry.origin': context.origin,
400-
...context.attributes, // potentially set attributes value takes precedence
401-
};
402-
// eslint-disable-next-line deprecation/deprecation
403-
delete context.origin;
404-
}
405-
406394
return context;
407395
}

0 commit comments

Comments
 (0)