Skip to content

Commit 56692c7

Browse files
committed
chore:instrumentation update
1 parent 741c5c6 commit 56692c7

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

packages/instrumentation-pg/src/instrumentation.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,12 @@ export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConf
339339
values: Array.isArray(args[1]) ? args[1] : undefined,
340340
}
341341
: firstArgIsQueryObjectWithText
342-
? (arg0 as utils.ObjectWithText)
342+
? {
343+
...(arg0 as any),
344+
values:
345+
(arg0 as any).values ??
346+
(Array.isArray(args[1]) ? args[1] : undefined),
347+
}
343348
: undefined;
344349

345350
const attributes: Attributes = {
@@ -360,21 +365,12 @@ export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConf
360365

361366
const instrumentationConfig = plugin.getConfig();
362367

363-
// Normalize the query configuration so that prepared statements with a separate
364-
// values array (query(config, values)) are correctly merged into one object.
365-
const normalizedQueryConfig =
366-
firstArgIsQueryObjectWithText &&
367-
Array.isArray(args[1]) &&
368-
queryConfig?.text
369-
? { ...queryConfig, values: args[1] }
370-
: queryConfig;
371-
372368
const span = utils.handleConfigQuery.call(
373369
this,
374370
plugin.tracer,
375371
instrumentationConfig,
376372
plugin._semconvStability,
377-
normalizedQueryConfig
373+
queryConfig
378374
);
379375

380376
// Modify query text w/ a tracing comment before invoking original for

0 commit comments

Comments
 (0)