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.62 kB - -
@sentry/browser - with treeshaking flags 26.05 kB - -
@sentry/browser (incl. Tracing) 46.07 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.82 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.84 kB - -
@sentry/browser (incl. Tracing, Replay) 85.31 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.91 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.99 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.67 kB - -
@sentry/browser (incl. Feedback) 44.8 kB - -
@sentry/browser (incl. sendFeedback) 32.42 kB - -
@sentry/browser (incl. FeedbackAsync) 37.55 kB - -
@sentry/browser (incl. Metrics) 28.68 kB - -
@sentry/browser (incl. Logs) 28.93 kB - -
@sentry/browser (incl. Metrics & Logs) 29.61 kB - -
@sentry/react 29.41 kB - -
@sentry/react (incl. Tracing) 48.38 kB - -
@sentry/vue 32.85 kB - -
@sentry/vue (incl. Tracing) 47.93 kB - -
@sentry/svelte 27.64 kB - -
CDN Bundle 30.02 kB - -
CDN Bundle (incl. Tracing) 48.02 kB - -
CDN Bundle (incl. Logs, Metrics) 31.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.35 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.79 kB - -
CDN Bundle (incl. Tracing, Replay) 85.51 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.79 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.32 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.56 kB - -
CDN Bundle - uncompressed 89.42 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.35 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.12 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.32 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.66 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.36 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.32 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.06 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.01 kB - -
@sentry/nextjs (client) 50.76 kB - -
@sentry/sveltekit (client) 46.46 kB - -
@sentry/core/server 77.75 kB - -
@sentry/core/browser 64.06 kB - -
@sentry/node-core 61.47 kB - -
@sentry/node 123 kB +0.07% +77 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.45 kB - -
@sentry/node - without tracing 73.2 kB - -
@sentry/aws-serverless 84.09 kB -0.01% -1 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

* 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.

@isaacs isaacs force-pushed the isaacs/pg-orchestrion branch from dfe74f5 to 373c014 Compare June 30, 2026 23:45
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 f53b1bc to 17bb086 Compare July 1, 2026 04:42
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