Skip to content

fix(node-core): Reduce bundle size by removing apm-js-collab and requiring pino >= 9.10#18631

Open
logaretm wants to merge 3 commits intodevelopfrom
awad/js-1160-apm-js-collab-is-included-in-the-sentrynextjs-bundle-when
Open

fix(node-core): Reduce bundle size by removing apm-js-collab and requiring pino >= 9.10#18631
logaretm wants to merge 3 commits intodevelopfrom
awad/js-1160-apm-js-collab-is-included-in-the-sentrynextjs-bundle-when

Conversation

@logaretm
Copy link
Member

We discussed this in Bikeshedding, apm-js runtime hooks gets bundled in frameworks still using CJS like Next.js, even if the user was not using Pino integration at all. Attempts to tree-shake it failed as Next.js is still using CJS.

We can drop support for older versions of Pino, given that pino@9.10 already exposes a tracing channel that we use, and that the injected channel was a backup for pino<9.10

This will reduce bundle sizes and ensure frameworks incapable of esm tree-shaking don't pick it up as a dependency.

I will remove @apm-js-collab/tracing-hooks as a dep from node-core since nothing else uses it.

closes #18199

@linear
Copy link

linear bot commented Dec 29, 2025

@logaretm logaretm changed the title ref(pino): Drop pino<9.10 support ref(node-core): Drop pino<9.10 support Dec 29, 2025
@logaretm logaretm added Meta: Breaking Package: node Issues related to the Sentry Node SDK breaking change labels Dec 29, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,392 - 9,285 +1%
GET With Sentry 1,770 19% 1,723 +3%
GET With Sentry (error only) 6,199 66% 6,019 +3%
POST Baseline 1,202 - 1,213 -1%
POST With Sentry 592 49% 601 -1%
POST With Sentry (error only) 1,067 89% 1,068 -0%
MYSQL Baseline 3,336 - 3,356 -1%
MYSQL With Sentry 474 14% 459 +3%
MYSQL With Sentry (error only) 2,716 81% 2,714 +0%

View base workflow run

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.82 kB - -
@sentry/browser - with treeshaking flags 23.32 kB - -
@sentry/browser (incl. Tracing) 41.6 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.19 kB - -
@sentry/browser (incl. Tracing, Replay) 80.17 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.91 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.85 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.1 kB - -
@sentry/browser (incl. Feedback) 41.54 kB - -
@sentry/browser (incl. sendFeedback) 29.51 kB - -
@sentry/browser (incl. FeedbackAsync) 34.5 kB - -
@sentry/browser (incl. Metrics) 25.85 kB - -
@sentry/browser (incl. Logs) 26.07 kB - -
@sentry/browser (incl. Metrics & Logs) 26.73 kB - -
@sentry/react 26.54 kB - -
@sentry/react (incl. Tracing) 43.79 kB - -
@sentry/vue 29.29 kB - -
@sentry/vue (incl. Tracing) 43.41 kB - -
@sentry/svelte 24.84 kB - -
CDN Bundle 27.25 kB - -
CDN Bundle (incl. Tracing) 42.24 kB - -
CDN Bundle (incl. Tracing, Replay) 78.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.41 kB - -
CDN Bundle - uncompressed 80.06 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.49 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 242.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.79 kB - -
@sentry/nextjs (client) 46.02 kB - -
@sentry/sveltekit (client) 41.97 kB - -
@sentry/node-core 51.61 kB -0.03% -12 B 🔽
@sentry/node 161.51 kB -0.01% -11 B 🔽
@sentry/node - without tracing 93.04 kB -0.02% -10 B 🔽
@sentry/aws-serverless 108.56 kB -0.01% -8 B 🔽

View base workflow run

@Lms24 Lms24 added this to the 11.0.0 milestone Dec 29, 2025
@logaretm logaretm force-pushed the awad/js-1160-apm-js-collab-is-included-in-the-sentrynextjs-bundle-when branch from 3d7aa48 to e0577ed Compare February 15, 2026 17:51
@logaretm logaretm marked this pull request as ready for review February 16, 2026 06:41
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR drops support for Pino versions before 9.10.0 to reduce bundle size, particularly for frameworks using CommonJS (like Next.js) that cannot effectively tree-shake unused dependencies. The change removes the @apm-js-collab/tracing-hooks dependency and associated injection loader infrastructure, relying solely on the native pino_asJson tracing channel introduced in Pino 9.10.0.

Changes:

  • Removed @apm-js-collab/tracing-hooks and @apm-js-collab/code-transformer dependencies
  • Deleted the injection loader infrastructure (injectLoader.ts and related hooks)
  • Updated Pino integration to use only the native pino_asJson tracing channel
  • Updated test dependencies to use Pino 9.10.0

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
yarn.lock Removed @apm-js-collab package entries and updated pino from 9.9.4 to 9.10.0
packages/node-core/src/sdk/injectLoader.ts Deleted entire file containing injection loader infrastructure
packages/node-core/src/sdk/index.ts Removed GLOBAL_OBJ import and call to inject loader hook registration
packages/node-core/src/integrations/pino.ts Removed addInstrumentationConfig import and usage, removed injectedChannel subscription for pino<9.10
packages/node-core/package.json Removed @apm-js-collab/tracing-hooks dependency and @apm-js-collab/code-transformer devDependency
packages/core/src/utils/worldwide.ts Removed _sentryInjectLoaderHookRegister and _sentryInjectLoaderHookRegistered global type definitions
dev-packages/node-integration-tests/package.json Updated pino version from 9.9.4 to 9.10.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Approving this since it seems like a lot of users are affected by largely increased bundle/module sizes. Some suggestions:

  • I'd re-classify this as a fix and highlight it as an important change in the changelog
  • Let's ensure projects with older Pino versions only break sliently (as in, we don't actually break builds after updating the SDK).


addExceptionMechanism(event, {
handled: options.error.handled,
type: 'pino',
Copy link
Member

Choose a reason for hiding this comment

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

l: unrelated to this PR but can we align the exception mechanism to be adhere to our mechanism type specification?

I'd suggest

Suggested change
type: 'auto.log.pino',

Copy link
Member Author

Choose a reason for hiding this comment

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

Will create another PR 👍

@logaretm logaretm force-pushed the awad/js-1160-apm-js-collab-is-included-in-the-sentrynextjs-bundle-when branch from e0577ed to 9ec85d9 Compare February 16, 2026 13:49
@logaretm logaretm changed the title ref(node-core): Drop pino<9.10 support fix(node-core): Reduce bundle size by removing apm-js-collab and requiring pino >= 9.10 Feb 16, 2026
@logaretm logaretm force-pushed the awad/js-1160-apm-js-collab-is-included-in-the-sentrynextjs-bundle-when branch from a7c1a31 to bd1c6cd Compare February 16, 2026 14:00
@logaretm logaretm force-pushed the awad/js-1160-apm-js-collab-is-included-in-the-sentrynextjs-bundle-when branch from bd1c6cd to 17cec6a Compare February 16, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Meta: Breaking Package: node Issues related to the Sentry Node SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@apm-js-collab is included in the @sentry/nextjs bundle when Pino integration is not enabled

4 participants