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 an http.client span, 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://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
query and transaction on the neon() function. NeonQueryPromise is lazy, and transaction() reads its queryData without running it, so wrap execute, not the query call. Otherwise batched queries get spans twice.
- WebSocket: wrap
Client.prototype.query, as the pg instrumentation does.
Userland version of the HTTP part, tested with Drizzle in a Next.js app: https://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.
Problem Statement
pgandpostgresqueries getdbspans automatically (#8117). Queries through@neondatabase/serverlessdo not, so Neon apps, including Drizzle onneon-httporneon-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
pgand imports no outside modules (CJS or ESM), so thepginstrumentation never sees it.Repro (runs
select 1withpgas the control): https://gist.github.com/sergical/debe1601f4e952f1a8605a8649c7b6ce#file-repro-cjsSolution Brainstorm
A
neonIntegrationwith the same span shape aspostgresJsIntegration: opdb,db.system.name: postgres,db.query.text,db.query.summary,db.operation.name,server.address,db.namespace.queryandtransactionon theneon()function.NeonQueryPromiseis lazy, andtransaction()reads itsqueryDatawithout running it, so wrapexecute, not thequerycall. Otherwise batched queries get spans twice.Client.prototype.query, as thepginstrumentation does.Userland version of the HTTP part, tested with Drizzle in a Next.js app: https://gist.github.com/sergical/debe1601f4e952f1a8605a8649c7b6ce#file-traced-neon-ts
Additional Context
@sentry/node11.4.0,@neondatabase/serverless1.1.0,pg8, Node 24.Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it.