Add Queries support for the Neon serverless driver (@neondatabase/serverless) #25144
Description
Problem Statement
pg and postgres queries get db spans automatically (#8117). Queries through @neondatabase/serverless do not, so Neon apps, including Drizzle on neon-http or neon-serverless, show nothing in Queries Insights:
neon()(HTTP): only anhttp.clientspan,POST api.<region>.aws.neon.tech, with no SQL.Pool/Client(WebSocket): no span at all.
The package bundles its own copy of pg and imports no outside modules (CJS or ESM), so the pg instrumentation never sees it.
Repro (runs select 1 with pg as the control): https://github.com/proxy/gist.github.com/sergical/debe1601f4e952f1a8605a8649c7b6ce#file-repro-cjs
Solution Brainstorm
A neonIntegration with the same span shape as postgresJsIntegration: op db, db.system.name: postgres, db.query.text, db.query.summary, db.operation.name, server.address, db.namespace.
- HTTP: wrap
queryandtransactionon theneon()function.NeonQueryPromiseis lazy, andtransaction()reads itsqueryDatawithout running it, so wrapexecute, not thequerycall. Otherwise batched queries get spans twice. - WebSocket: wrap
Client.prototype.query, as thepginstrumentation does.
Userland version of the HTTP part, tested with Drizzle in a Next.js app: https://github.com/proxy/gist.github.com/sergical/debe1601f4e952f1a8605a8649c7b6ce#file-traced-neon-ts
Additional Context
@sentry/node 11.4.0, @neondatabase/serverless 1.1.0, pg 8, Node 24.
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Oct 7, 2026
JS-3890
test(node): Add integration tests for the Neon serverless driver
test(node): Add integration tests for the Neon serverless driver
test(node): Add integration tests for the Neon serverless driver
test(node): Add integration tests for the Neon serverless driver
test(node): Add integration tests for the Neon serverless driver
test(node): Add integration tests for the Neon serverless driver
test(node): Add integration tests for the Neon serverless driver
ref(server-utils): Export the pg query span helpers (#25163)
feat(server-utils): Add the orchestrion config for @neondatabase/serv…
feat(node): Add neonIntegration for @neondatabase/serverless (#25164)
test(node): Add integration tests for the Neon serverless driver (#25177
github-actions commentedon Oct 12, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #25164, which was included in the 11.7.0 release.