Skip to content

Extract INP and INP score from spans and into metrics #2873

@edwardgou-sentry

Description

@edwardgou-sentry

Problem Statement

INP is a new core webvital that is due to replace FID in March 2024: https://web.dev/articles/inp

The Sentry Web Vitals module uses a concept of Performance Scores which uses FID as a component in it's calculation. We should replace FID with INP within the Performance Score concept. To do this, we need updates to Relay to calculate and store INP scores in indexed spans and metrics. More details below:

  • INP is a span measurement that will come from the JS sdk. Other webvital measurements such as LCP, FCP, etc come from the JS sdk too, but they're on transactions instead.

  • Each webvital on an transaction has a score measurement. For example measurement.score.lcp. These scores are calculated in relay in the event normalizer here:

    fn normalize_performance_score(

  • The total score (ie measurements.score.total) is the sum of each Webvital score on an transaction, with weights applied. This also gets calculated in relay and is stored on the event and as a metric

  • INP is on interaction spans, which do not have any other webvital attached except INP. So basically, the measurements.score.total of an INP span is just the same value as measurements.score.inp

-So the work remaining here is to bring over some of the score calculation logic from the event normalizer into spans so that we can get measurements.score.total and measurements.score.inp as metrics

Additional Thoughts

  • Since we are moving away from transactions and to exclusively spans, we may want to recreate the existing score metrics to be under the spans namespace instead. ie from d:transactions/measurements.score.total@ratio to something like d:spans/measurements.webvital.score.total@ratio and d:spans/measurements.webvital.score.inp@ratio for INP . Also might want to prefix with webvital so theres more clarity around the score source.

  • We only need a few tags. See here for what tags we used in transactions:
    https://github.com/getsentry/relay/pull/2827/files

  • For the score metrics, we also don't need all the distributions. sum and count should be enough for the Web Vitals product purposes. For the raw INP measurement value, maybe we keep the standard distributions so that they can be queried in Dashboards? (this would be the existing behaviour of other webvital measurements)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions