Skip to content

feat(eap): Calculate performance scores for V2 spans#5947

Merged
loewenheim merged 15 commits into
masterfrom
sebastian/spanv2-performance
May 11, 2026
Merged

feat(eap): Calculate performance scores for V2 spans#5947
loewenheim merged 15 commits into
masterfrom
sebastian/spanv2-performance

Conversation

@loewenheim
Copy link
Copy Markdown
Contributor

@loewenheim loewenheim commented May 6, 2026

This slightly generalizes normalize_performance_score so it can be applied to V2 spans (essentially all that needs to be done is to make it access Attributes in addition to Measurements).

As the included tests demonstrate, this works seamlessly, with the minor wrinkle that the conditions for performance profiles need to be adjusted so that they match the browser name in either event.context.browser.name (the status quo, for legacy events/spans) or span.attributes.browser.name.value (for V2 spans). This should be simple enough to do in Sentry and is, in my opinion, vastly preferable to creating a compatibility shim in Relay itself.

TODO:

  • Define the attributes we insert during the calculation. See INGEST-896.

ref: INGEST-844.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 6, 2026

@loewenheim loewenheim self-assigned this May 6, 2026
Comment thread relay-event-normalization/src/event.rs
Comment thread relay-event-normalization/src/event.rs Outdated
Copy link
Copy Markdown
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

Didn't think it would fit that easily, nice.

For:

ctx.project_info.config().performance_score.as_ref(),

I had this comment which github doesn't let me save:

I did move a bunch of these to the top and gave it names, so all the normalize calls are on a single line. I liked the readability.

Comment thread relay-event-normalization/src/event.rs Outdated
Comment thread relay-event-normalization/src/event.rs
@Dav1dde
Copy link
Copy Markdown
Member

Dav1dde commented May 6, 2026

@loewenheim for tests, it would be great if you could update the test_spans_standalone.py tests with actual performance score.

@loewenheim
Copy link
Copy Markdown
Contributor Author

@loewenheim for tests, it would be great if you could update the test_spans_standalone.py tests with actual performance score.

Sure, will do.

Copy link
Copy Markdown
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

Nice!

@loewenheim loewenheim force-pushed the sebastian/spanv2-performance branch from 08b56a2 to 0da1d67 Compare May 8, 2026 14:11
@loewenheim loewenheim marked this pull request as ready for review May 8, 2026 16:51
@loewenheim loewenheim requested a review from a team as a code owner May 8, 2026 16:51
@loewenheim loewenheim requested review from Dav1dde and jjbayer May 8, 2026 16:52
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 9a7a7bf. Configure here.

Comment thread relay-event-normalization/src/event.rs
Comment thread relay-event-normalization/src/event.rs
@loewenheim loewenheim added this pull request to the merge queue May 11, 2026
loewenheim added a commit to getsentry/sentry that referenced this pull request May 11, 2026
This makes performance profiles able to also match V2 spans by turning
the browser name conditions into disjunctions checking two different
fields.

This is required to enable performance score calculation for V2 spans.

This is a companion PR to getsentry/relay#5947.
That PR contains some test cases showing that profiles with these
expanded conditions work for V2 spans.

Closes INGEST-895.
Merged via the queue into master with commit 93d69d8 May 11, 2026
30 checks passed
@loewenheim loewenheim deleted the sebastian/spanv2-performance branch May 11, 2026 07:52
dashed pushed a commit to getsentry/sentry that referenced this pull request May 11, 2026
This makes performance profiles able to also match V2 spans by turning
the browser name conditions into disjunctions checking two different
fields.

This is required to enable performance score calculation for V2 spans.

This is a companion PR to getsentry/relay#5947.
That PR contains some test cases showing that profiles with these
expanded conditions work for V2 spans.

Closes INGEST-895.
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.

3 participants