Skip to content

Always add browserTracingIntegration in Meta Framework SDKs #13010

Closed
5 of 5 issues completed
Closed
Improvement
5 of 5 issues completed
@Lms24

Description

@Lms24

Problem Statement

Currently, our meta-framework SDKs (in contrast to the frontend framework and base browser SDKs) automatically add browserTracingIntegration if:

  1. The __SENTRY_TRACING__ tree-shaking flag is not replaced at build time
  2. hasTracingEnabled returns true, meaning tracesSampleRate, tracesSampler or enableTracing options are set

The second (2) condition unfortunately breaks "Tracing without Performance" which in our frontend framework SDKs is enabled as soon as browserTracingIntegration is added but no sample rates are set. Adding to this, there is no bundle size advantage in not adding browserTracingIntegration because the hasTracingEnabled check is performed at runtime. This results in the integration code always being added to the bundle.

We realized this while working on and reviewing #13005

Solution Brainstorm

We're going to change the behaviour here to remove condition 2 entirely. Meaning, by default, browserTracingIntegration will always be added, unless users configure the tree shaking flag (1). This change should be implemented in all our meta framework SDKs that currently automatically add browserTracingIntegration.

The benefits of always adding the integration are:

  • Tracing without performance works, i.e. tracing headers are propagated to get a trace for an error but no spans are created or sent to Sentry
  • The error transaction field is populated via the framework's browserTracingIntegration setting scope.transactionName. This means higher quality transaction names out of the box.
  • Bundle size isn't wasted like before

Implementation

Implementing this behaviour requires two changes:

  1. Remove the hasTracingEnabled guard in the SDK initialization
  2. Add a higher-level option to the meta framework's build config (e.g. sentrySvelteKit vite plugin or Astro integration options) for users to easily opt out of tracing. This option should pass the boolean to the Sentry bundler plugin's bundleSizeOptimizations.excludePerformanceMonitoring option.

Sub-issues

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions