Skip to content

feat(attributes): Add calculated performance scores#355

Merged
loewenheim merged 4 commits into
mainfrom
sebastian/web-vital-attributes
May 8, 2026
Merged

feat(attributes): Add calculated performance scores#355
loewenheim merged 4 commits into
mainfrom
sebastian/web-vital-attributes

Conversation

@loewenheim
Copy link
Copy Markdown
Contributor

Description

This adds attributes for the results of performance score calculation in Relay, cf. https://github.com/getsentry/relay/blob/4b2a15909edaec2b95bd623d15923abbadb18b19/relay-event-normalization/src/event.rs#L869. The added attributes are exactly the measurements that Relay inserts in that function.

The reason to do this is that for V2 spans we use attributes to store the measurements, and we want every attribute that Relay writes to be defined here.

I hope my descriptions of these attributes make some sense. Please feel free to suggest improvements.

Closes INGEST-896.

PR Checklist

  • I have run yarn test and verified that the tests pass.
  • I have run yarn generate to generate and format code and docs.

If an attribute was added:

  • The attribute is in a namespace (e.g. nextjs.function_id, not function_id)
  • I have used the correct value for pii (i.e. maybe or true. Use false only for values that should never be scrubbed such as IDs)

@loewenheim loewenheim requested review from a team, Lms24, cleptric, mjq and nsdeschenes as code owners May 8, 2026 13:04
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 8, 2026

INGEST-896

@loewenheim loewenheim self-assigned this May 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Add calculated performance scores by loewenheim in #355
  • Add rpc.response.status_code attribute by alexander-alderman-webb in #352
  • Add rpc.method attribute by alexander-alderman-webb in #351
  • Add app vitals start attributes by buenaflor in #353
  • Add process.runtime.engine.* attributes by chargome in #347

Bug Fixes 🐛

  • (attributes) Change several deprecation statuses to normalize to align with ingestion paths by constantinius in #350
  • (create) Replace angle brackets in file names by loewenheim in #356

Internal Changes 🔧

  • (gh) Remove myself from CODEOWNERS by lcian in #354

🤖 This preview updates automatically when you update the PR.

@cleptric cleptric requested a review from gggritso May 8, 2026 13:49
@@ -0,0 +1,18 @@
{
"key": "score.ratio.<key>",
"brief": "For a measured web vital value, this is the ratio of values that fall below that value.",
Copy link
Copy Markdown

@DominikB2014 DominikB2014 May 8, 2026

Choose a reason for hiding this comment

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

Score.ratio.<key> is the actually the performance score for the individual web vital, normalized from 0-1. While Score.<key> is the preweighted scores, i belive the preweighted scores are legecy. (ratio is more valuable because we can adjust weights at query time)

For more context, When we calculate the total performance score we do a weighted average, something like (score.ratio.lcp * lcpWeight + score.ratio.inp + inpWeight ...) / sumOfWeights.
Here is the exact place we do the division, there a little more too it with things like omitting unseen vitals, but the formula above is the general idea
https://github.com/getsentry/sentry/blob/d4da43fea1f6ce8f521f3b6a1b8dac4c3e5c9a04/src/sentry/search/eap/spans/formulas.py#L486-L492

Copy link
Copy Markdown

@DominikB2014 DominikB2014 May 8, 2026

Choose a reason for hiding this comment

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

To add to this, the legacy way (before we had score.ratio.<key>) was to use the score.weights to calculate the normalized score (i.e lcp score = score.lcp / score.weight.lcp.

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.

Oh interesting, I thought this only happened in Relay. I based my explanations of these attributes on Relay's calculation logic. Does this mean that everything except score.ratio is strictly speaking optional for Relay to compute?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this mean that everything except score.ratio is strictly speaking optional for Relay to compute?

Eventually yes, all though a quick search in the sentry backend proves that we are still doing things the legacy way in some areas (i.e still using score.weight.* and score.*. I would be hesitant to make non ratios optional without digging into the usages further

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.

Oh, I definitely wasn't suggesting removing that right now.

What do you think of the rewritten description for score.ratio?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

More accurate now, lgtm!

@DominikB2014 DominikB2014 self-requested a review May 8, 2026 16:46
@loewenheim loewenheim merged commit 108b899 into main May 8, 2026
12 checks passed
@loewenheim loewenheim deleted the sebastian/web-vital-attributes branch May 8, 2026 16:48
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