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

Loading the BrowserTracing integration separately and ensure Sentry is loaded lazily #15386

Open
gilisho opened this issue Feb 12, 2025 · 1 comment

Comments

@gilisho
Copy link
Contributor

gilisho commented Feb 12, 2025

Problem Statement

We are using Sentry major 7 on a micro-frontend environment. We load Sentry using Loader script.

We want to be able to use Sentry's SDK method of startSpan/startSpanManual in order to report interesting transactions and monitor them via Sentry.
According to the docs, this requires loading the specific bundle of tracing, e.g. https://browser.sentry-cdn.com/7.120.3/bundle.tracing.min.js as described here.

Our problem with this requirement is that we would still want to load Sentry lazily, as if I'm using error-only features. Only if there is a use of startSpan or startSpanManual for example, the Sentry bundle would fully load.
We want to monitoring only the transactions reported via startSpan/startSpanManual.

Is there a way to achieve that and workaround the current limitation?
Thank you very much!

Solution Brainstorm

We are thinking about loading the non-tracing bundle and maybe load BrowserTracing integration bundle separately. Not sure If this is going to work (I can create a PR to add a bundle of this integration, as I previously did for ModuleMetadata here and here).
Would love your feedback regarding the possibility of this.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 12, 2025
@andreiborza
Copy link
Member

Hey @gilisho, thanks for writing in.

We discussed this internally and thought of ways to achieve this. For now, if it's feasible, you could try to

  • continue using the loader and
  • add your own bundle that exports startSpan APIs like an addon bundle.

Alternatively, you could build your own index.bundle.js and build the bundle yourself with all the exports you want although that would mean you can't use the loader anymore.

Getting changes like these into v7 might be difficult tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants