-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(core): Deprecate StartSpanOptions.origin
in favour of passing attribute
#10274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Deprecate StartSpanOptions.origin
in favour of passing attribute
#10274
Conversation
size-limit report 📦
|
261cd89
to
74460e2
Compare
packages/core/src/tracing/span.ts
Outdated
this._attributes = { | ||
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanContext.origin || 'manual', | ||
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op, | ||
...spanContext.attributes, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified the _attributes
setting logic here to handle precedences correctly if origin or op are defined via spanContext.attributes
. In case both, attributes and top level op/origin are defined, attributes take precedence.
packages/core/src/tracing/span.ts
Outdated
// eslint-disable-next-line deprecation/deprecation | ||
this.instrumenter = spanContext.instrumenter || 'sentry'; | ||
|
||
this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanContext.origin || 'manual'); | ||
this._attributes = dropUndefinedKeys({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: IMHO we can just use this.setAttributes()
here, that handles not setting undefined values under the hood anyhow?
packages/core/src/tracing/trace.ts
Outdated
/** | ||
* The origin of the span - if it comes from auto instrumentation or manual instrumentation. | ||
* | ||
* @deprecated Set `attributes['sentry.origin']` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Should we reference the semantic attribute const here instead? Is probably a bit safer..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right, we export them. Sure, will do!
18f1f11
to
30d5ce4
Compare
…attribute partial fix more tests simplify ctor logic dropUndefinedKeys remove stronger typing of `SpanAttributes` review suggestions more replacements fix import
b05313a
to
7bfdf80
Compare
To remove ambiguity and normalization logic in v8, we should only set the origin as an attribute, not as a top level option in the new
startSpan
APIs.