Skip to content

Commit 548d8fb

Browse files
maryliagtrentm
andauthored
Update packages/instrumentation-pg/test/pg-pool.test.ts
Co-authored-by: Trent Mick <[email protected]>
1 parent 4b6d20c commit 548d8fb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/instrumentation-pg/test/pg-pool.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,10 @@ describe('pg semantic conventions env variable', () => {
991991
const testPostgres = process.env.RUN_POSTGRES_TESTS; // For CI: assumes local postgres db is already available
992992
const testPostgresLocally = process.env.RUN_POSTGRES_TESTS_LOCAL; // For local: spins up local postgres db via docker
993993
const shouldTest = testPostgres || testPostgresLocally; // Skips these tests if false (default)
994+
// Here we are `require`ing *before* the instrumentation is created below.
995+
// In *general* this is a potential instrumentation issue, but this works for
996+
// `pg-pool` instrumentation because it patches the `pgPool.prototype`
997+
// (i.e. not a top-level export).
994998
const pgPool = require('pg-pool');
995999
pool = new pgPool(CONFIG);
9961000

0 commit comments

Comments
 (0)