Skip to content

feat(bun): enable new mysql, pg integrations in 'bun build'#21828

Open
isaacs wants to merge 1 commit into
isaacs/pg-orchestrionfrom
isaacs/fix-bun-orchestrion-actually-instrument
Open

feat(bun): enable new mysql, pg integrations in 'bun build'#21828
isaacs wants to merge 1 commit into
isaacs/pg-orchestrionfrom
isaacs/fix-bun-orchestrion-actually-instrument

Conversation

@isaacs

@isaacs isaacs commented Jun 29, 2026

Copy link
Copy Markdown
Member

The bun plugin was injecting the channels, and we had an integration test verifying that. However, it was not actually swapping out the (nonfunctional) OTel-based integrations with the orchestrion diagnostics-channel versions, meaning that the spans would not be emitted as expected.

Add a full end-to-end test verifying that a bun build-compiled application will instrument a mysql connection and emit spans for the queries being executed.

When the orchestrion bundler marker is not present, do not add the diagnostics-channel listeners, since they will not have anything to trigger them anyway.

Also, this means that as new diagnostics-channel-injection integrations are added, Bun will benefit from automatically loading those instrumentations, as long as the application is compiled with bun build, using the @sentry/bun/plugin plugin.

@isaacs isaacs requested a review from a team as a code owner June 29, 2026 01:35
@isaacs isaacs requested review from JPeer264, andreiborza and mydea and removed request for a team June 29, 2026 01:35
@isaacs isaacs force-pushed the isaacs/pg-orchestrion branch from 9545bf8 to dfe74f5 Compare June 29, 2026 01:36
@isaacs isaacs force-pushed the isaacs/fix-bun-orchestrion-actually-instrument branch from e3cde9d to f53b1bc Compare June 29, 2026 01:36
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.59 kB - -
@sentry/browser - with treeshaking flags 26.03 kB - -
@sentry/browser (incl. Tracing) 46.05 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.79 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.81 kB - -
@sentry/browser (incl. Tracing, Replay) 85.28 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.89 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.97 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.64 kB - -
@sentry/browser (incl. Feedback) 44.77 kB - -
@sentry/browser (incl. sendFeedback) 32.39 kB - -
@sentry/browser (incl. FeedbackAsync) 37.52 kB - -
@sentry/browser (incl. Metrics) 28.67 kB - -
@sentry/browser (incl. Logs) 28.91 kB - -
@sentry/browser (incl. Metrics & Logs) 29.6 kB - -
@sentry/react 29.38 kB - -
@sentry/react (incl. Tracing) 48.35 kB - -
@sentry/vue 32.82 kB - -
@sentry/vue (incl. Tracing) 47.91 kB - -
@sentry/svelte 27.61 kB - -
CDN Bundle 30 kB - -
CDN Bundle (incl. Tracing) 47.98 kB - -
CDN Bundle (incl. Logs, Metrics) 31.57 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.32 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.77 kB - -
CDN Bundle (incl. Tracing, Replay) 85.48 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.76 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.29 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.53 kB - -
CDN Bundle - uncompressed 89.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.28 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.25 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.59 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.29 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.25 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.99 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.94 kB - -
@sentry/nextjs (client) 50.73 kB - -
@sentry/sveltekit (client) 46.44 kB - -
@sentry/core/server 77.75 kB - -
@sentry/core/browser 64.06 kB - -
@sentry/node-core 62.37 kB -0.01% -1 B 🔽
@sentry/node 121.24 kB -0.01% -3 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.46 kB -0.01% -1 B 🔽
@sentry/node - without tracing 72.68 kB -0.01% -1 B 🔽
@sentry/aws-serverless 83.51 kB -0.01% -3 B 🔽
@sentry/cloudflare (withSentry) - minified 180.62 kB - -
@sentry/cloudflare (withSentry) 446.93 kB - -

View base workflow run

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice changes. Could also be useful for Cloudflare I think

Comment thread packages/server-utils/src/orchestrion/index.ts Outdated
@isaacs isaacs force-pushed the isaacs/pg-orchestrion branch from dfe74f5 to 373c014 Compare June 30, 2026 23:45
@isaacs isaacs force-pushed the isaacs/fix-bun-orchestrion-actually-instrument branch from f53b1bc to 17bb086 Compare July 1, 2026 04:42
@isaacs isaacs force-pushed the isaacs/pg-orchestrion branch 7 times, most recently from 2b34039 to a4e321e Compare July 2, 2026 00:31
@isaacs isaacs force-pushed the isaacs/fix-bun-orchestrion-actually-instrument branch from 17bb086 to caead8a Compare July 2, 2026 03:38
@isaacs isaacs requested a review from a team as a code owner July 2, 2026 03:38
@isaacs isaacs requested review from Lms24 and logaretm and removed request for a team July 2, 2026 03:38

@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 6 potential issues.

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 caead8a. Configure here.

Comment thread dev-packages/node-integration-tests/suites/tracing/postgres/scenario-native.mjs Outdated
Comment thread dev-packages/node-integration-tests/suites/tracing/knex/mysql2/docker-compose.yml Outdated
Comment thread dev-packages/e2e-tests/test-applications/hono-4/tests/route-patterns.test.ts Outdated
@isaacs isaacs force-pushed the isaacs/fix-bun-orchestrion-actually-instrument branch 3 times, most recently from aac5ba0 to 913c558 Compare July 2, 2026 03:57
The bun *plugin* was injecting the channels, and we had an integration
test verifying that. However, it was not actually swapping out the
(nonfunctional) OTel-based integrations with the orchestrion
diagnostics-channel versions, meaning that the spans would not be
emitted as expected.

Add a full end-to-end test verifying that a `bun build`-compiled
application will instrument a mysql connection and emit spans for the
queries being executed.

When the orchestrion bundler marker is *not* present, do not add the
diagnostics-channel listeners, since they will not have anything to
trigger them anyway.

Also, this means that as new diagnostics-channel-injection integrations
are added, Bun will benefit from automatically loading those
instrumentations, as long as the application is compiled with `bun
build`, using the `@sentry/bun/plugin` plugin.
@isaacs isaacs force-pushed the isaacs/fix-bun-orchestrion-actually-instrument branch from 913c558 to fe1c7bc Compare July 2, 2026 04:04
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.

2 participants