perf: switch from @sentry/bun to @sentry/node-core/light (~170ms startup savings)#474
Merged
perf: switch from @sentry/bun to @sentry/node-core/light (~170ms startup savings)#474
Conversation
…tup savings) Replace @sentry/bun (which pulls in the full OpenTelemetry stack and 29+ auto-instrumentation modules) with @sentry/node-core/light for ~150ms import time savings. Additionally, patch @sentry/core barrel to remove 32 unused export lines (AI tracing, MCP server, Supabase, feature flags, etc.) for ~14ms more. Changes: - Upgrade Sentry SDK 10.39.0 → 10.44.0 - Replace all @sentry/bun imports → @sentry/node-core/light (15 src files) - Change BunClient → LightNodeClient in telemetry.ts - Export Span type from @sentry/core (canonical source) - Remove esbuild @sentry/bun → @sentry/node alias in bundle.ts - Add patches for @sentry/core and @sentry/node-core barrels - Update test imports and mock targets (4 test files) - Add upstream issue drafts for @sentry/core/light and @sentry/bun/light Closes #472
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1034 uncovered lines. Files with missing lines (7)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.71% 95.71% —%
==========================================
Files 177 177 —
Lines 24091 24100 +9
Branches 0 0 —
==========================================
+ Hits 23057 23066 +9
- Misses 1034 1034 —
- Partials 0 0 —Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- Fix BunClient → LightNodeClient type in telemetry-session test - Remove dead empty alias object from esbuild config - Override LightNodeClient runtime metadata to report bun when running as a compiled Bun binary (the client hardcodes 'node')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Switch from
@sentry/bunto@sentry/node-core/lightto eliminate the OpenTelemetry dependency tree that a CLI tool never uses. Additionally, patch@sentry/corebarrel to remove unused modules (AI tracing, MCP server, Supabase, feature flags).Changes
Phase 1: SDK upgrade
10.39.0→10.44.0Phase 2: Import migration (~150ms savings)
@sentry/bun+@sentry/nodedependencies with@sentry/node-coreimport * as Sentry from "@sentry/bun"→"@sentry/node-core/light"(15 source files, 4 test files)BunClient→LightNodeClientin telemetry.tsSpantype from@sentry/core(canonical source)@sentry/bun→@sentry/nodealias in bundle.ts (no longer needed)Phase 3: Barrel patching (~14ms savings)
@sentry/corebarrel to remove 32 export lines pulling in ~59 unused transitive modules (AI tracing integrations, MCP server, Supabase, feature flags, etc.)@sentry/node-core/lightbarrel to remove 11 matching re-exportsPhase 4: Upstream issue drafts
.github/upstream-issues/with drafts for:@sentry/core/lightsub-path export request@sentry/bun/lightentry point requestWhat we lose (nothing meaningful)
bunServerIntegrationBun.serve()BunClientclassLightNodeClientmakeNodeTransportworks fine in BunAsyncLocalStorage— same behavior"bun""node-light"— cosmetic only.cli.runtimetag still distinguishes Bun vs NodeAPI compatibility verified
Every API the CLI uses (
captureException,startSpan,setTag,metrics,logger,createConsolaReporter,getTraceData,isEnabled,flush,endSession, etc.) is available in@sentry/node-core/light.Risk
Light mode is labeled experimental, but we pin SDK versions exactly (
10.44.0, not^10.44.0), so we control when SDK updates happen.Verification
bun run typecheck— cleanbun run test:unit— 3883/3885 pass (2 pre-existing flaky failures in upgrade tests)bun run test:isolated— 126/126 passbun run check:skill— up to datebun run check:errors— no anti-patternsundefinedCloses #472