File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
plugins/node/opentelemetry-instrumentation-pg/src Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -152,11 +152,15 @@ export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConf
152152 'pg' ,
153153 SUPPORTED_PG_VERSIONS ,
154154 ( module : any ) => {
155- this . _patchPgClient ( module . Client ) ;
155+ const moduleExports = extractModuleExports ( module ) ;
156+
157+ this . _patchPgClient ( moduleExports . Client ) ;
156158 return module ;
157159 } ,
158160 ( module : any ) => {
159- this . _unpatchPgClient ( module . Client ) ;
161+ const moduleExports = extractModuleExports ( module ) ;
162+
163+ this . _unpatchPgClient ( moduleExports . Client ) ;
160164 return module ;
161165 } ,
162166 [ modulePgClient , modulePgNativeClient ]
@@ -187,6 +191,10 @@ export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConf
187191 }
188192
189193 private _patchPgClient ( module : any ) {
194+ if ( ! module ) {
195+ return ;
196+ }
197+
190198 const moduleExports = extractModuleExports ( module ) ;
191199
192200 if ( isWrapped ( moduleExports . prototype . query ) ) {
You can’t perform that action at this time.
0 commit comments