Skip to content

Make XHR request instrumentation tree-shakeable #26133

Closed

Description

@sentry-junior

browserTracingIntegration() always bundles XHR request instrumentation, even for apps that only use fetch. The only off switch is the runtime option traceXHR, so bundlers can't drop the code.

  • The guard is if (traceXHR) in packages/browser/src/tracing/request.ts L183. It keeps addXhrInstrumentationHandler from @sentry/browser-utils, xhrCallback, and the XHR header helpers.
  • Measured on a tracing-only setup (BrowserClient + browserTracingIntegration(), esbuild 0.27, minified ESM, __SENTRY_DEBUG__: false): this code is 2,976 B raw / 860 B brotli-11.

via @BYK.

--

View Session in Sentry

Activity

  1. linear-code commented on Nov 5, 2026

    @linear-code
  2. added
    javascript
    on Nov 5, 2026
  3. logaretm commented on Nov 23, 2026

    @logaretm
    Member

    closed in #26261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureTracesjavascript

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions