Open
Description
What version of OpenTelemetry are you using?
"@opentelemetry/api": "1.9.0",
"@opentelemetry/core": "1.30.1",
"@opentelemetry/instrumentation": "0.57.2",
"@opentelemetry/instrumentation-pg": "0.51.1",
"@opentelemetry/sdk-node": "0.57.2",
"@opentelemetry/semantic-conventions": "1.28.0"
What version of Node are you using?
Node.js v22.14.0
What did you do?
I setup opentelemetry node sdk to instrument a web app with postgresql. I'm using typescript compiled to ES-modules. I'm importing directly from pg-pool with import Pool from "pg-pool"
.
What did you expect to see?
Application running.
What did you see instead?
With OTEL_LOG_LEVEL enabled:
@opentelemetry/instrumentation-pg Applying instrumentation patch for module on require hook {
module: 'pg-pool',
version: '3.8.0',
baseDir: '/…/app/node_modules/pg-pool'
}
/…/app/node_modules/@opentelemetry/instrumentation-pg/build/src/instrumentation.js:88
if ((0, instrumentation_1.isWrapped)(moduleExports.prototype.connect)) {
^
TypeError: Cannot read properties of undefined (reading 'connect')
at InstrumentationNodeModuleDefinition.patch (/…/app/node_modules/@opentelemetry/instrumentation-pg/build/src/instrumentation.js:88:74)
at PgInstrumentation._onRequire (/…/app/node_modules/@opentelemetry/instrumentation/build/src/platform/node/instrumentation.js:164:39)
at hookFn (/…/app/node_modules/@opentelemetry/instrumentation/build/src/platform/node/instrumentation.js:227:29)
at callHookFn (/…/app/node_modules/import-in-the-middle/index.js:29:22)
at Hook._iitmHook (/…/app/node_modules/import-in-the-middle/index.js:150:11)
at /…/app/node_modules/import-in-the-middle/lib/register.js:42:31
at Array.forEach (<anonymous>)
at register (/…/app/node_modules/import-in-the-middle/lib/register.js:42:15)
at file:///…/app/node_modules/pg-pool/index.js?iitm=true:25:1
at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
Node.js v22.14.0
Process finished with exit code 1
Additional context
This looks exactly like #1693 that was fixed by #1701 for PG, but not for pg-pool.