Skip to content

feat(ember): Extract ember-specific logic into custom browserTracingIntegration#20702

Open
mydea wants to merge 2 commits intodevelopfrom
fn/ember-better-browserTracing
Open

feat(ember): Extract ember-specific logic into custom browserTracingIntegration#20702
mydea wants to merge 2 commits intodevelopfrom
fn/ember-better-browserTracing

Conversation

@mydea
Copy link
Copy Markdown
Member

@mydea mydea commented May 6, 2026

Kind of extracted/inspired by #19229, this refactors the ember logic for performance monitoring to use the more general pattern we already have in our code, delegating this fully into an ember-specific browserTracingIntegration.

For now, this should not be breaking, as the auto-wiring etc. remains the same - it just uses this integration under the hood instead of manually calling stuff etc.

In a follow up, this should make it much easier to use this in a more standalone fashion in the v2 addon.

I've split the logic into separate files as this was all a bit convoluted together, hopefully this makes it a bit easier to follow what belongs where etc.

This also generally aligns the ember package more with our own broader way of handling things, which is also nice IMHO. If you add the integration, you get everything set up, and if not, not - easy! :D

Status quo

This is still being added automatically - this is what instance-initializers/sentry-performance.ts does. that auto-runs and adds the browser tracing integration so it has access to the ember app instance, which we need to setup tracing stuff properly.

Future (v11)

We'll no longer have the auto instance-initializer, but instead users will have to manually add this. but this can be simplified then in their app code to:

import * as Sentry from '@sentry/ember';

export function initialize(appInstance) {
  Sentry.addIntegration(Sentry.browserTracingIntegration({ appInstance }));
}

@mydea mydea self-assigned this May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.3 kB - -
@sentry/browser - with treeshaking flags 24.78 kB - -
@sentry/browser (incl. Tracing) 44.17 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 46.39 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.14 kB - -
@sentry/browser (incl. Tracing, Replay) 83.55 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.01 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 88.23 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 100.84 kB - -
@sentry/browser (incl. Feedback) 43.44 kB - -
@sentry/browser (incl. sendFeedback) 31.11 kB - -
@sentry/browser (incl. FeedbackAsync) 36.19 kB - -
@sentry/browser (incl. Metrics) 27.6 kB - -
@sentry/browser (incl. Logs) 27.73 kB - -
@sentry/browser (incl. Metrics & Logs) 28.43 kB - -
@sentry/react 28.04 kB - -
@sentry/react (incl. Tracing) 46.4 kB - -
@sentry/vue 31.18 kB - -
@sentry/vue (incl. Tracing) 46.02 kB - -
@sentry/svelte 26.32 kB - -
CDN Bundle 28.91 kB - -
CDN Bundle (incl. Tracing) 46.94 kB - -
CDN Bundle (incl. Logs, Metrics) 30.34 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.04 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 69.4 kB - -
CDN Bundle (incl. Tracing, Replay) 84.07 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.15 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 89.89 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 90.97 kB - -
CDN Bundle - uncompressed 84.88 kB - -
CDN Bundle (incl. Tracing) - uncompressed 140.44 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 89.08 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 143.9 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 212.99 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 258.24 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 261.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 271.94 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 275.38 kB - -
@sentry/nextjs (client) 48.9 kB - -
@sentry/sveltekit (client) 44.64 kB - -
@sentry/node-core 60.08 kB +0.01% +5 B 🔺
@sentry/node 163.8 kB +0.01% +11 B 🔺
@sentry/node - without tracing 73.08 kB +0.02% +10 B 🔺
@sentry/aws-serverless 107.24 kB +0.01% +8 B 🔺
@sentry/cloudflare (withSentry) - minified 169.35 kB - -
@sentry/cloudflare (withSentry) 427.5 kB - -

View base workflow run

@mydea mydea force-pushed the fn/ember-better-browserTracing branch from 705bcf0 to bc9ce81 Compare May 6, 2026 14:05
Comment thread packages/ember/addon/instance-initializers/sentry-performance.ts
afterAllSetup(client: BrowserClient) {
integration.afterAllSetup(client);

// Run this in the next tick to ensure the ember router etc. is properly initialized
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

without this, the pageload instrumentation does not work. it seems that router.location is not properly resolved/available yet at this time. probably some timing issue. this was not a problem before because we had an await import before this which lead to no timing issues in that case.

@mydea mydea marked this pull request as ready for review May 6, 2026 14:23
@mydea mydea requested a review from a team as a code owner May 6, 2026 14:23
make it work with legacy stuff...

move stuff around and fix it

WIP move stuff around...

fix where stuff lives
Comment thread packages/ember/addon/utils/performance.ts
Comment thread packages/ember/addon/utils/browserTracingIntegration.ts Outdated
Comment thread packages/ember/addon/instance-initializers/sentry-performance.ts
@mydea mydea force-pushed the fn/ember-better-browserTracing branch from 14cb4fa to 39a52a7 Compare May 6, 2026 14:55
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.

1 participant