Skip to content

ref(node-core): Drop pino<9.10 support#18631

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

ref(node-core): Drop pino<9.10 support#18631
logaretm wants to merge 2 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

@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.

}
},
"dependencies": {
"@apm-js-collab/tracing-hooks": "^0.3.1",
Copy link

Choose a reason for hiding this comment

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

Leftover type declaration for removed dependency

Low Severity

The @apm-js-collab/tracing-hooks and @apm-js-collab/code-transformer dependencies were removed, but their type declaration file at packages/node-core/src/sdk/apm-js-collab-tracing-hooks.d.ts was not deleted. This is now dead code that references non-existent packages.

Fix in Cursor Fix in Web

Comment on lines 127 to 132
setup: client => {
const enableLogs = !!client.getOptions().enableLogs;

addInstrumentationConfig({
channelName: 'pino-log',
// From Pino v9.10.0 a tracing channel is available directly from Pino:
// https://github.com/pinojs/pino/pull/2281
module: { name: 'pino', versionRange: '>=8.0.0 < 9.10.0', filePath: 'lib/tools.js' },
functionQuery: {
functionName: 'asJson',
kind: 'Sync',
},
});

const injectedChannel = diagnosticsChannel.tracingChannel('orchestrion:pino:pino-log');
const integratedChannel = diagnosticsChannel.tracingChannel('pino_asJson');

function onPinoStart(self: Pino, args: PinoHookArgs, result: PinoResult): void {
Copy link

Choose a reason for hiding this comment

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

Bug: The Pino integration requires v9.10+ but documentation wasn't updated and no version check was added, causing silent failure on older versions.
Severity: HIGH

Suggested Fix

Update the JSDoc to state that Pino >=v9.10.0 is required. Consider adding a runtime version check that logs a warning or error if an unsupported Pino version is detected to prevent silent failures.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/node-core/src/integrations/pino.ts#L127-L132

Potential issue: The Pino integration was updated to exclusively use the `pino_asJson`
tracing channel, which is only available in Pino v9.10 and later. However, the JSDoc for
the integration was not updated and still incorrectly states that `Pino >=v8.0.0` is
required. Furthermore, no runtime version check was added. Consequently, users with an
unsupported Pino version (>=8.0.0 and <9.10.0) will experience a silent failure where
the integration stops capturing logs without any warning or error. The
`diagnosticsChannel.tracingChannel('pino_asJson')` call will not fail, but the channel
will never receive events from older Pino versions.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

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