Skip to content

feat(node): Add neonIntegration for @neondatabase/serverless - #25164

Merged
chargome merged 1 commit into
feat/neon-orchestrion-configfrom
feat/neon-integration
Oct 9, 2026
Merged

chargome merged 1 commit into
feat/neon-orchestrion-configfrom
feat/neon-integration

Conversation

@chargome

@chargome chargome commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Adds neonIntegration for @neondatabase/serverless. Both drivers emit db spans with the pg span shape: the WebSocket Client/Pool and the HTTP neon() function, including Drizzle's neon-http and neon-serverless adapters.

Subscribes to the channels from #25176 and registers the config, so build-time bundler plugins get the same coverage as the runtime hook.

  • The HTTP span wraps the executor inside neon(), not the lazy query promise, so transaction() batches get one span instead of one per statement plus one for the batch.
  • Connection attributes for HTTP come from the connection resolver, which runs inside the query span. The executor itself never sees the connection string.
  • db.connection_string is deprecated and not emitted.

End-to-end tests follow in #25177.

Stacked on #25176.

Fixes #25144

@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

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

Stale Bugbot comment from a previous run.

Comment thread packages/server-utils/test/integrations/neon.test.ts
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.8 kB - -
@sentry/browser - with treeshaking flags 27.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.84 kB - -
@sentry/browser (incl. Tracing) 51.85 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.87 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.8 kB - -
@sentry/browser (incl. Tracing, Replay) 91.58 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.45 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.29 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.27 kB - -
@sentry/browser (incl. Feedback) 47.32 kB - -
@sentry/browser (incl. sendFeedback) 34.84 kB - -
@sentry/browser (incl. FeedbackAsync) 39.95 kB - -
@sentry/browser (incl. Metrics) 30.82 kB - -
@sentry/browser (incl. Logs) 31.11 kB - -
@sentry/browser (incl. Metrics & Logs) 31.75 kB - -
@sentry/react 31.63 kB - -
@sentry/react (incl. Tracing) 54.17 kB - -
@sentry/vue 37.84 kB - -
@sentry/vue (incl. Tracing) 54.78 kB - -
@sentry/svelte 29.83 kB - -
@sentry/remix (Remix 3 client bundle) 56.83 kB - -
CDN Bundle 31.53 kB - -
CDN Bundle (incl. Tracing) 52.34 kB - -
CDN Bundle (incl. Logs, Metrics) 33.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.3 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.65 kB - -
CDN Bundle (incl. Tracing, Replay) 90.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.15 kB - -
CDN Bundle - uncompressed 92.92 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.46 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.41 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.5 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.63 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.26 kB - -
@sentry/nextjs (client) 56.53 kB - -
@sentry/sveltekit (client) 52.23 kB - -
@sentry/core/server 40.86 kB - -
@sentry/core/browser 13.71 kB - -
@sentry/node 151.63 kB +0.44% +650 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.77 kB +0.23% +185 B 🔺
@sentry/node - without tracing 94.2 kB +0.21% +197 B 🔺
@sentry/node - without channel injection 129.8 kB +0.51% +656 B 🔺
@sentry/aws-serverless 102.37 kB +0.2% +201 B 🔺
@sentry/cloudflare (withSentry) - minified 209.81 kB - -
@sentry/cloudflare (withSentry) 520.23 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 227.48 kB - -

View base workflow run

@chargome
chargome force-pushed the feat/neon-integration branch from 9b1cb9f to 01f61fd Compare October 8, 2026 09:37
@chargome
chargome force-pushed the feat/neon-integration branch from 01f61fd to 66187ed Compare October 8, 2026 09:40
@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

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

Stale Bugbot comment from a previous run.

Comment thread packages/server-utils/src/integrations/neon.ts
@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

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

Stale Bugbot comment from a previous run.

@chargome
chargome force-pushed the feat/neon-integration branch from dcb4fab to d738c1b Compare October 8, 2026 11:22
@chargome
chargome removed this pull request from stack #25166 October 8, 2026 11:23
@chargome
chargome changed the base branch from feat/pg-export-query-span-helpers to feat/neon-orchestrion-config October 8, 2026 11:23
@chargome
chargome added this pull request to stack #25178 October 8, 2026 11:23
@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d738c1b. Configure here.

@chargome
chargome marked this pull request as ready for review October 8, 2026 15:06
@chargome
chargome requested review from a team as code owners October 8, 2026 15:06
@chargome
chargome requested review from mydea, nicohrubec and s1gr1d and removed request for a team October 8, 2026 15:06

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

Overall LGTM. Got couple of nits

Comment thread packages/server-utils/src/integrations/neon.ts Outdated
Comment thread packages/server-utils/src/integrations/neon.ts
Comment thread packages/server-utils/src/integrations/neon.ts Outdated
Comment thread packages/server-utils/src/integrations/neon.ts Outdated
@chargome
chargome force-pushed the feat/neon-integration branch from d738c1b to 81fb7e1 Compare October 9, 2026 09:55
Queries through the Neon serverless driver produced no db spans: the package
bundles its own pg, so the pg instrumentation never sees it, and the HTTP
driver only showed an http.client span without SQL.

Subscribes to the orchestrion channels from the Neon config and registers
it, so build-time bundler plugins get the same coverage as the runtime
hook. The WebSocket driver reuses the pg query span builder. The HTTP
executor inside neon() gets one span per request, covering sql.query(),
tagged templates and transaction() batches without double counting lazy
query promises. Connection attributes for HTTP come from the resolver
call that runs inside that span.

Fixes #25144
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome
chargome force-pushed the feat/neon-integration branch from 81fb7e1 to cd4d0a3 Compare October 9, 2026 10:08
@chargome
chargome merged commit 9f8f848 into develop Oct 9, 2026
540 of 545 checks passed
@chargome
chargome deleted the feat/neon-integration branch October 9, 2026 10:41
chargome added a commit that referenced this pull request Oct 9, 2026
Exports the pg query-channel binding, the connection attribute builder
and `PgConnectionParams` so a driver that bundles its own copy of pg can
emit the same span shape. The Neon integration in #25164 is the first
consumer.

The deprecated `db.connection_string` attribute moves behind an opt-in.
Only the pg integration sets it, for parity with its OTel predecessor,
so new callers describe the connection with `server.address` and
`server.port` alone. No behavior change for pg.

Refs #25144

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
chargome added a commit that referenced this pull request Oct 9, 2026
…erless (#25176)

Adds the orchestrion config for `@neondatabase/serverless`, so the
bundler plugins and the runtime hook can inject channels into it. The
integration that subscribes to those channels follows in #25164 and
registers the config there, which keeps every layer's CI green on its
own.

The package ships two minified esbuild bundles with mangled identifiers
that differ between CJS and ESM, so the name-based matchers find
nothing. The selectors key on property names and string literals that
survive minification: pg's `_pulseQueryQueue` sibling method for
`Client.prototype.query`, the `Neon-Connection-String` header literal
for the HTTP executor, and the `resolvedURL` return shape for the
connection resolver.

`@neondatabase/serverless` becomes a dev dependency of server-utils for
a test that transforms and executes the published bundles, so a Neon
release that reshapes them fails CI. The version range is capped at
`<2`.

Stacked on #25163.

Refs #25144

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
chargome added a commit that referenced this pull request Oct 9, 2026
)

Runs both Neon drivers end to end against Neon's own proxy
(`ghcr.io/timowilhelm/local-neon-http-proxy`) in front of a local
Postgres, so the HTTP `/sql` and WebSocket `/v2` wire protocols are the
real ones. Covers `sql.query()`, tagged templates, `transaction()`
batches, a failing statement and pool queries, in ESM and CJS under the
default span lifecycle.

The suite is excluded on Bun like the other database suites, since `bun
run` cannot inject the diagnostics channels; the Bun plugin build does
run it. The pool test is Node only, because on Bun and Deno the pool's
connect callback runs outside the segment's async context. `ws` is added
because Node 20 has no global `WebSocket`.

Stacked on #25164.

Refs #25144

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.

Add Queries support for the Neon serverless driver (@neondatabase/serverless)

2 participants