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
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/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

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.48 kB - -
@sentry/browser - with treeshaking flags 25.91 kB - -
@sentry/browser (incl. Tracing) 45.97 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.72 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.76 kB - -
@sentry/browser (incl. Tracing, Replay) 85.22 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.81 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.91 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.57 kB - -
@sentry/browser (incl. Feedback) 44.66 kB - -
@sentry/browser (incl. sendFeedback) 32.26 kB - -
@sentry/browser (incl. FeedbackAsync) 37.4 kB - -
@sentry/browser (incl. Metrics) 28.54 kB - -
@sentry/browser (incl. Logs) 28.78 kB - -
@sentry/browser (incl. Metrics & Logs) 29.47 kB - -
@sentry/react 29.27 kB - -
@sentry/react (incl. Tracing) 48.28 kB - -
@sentry/vue 32.63 kB - -
@sentry/vue (incl. Tracing) 47.84 kB - -
@sentry/svelte 27.5 kB - -
CDN Bundle 29.89 kB - -
CDN Bundle (incl. Tracing) 47.89 kB - -
CDN Bundle (incl. Logs, Metrics) 31.44 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.24 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.78 kB - -
CDN Bundle (incl. Tracing, Replay) 85.4 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.68 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.19 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.45 kB - -
CDN Bundle - uncompressed 88.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.03 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.65 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.62 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.05 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.69 kB - -
@sentry/nextjs (client) 50.67 kB - -
@sentry/sveltekit (client) 46.37 kB - -
@sentry/core/server 77.54 kB - -
@sentry/core/browser 63.88 kB - -
@sentry/node-core 61.51 kB -0.01% -1 B 🔽
@sentry/node 123.56 kB +0.07% +80 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.4 kB - -
@sentry/node - without tracing 73.61 kB -0.01% -1 B 🔽
@sentry/aws-serverless 84.4 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 180.31 kB - -
@sentry/cloudflare (withSentry) 446.24 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

* integration's `name` (they share a name by design, so de-duplication swaps
* one for the other).
*/
export const CHANNEL_INTEGRATION_FACTORIES = {

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.

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