Skip to content

fix(span): Make _performance_issues_spans a top-level field#5870

Draft
jjbayer wants to merge 6 commits intomasterfrom
fix/performance-issues-span
Draft

fix(span): Make _performance_issues_spans a top-level field#5870
jjbayer wants to merge 6 commits intomasterfrom
fix/performance-issues-span

Conversation

@jjbayer
Copy link
Copy Markdown
Member

@jjbayer jjbayer commented Apr 21, 2026

@jjbayer jjbayer requested a review from loewenheim April 21, 2026 14:04
@jjbayer jjbayer marked this pull request as ready for review April 21, 2026 15:13
@jjbayer jjbayer requested a review from a team as a code owner April 21, 2026 15:13
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 03ee6f7. Configure here.

Comment thread CHANGELOG.md Outdated
Consolidate performance issues spans and remove deprecated config.
@loewenheim loewenheim requested a review from Dav1dde April 22, 2026 06:53
skip_serialization = "empty",
trim = false
)]
pub performance_issues_spans: Annotated<bool>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be top level and not an attribute (what it already is)? Can we instead change the consumer code?

I feel like this may set a bad precedent where we start adding things top level.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be. Then we need to define it in conventions and adjust the consuming code accordingly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's using an _internal attribute right now, we decided not to define these in conventions.

That being said, _internal is also not the best option here, but I think it's fine if we tackle this separately (or not at all considering there is a plan to remove it alltogether)

@jjbayer
Copy link
Copy Markdown
Member Author

jjbayer commented Apr 23, 2026

I will check if we can easily make this part of SpanMeta (i.e. extra fields that are injected into the kafka message), then it is no longer part of the protocol.

Comment on lines +55 to +58
/// When the flag is set to true, performance issues will be detected on this span provided it
/// is a root (segment) instead of the transaction event.
///
/// Only set on root spans extracted from transactions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// When the flag is set to true, performance issues will be detected on this span provided it
/// is a root (segment) instead of the transaction event.
///
/// Only set on root spans extracted from transactions.
/// By default, performance issues are detected on transactions. When this flag is
/// `true` and the span is a segment (root) span, detection runs on this span instead — this
/// lets Sentry migrate detection from the legacy transaction-event pipeline to the new
/// standalone-spans (EAP) pipeline without double-reporting issues.
///
/// This flag is only meaningful on segment (root) spans that originated from a transaction event.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found the original phrasing ambiguous, but maybe I just lack context

///
/// Only set on root spans extracted from transactions.
#[metastructure(
field = "_performance_issues_spans",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a top level field be underscored?

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 28, 2026

@jjbayer jjbayer marked this pull request as draft April 28, 2026 08:36
Lift the temporary `_performance_issues_spans` flag out of the SpanV2
protocol body and onto the Kafka envelope (`SpanMeta`). The on-the-wire
JSON key is unchanged because `SpanMeta` and the span body are flattened
into the same object. The legacy V1 path reads the value off `SpanV1`
before conversion and forwards it on `StoreSpanV2`; the native V2 path
hardcodes false (it never sets this flag).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
routing_key,
retention_days: ctx.retention.standard,
downsampled_retention_days: ctx.retention.downsampled,
performance_issues_spans: false,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
performance_issues_spans: false,
performance_issues_spans: false, // only used for legacy spans

Comment on lines +141 to +142
///
/// Travels on the Kafka envelope (`SpanMeta`) rather than the SpanV2 body.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
///
/// Travels on the Kafka envelope (`SpanMeta`) rather than the SpanV2 body.

Comment on lines +1687 to +1688
/// When the flag is set to true, performance issues will be detected on this span provided it
/// is a root (segment) instead of the transaction event.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// When the flag is set to true, performance issues will be detected on this span provided it
/// is a root (segment) instead of the transaction event.
/// When the flag is set to true, performance issues will be detected on this span
/// instead of the transaction event (provided it is a segment span).

was_transaction,
kind,
performance_issues_spans,
performance_issues_spans: _, // moved to SpanMeta on the Kafka envelope
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
performance_issues_spans: _, // moved to SpanMeta on the Kafka envelope
performance_issues_spans: _, // not part of the V2 protocol (but still used by `legacy_spans::store::convert`).

Comment thread CHANGELOG.md
- Retry failing objectstore requests. ([#5836](https://github.com/getsentry/relay/pull/5836))
- Add mobile normalizations to SpanV2 processing pipeline (mobile tag, main thread, outlier filtering, app start backfill from V1 transactions, device class). ([#5824](https://github.com/getsentry/relay/pull/5824))
- Remove the deprecated `aiModelCosts` global config, superseded by `aiModelMetadata`. ([#5862](https://github.com/getsentry/relay/pull/5862))
- Make `_performance_issues_spans` a top-level field. ([#5870](https://github.com/getsentry/relay/pull/5870))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Make `_performance_issues_spans` a top-level field. ([#5870](https://github.com/getsentry/relay/pull/5870))
- Make `_performance_issues_spans` a top-level field on the Kafka message. ([#5870](https://github.com/getsentry/relay/pull/5870))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants