File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed
packages/instrumentation-pg/src Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -333,21 +333,24 @@ export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConf
333333 // TODO: remove the `as ...` casts below when the TS version is upgraded.
334334 // Newer TS versions will use the result of firstArgIsQueryObjectWithText
335335 // to properly narrow arg0, but TS 4.3.5 does not.
336- const queryConfig = firstArgIsString
337- ? {
338- text : arg0 as string ,
339- values : Array . isArray ( args [ 1 ] ) ? args [ 1 ] : undefined ,
340- }
341- : firstArgIsQueryObjectWithText
342- ? ( ( ) => {
343- const query = arg0 as any ;
344- // If the query object has no values yet, use the second argument as values
345- if ( query . values === undefined && Array . isArray ( args [ 1 ] ) ) {
346- query . values = args [ 1 ] ;
347- }
348- return query ;
349- } ) ( )
350- : undefined ;
336+ let queryConfig : any ;
337+
338+ if ( firstArgIsString ) {
339+ queryConfig = {
340+ text : arg0 as string ,
341+ values : Array . isArray ( args [ 1 ] ) ? args [ 1 ] : undefined ,
342+ } ;
343+ } else if ( firstArgIsQueryObjectWithText ) {
344+ const q = arg0 as any ;
345+
346+ if ( q . values === undefined && Array . isArray ( args [ 1 ] ) ) {
347+ q . values = args [ 1 ] ;
348+ }
349+
350+ queryConfig = q ;
351+ } else {
352+ queryConfig = undefined ;
353+ }
351354
352355 const attributes : Attributes = {
353356 [ ATTR_DB_SYSTEM ] : DB_SYSTEM_VALUE_POSTGRESQL ,
You can’t perform that action at this time.
0 commit comments