Skip to content

Can't disable session tracking in lazy loaded Sentry 9 SDK #16562

@constgen

Description

@constgen

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

We use lazy loaded Senty JavaScript SDK. The part of the initializtion config looks like this

//...
        autoSessionTracking: false,
        integrations: [
          hasTracingIntegration &&
            Sentry.browserTracingIntegration({
              interactionsSampleRate: 1,
              enableInp: true
            }),
          hasReplayIntegration &&
            Sentry.replayIntegration({
              maskAllText: environmentIsStagingOrProduction,
              maskAllInputs: environmentIsStagingOrProduction,
              blockAllMedia: environmentIsStagingOrProduction,
              block: ["audio", "video", "svg"]
            })
        ].filter(Boolean),
// ...

Our goal is to disable session tracking on navigation. It works as expected on SDK v8. There is no more sentry code on every React Router history navigation.

But on SDK v9, where autoSessionTracking option was removed, the Session Tracking is enabled by default and there is no way to disable it.

Image

We always see the Sentry code captureSession() run on every link click

Image

Expected Result

The official documentation https://docs.sentry.io/platforms/javascript/migration/v8-to-v9/#removed-apis says that Capture Session must be disabled by default and developers have to enable it manually with a separate integration. It is expected that migration to SDK 9 will just disable sessions capturing by default.

Actual Result

Sentry attaches extra handlers to every click which performs a navigation. This has some side effects on performance metrics. And there is no way to disable it or manage some how.

By the way I couldn't find the definition of this integration on CDN or Sentry.browserSessionIntegration. There is no such integration

Product Area

Settings - Integrations

Link

No response

DSN

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions