Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webvitals): Add profile id, replay id, and user to standalone INP spans #10849

Conversation

edwardgou-sentry
Copy link

Adds profile id, replay id, and user to standalone INP spans.

  • User comes from the current scope.
  • Replay Id is retrieved from the relay integration module and calling getReplayId().
  • Profile Id is retrieved from getting the active transaction at the time of the interaction
    • Since profile id isn't added to the transaction until the transaction ends, we need to hold onto a reference to the transaction instead of trying to grab the profile id right away

Copy link
Contributor

github-actions bot commented Feb 28, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 78.64 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 69.86 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 73.8 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 63.47 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 33.83 KB (+0.11% 🔺)
@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped) 34.86 KB (+3.44% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.38 KB (0%)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.39 KB (0%)
@sentry/browser - Webpack (gzipped) 22.67 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 76.88 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 68.37 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 34.16 KB (+0.1% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 25.07 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 215.45 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 103.25 KB (+0.12% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 75.28 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 37.33 KB (+0.1% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 70.24 KB (+0.07% 🔺)
@sentry/react - Webpack (gzipped) 22.7 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 89.09 KB (+1.34% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 53.26 KB (+2.22% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.24 KB (0%)

@@ -632,6 +633,7 @@ export class Span implements SpanInterface {
origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined,
_metrics_summary: getMetricSummaryJsonForSpan(this),
measurements: this._attributes[SEMANTIC_ATTRIBUTE_MEASUREMENTS] as Measurements | undefined,
profile_id: this._attributes[SEMANTIC_ATTRIBUTE_PROFILE_ID] as string | undefined,
Copy link
Author

Choose a reason for hiding this comment

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

We're putting profile_id as a top level field because relay expects this

@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review February 29, 2024 16:52
@@ -564,6 +574,9 @@ function registerInpInteractionListener(
routeName,
duration,
parentContext,
user,
activeTransaction,
replay,
Copy link
Member

Choose a reason for hiding this comment

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

IMO we should pass in the id's here instead of holding references to replay integration/active transaction

Copy link
Author

Choose a reason for hiding this comment

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

I should be able to update this for replay ID.

For profiles, the profiling integration only attaches the profile id to the active transaction when the transaction finishes. So we don't immediately have access to a profile id when an interaction occurs. Keeping a reference to the transaction seemed like the easiest way to grab the profile id when we're ready to send an INP. Not sure if there is a better solution, but I can think about it if this is a blocker

Copy link
Member

Choose a reason for hiding this comment

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

ahh I see, yeah let's hold the transaction reference then, np

@edwardgou-sentry edwardgou-sentry merged commit 3336ff3 into egou/v7/feat/add-sampling-rate-to-inp-spans Feb 29, 2024
@edwardgou-sentry edwardgou-sentry deleted the egou/v7/profile-replay-and-user-for-inp branch February 29, 2024 20:50
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.

None yet

2 participants