Skip to content

feat(node)!: Remove iitm-based instrumentations from @sentry/node - #22728

Closed
andreiborza wants to merge 1 commit into
developfrom
ab/remove-iitm-node-instrumentations
Closed

feat(node)!: Remove iitm-based instrumentations from @sentry/node#22728
andreiborza wants to merge 1 commit into
developfrom
ab/remove-iitm-node-instrumentations

Conversation

@andreiborza

Copy link
Copy Markdown
Member

What

Removes the import-in-the-middle / OpenTelemetry vendored instrumentations from @sentry/node. Performance integrations are now channel-based via @sentry/server-utils (default since #22501), so the old iitm code is dead and gets deleted here.

  • Delete the vendored OTel tracing instrumentations for all DB/framework/AI integrations (mongo, mysql, kafka, postgres, redis, graphql, OpenAI, Anthropic, etc.).
  • Remove the registerEsmLoaderHooks option and drop the import-in-the-middle dependency; the SDK no longer registers ESM loader hooks.
  • Make knexIntegration and dataloaderIntegration channel-only (drop the OTel fallback).
  • Drop support for Fastify <3.21.0 (removes FastifyInstrumentationV3).
  • Remove the deprecated SentryHttpInstrumentation and SentryNodeFetchInstrumentation classes (the live instrumentHttpOutgoingRequests / instrumentUndici functions stay).

Dropping Fastify <3.21.0 removes the last live iitm module-patcher, which is what makes the full ESM-loader teardown possible. @opentelemetry/instrumentation stays as a dependency (still used by generateInstrumentOnce and ensureIsWrapped).

Why

These instrumentations were replaced by the channel-based ones in @sentry/server-utils. Keeping the iitm code around meant shipping ~12k lines of dead vendored instrumentation plus the ESM-loader plumbing that nothing used anymore.

Closes: #22346

All performance integrations are now channel-based via `@sentry/server-utils`,
so the old import-in-the-middle / OpenTelemetry vendored instrumentations are
removed:

- Remove the `registerEsmLoaderHooks` option and the `import-in-the-middle`
  dependency; the SDK no longer registers ESM loader hooks.
- Make `knexIntegration` and `dataloaderIntegration` channel-only (no OTel
  fallback on runtimes without diagnostics-channel injection).
- Drop support for Fastify `<3.21.0`.
- Remove the deprecated `SentryHttpInstrumentation` and
  `SentryNodeFetchInstrumentation` classes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b988ec5. Configure here.

Comment thread CHANGELOG.md
- `DenoMysql` => `Mysql`
- `DenoPostgres` => `Postgres`
- feat(node)!: Remove `import-in-the-middle`-based instrumentations from `@sentry/node`. All performance integrations are now channel-based via `@sentry/server-utils`. As part of this:
- The `registerEsmLoaderHooks` option was removed from `NodeOptions`. The SDK no longer registers `import-in-the-middle` ESM loader hooks, and `import-in-the-middle` is no longer a dependency.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing migration note for option

Medium Severity

Removing the public registerEsmLoaderHooks option from NodeOptions is a breaking API change. It is called out in the changelog, but MIGRATION.md’s @sentry/node removals section does not mention it, unlike other public removals in that guide. Flagged because the review rules require proper notices for public API removals.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit b988ec5. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.85 kB - -
@sentry/browser - with treeshaking flags 28.06 kB - -
@sentry/browser (incl. Tracing) 47.42 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.43 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.16 kB - -
@sentry/browser (incl. Tracing, Replay) 86.75 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.16 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 91.49 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 104.12 kB - -
@sentry/browser (incl. Feedback) 47.17 kB - -
@sentry/browser (incl. sendFeedback) 34.69 kB - -
@sentry/browser (incl. FeedbackAsync) 39.78 kB - -
@sentry/browser (incl. Metrics) 30.92 kB - -
@sentry/browser (incl. Logs) 31.15 kB - -
@sentry/browser (incl. Metrics & Logs) 31.83 kB - -
@sentry/react 31.64 kB - -
@sentry/react (incl. Tracing) 49.64 kB - -
@sentry/vue 34.77 kB - -
@sentry/vue (incl. Tracing) 49.38 kB - -
@sentry/svelte 29.88 kB - -
CDN Bundle 31.89 kB - -
CDN Bundle (incl. Tracing) 47.77 kB - -
CDN Bundle (incl. Logs, Metrics) 33.44 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.15 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.8 kB - -
CDN Bundle (incl. Tracing, Replay) 85.41 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.18 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.48 kB - -
CDN Bundle - uncompressed 95.14 kB - -
CDN Bundle (incl. Tracing) - uncompressed 143.28 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.85 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.61 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.54 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.5 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.2 kB - -
@sentry/nextjs (client) 52.23 kB - -
@sentry/sveltekit (client) 47.84 kB - -
@sentry/core/server 79.73 kB - -
@sentry/core/browser 51.61 kB - -
@sentry/node 121.02 kB -3.51% -4.39 kB 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 84.48 kB -1.49% -1.27 kB 🔽
@sentry/aws-serverless 92.71 kB -1.15% -1.07 kB 🔽
@sentry/cloudflare (withSentry) - minified 196.62 kB - -
@sentry/cloudflare (withSentry) 483.75 kB - -

View base workflow run

@andreiborza

Copy link
Copy Markdown
Member Author

Splitting this into one PR per instrumentation removal for easier review, with a final PR for the shared iitm plumbing (InstrumentationBase-based classes, esmLoader, import-in-the-middle). Superseded.

@andreiborza
andreiborza deleted the ab/remove-iitm-node-instrumentations branch July 28, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove iitm-based instrumentations from @sentry/node

1 participant