Skip to content

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

Draft
loewenheim wants to merge 6 commits intomasterfrom
sebastian/spanv2-performance
Draft

feat(eap): Calculate performance scores for V2 spans#5947
loewenheim wants to merge 6 commits intomasterfrom
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

measurements.insert(
measurements.insert_measurement(
format!("score.ratio.{}", component.measurement),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here we would ideally use something more principled than just stitching an attribute together manually. See #5940 for a potential solution.

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.

That's quite nice!

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.


measurements.insert(
measurements.insert_measurement(
format!("score.ratio.{}", component.measurement),
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.

That's quite nice!

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.

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.

2 participants