Skip to content

feat(node): Add getInstrumentedModuleNames() - #24254

Open
mydea wants to merge 3 commits into
feat/eve-conversation-hookfrom
feat/get-instrumented-module-names
Open

feat(node): Add getInstrumentedModuleNames()#24254
mydea wants to merge 3 commits into
feat/eve-conversation-hookfrom
feat/get-instrumented-module-names

Conversation

@mydea

@mydea mydea commented Sep 9, 2026

Copy link
Copy Markdown
Member

Stacked on #24247 (base branch feat/eve-conversation-hook).

Exposes getInstrumentedModuleNames() — the package names Sentry instruments through the orchestrion module transform (its diagnostics-channel injection).

import { getInstrumentedModuleNames } from '@sentry/node';

// eve agent.ts — keep every Sentry-instrumented package external so the
// transform can hook it, instead of hardcoding the list:
build: { externalDependencies: getInstrumentedModuleNames() }

Why:

  • A framework with no Sentry bundler plugin (eve, via build.externalDependencies) otherwise has to hardcode which packages to keep external. An inlined dependency never reaches the transform's onLoad, so it's silently never instrumented — this hands the app the authoritative set.
  • It returns the plain module.name set, deliberately without the bundler-only additions in the internal INSTRUMENTED_MODULE_NAMES (e.g. @remix-run/node), which exist to force a helper package to be bundled — the opposite of keeping it external.

Export surface: lives in @sentry/server-utils (home of the orchestrion config). Re-exported from @sentry/node, so export * consumers — nitro (eve's base), astro, nestjs, hono, effect — surface it automatically; and added explicitly to @sentry/bun, @sentry/aws-serverless, @sentry/google-cloud-serverless (from node) and @sentry/deno, @sentry/cloudflare (from server-utils), i.e. everywhere a server bundle is configured — the same footprint as eveConversationHook.

node-eve e2e: the orchestrion variant's build.externalDependencies now uses getInstrumentedModuleNames() instead of a hardcoded ['dataloader']. The app only uses dataloader of that set, so the others are no-ops; ai v7 stays correct when externalized (native ai:telemetry channel, and registration-only under the transform, so no double instrumentation). The existing dataloader assertion continues to prove the transform still runs.

🤖 Generated with Claude Code

@mydea
mydea added this pull request to stack #24250 September 9, 2026 14:24

@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 1036b89. Configure here.

for (const name of ['dataloader', 'ai', 'express', 'pg', 'redis']) {
expect(names).toContain(name);
}
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test loop covers multiple cases

Low Severity

This test loops over several package names and asserts each one is present. The review guidelines ask for (it)|(test).each instead of a loop that covers multiple scenarios in one test, so a single missing name does not hide the rest. Flagged because that testing convention is in the review rules file.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 1036b89. Configure here.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.81 kB - -
@sentry/browser - with treeshaking flags 27.12 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.01 kB - -
@sentry/browser (incl. Tracing) 49.22 kB -0.12% -59 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 49.22 kB -0.11% -52 B 🔽
@sentry/browser (incl. Tracing, Profiling) 52.15 kB -0.13% -63 B 🔽
@sentry/browser (incl. Tracing, Replay) 88.76 kB -0.06% -46 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.94 kB -0.06% -43 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 93.44 kB -0.06% -50 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 106.38 kB -0.06% -57 B 🔽
@sentry/browser (incl. Feedback) 46.3 kB - -
@sentry/browser (incl. sendFeedback) 33.87 kB - -
@sentry/browser (incl. FeedbackAsync) 38.99 kB - -
@sentry/browser (incl. Metrics) 29.84 kB - -
@sentry/browser (incl. Logs) 30.1 kB - -
@sentry/browser (incl. Metrics & Logs) 30.78 kB - -
@sentry/react 30.57 kB - -
@sentry/react (incl. Tracing) 51.57 kB -0.13% -66 B 🔽
@sentry/vue 36.07 kB - -
@sentry/vue (incl. Tracing) 51.49 kB -0.13% -63 B 🔽
@sentry/svelte 28.85 kB - -
CDN Bundle 30.56 kB - -
CDN Bundle (incl. Tracing) 49.76 kB -0.1% -48 B 🔽
CDN Bundle (incl. Logs, Metrics) 32.83 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.7 kB -0.14% -72 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 73.48 kB - -
CDN Bundle (incl. Tracing, Replay) 87.28 kB -0.09% -71 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.2 kB -0.07% -62 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 93.21 kB -0.07% -62 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.22 kB -0.06% -57 B 🔽
CDN Bundle - uncompressed 90.47 kB - -
CDN Bundle (incl. Tracing) - uncompressed 148.17 kB -0.13% -190 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.13 kB -0.13% -190 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.3 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.76 kB -0.08% -190 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.71 kB -0.07% -190 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.46 kB -0.07% -190 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.4 kB -0.07% -190 B 🔽
@sentry/nextjs (client) 54.03 kB -0.1% -53 B 🔽
@sentry/sveltekit (client) 49.68 kB -0.1% -45 B 🔽
@sentry/core/server 36.99 kB - -
@sentry/core/browser 13.55 kB - -
@sentry/node 127.86 kB -0.02% -16 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.61 kB - -
@sentry/node - without tracing 88.73 kB +0.03% +22 B 🔺
@sentry/node - without channel injection 107.11 kB -0.02% -13 B 🔽
@sentry/aws-serverless 97.12 kB +0.03% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 201.98 kB -0.04% -74 B 🔽
@sentry/cloudflare (withSentry) 502.68 kB -0.05% -232 B 🔽

View base workflow run

@mydea
mydea marked this pull request as ready for review September 9, 2026 14:42
@mydea
mydea requested review from a team as code owners September 9, 2026 14:42
@mydea
mydea requested review from JPeer264 and isaacs and removed request for a team September 9, 2026 14:42
mydea and others added 3 commits September 9, 2026 16:51
…-eve orchestrion test

Exposes `getInstrumentedModuleNames()` — the package names Sentry instruments
through the orchestrion module transform — so an app on a framework with no
Sentry bundler plugin can keep those packages external and let the transform
hook them, instead of hardcoding the list.

Lives in `@sentry/server-utils` (where the orchestrion config lives) and is
re-exported from `@sentry/node`, so `export *` consumers (nitro — eve's base —,
astro, …) surface it too. It returns the plain `module.name` set, deliberately
without the bundler-only additions in `INSTRUMENTED_MODULE_NAMES` (those force a
helper package to be bundled, the opposite of keeping it external).

The node-eve app's orchestrion variant now passes `getInstrumentedModuleNames()`
to `build.externalDependencies` instead of a hardcoded `['dataloader']`. The app
only uses `dataloader` of that set, so the rest are no-ops; `ai` v7 stays fine
externalized (native diagnostics channel + registration-only under the
transform).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Same footprint as eveConversationHook: added to the explicit re-export blocks of
@sentry/bun, @sentry/aws-serverless and @sentry/google-cloud-serverless (from
@sentry/node) and of @sentry/deno and @sentry/cloudflare (from
@sentry/server-utils), so it is available wherever a server bundle is configured.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Astro's runtime entry curates its `@sentry/node` re-exports (it can't
`export *`), so it needs the explicit listing like the other SDKs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mydea
mydea force-pushed the feat/get-instrumented-module-names branch from 2b5f1c9 to 3dd340f Compare September 9, 2026 14:51
@mydea
mydea requested a review from a team as a code owner September 9, 2026 14:51
@mydea
mydea requested review from nicohrubec and s1gr1d and removed request for a team September 9, 2026 14:51
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.

1 participant