-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(core): Deprecate op and forceTransaction options in StartSpanOptions
#23819
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,19 @@ export interface StartSpanOptions { | |
| /** If set to true, only start a span if a parent span exists. */ | ||
| onlyIfParent?: boolean; | ||
|
|
||
| /** An op for the span. This is a categorization for spans. */ | ||
| /** | ||
| * An op for the span. This is a categorization for spans. | ||
| * | ||
| * @deprecated This option will be removed in a future version of the SDK. Set the `sentry.op` attribute instead. | ||
| * If both are set, the attribute takes precedence. | ||
| * | ||
| * @example | ||
| * ```js | ||
| * Sentry.startSpan({ name: 'my-span', attributes: { 'sentry.op': 'my.op' } }, () => { | ||
| * // ... | ||
| * }); | ||
| * ``` | ||
| */ | ||
| op?: string; | ||
|
|
||
| /** | ||
|
|
@@ -39,6 +51,32 @@ export interface StartSpanOptions { | |
| * If set to true, this span will be forced to be treated as a transaction in the Sentry UI, if possible and applicable. | ||
| * Note that it is up to the SDK to decide how exactly the span will be sent, which may change in future SDK versions. | ||
| * It is not guaranteed that a span started with this flag set to `true` will be sent as a transaction. | ||
| * | ||
| * @deprecated This option will be removed in the next major version of the SDK. There is no longer a concrete use | ||
| * case for it: all spans are indexed and searchable in Sentry, so a span no longer needs to be a transaction to be | ||
| * queried, filtered or aggregated on. In most cases, simply drop the option. The span is still sent, just as a child | ||
| * of its parent span, if a parent span is active. | ||
| * If you do need the span to be a segment (root) span, follow the examples below:. | ||
| * | ||
| * @example Making a span a root span: | ||
| * ```js | ||
| * Sentry.withActiveSpan(null, () => { | ||
| * Sentry.startSpan({ name: 'span-that-should-be-a-root' }, () => { | ||
| * // ... | ||
| * }); | ||
| * }); | ||
| * ``` | ||
| * | ||
| * @example Keeping the root span attached to a specific trace: | ||
| * ```js | ||
| * Sentry.continueTrace({ sentryTrace, baggage }, () => | ||
| * Sentry.withActiveSpan(null, () => | ||
| * Sentry.startSpan({ name: 'span-that-should-be-a-root' }, () => { | ||
| * // ... | ||
| * }), | ||
| * ), | ||
| * ); | ||
| * ``` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feat PR lacks integration testsLow Severity Flagged because the review rules require feat PRs to include at least one integration or E2E test. This change deprecates Triggered by project rule: PR Review Guidelines for Cursor Bot Reviewed by Cursor Bugbot for commit 2fa39b2. Configure here. |
||
| */ | ||
| forceTransaction?: boolean; | ||
|
|
||
|
|
||


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.
Bug: If a
beforeStartSpancallback returns an options object without theopfield, the span's operation (SENTRY_OP) attribute is incorrectly deleted, breaking UI categorization.Severity: HIGH
Suggested Fix
Modify the condition to ensure
finalStartSpanOptions.opis defined before comparing it tooriginalOp. For example:if (finalStartSpanOptions.op !== undefined && finalStartSpanOptions.op !== originalOp).Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.