Skip to content

Commit 4dfc927

Browse files
committed
Disable and enable instrumentation on create.
1 parent 76cefbb commit 4dfc927

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ describe('pg-pool', () => {
114114
function create(config: PgInstrumentationConfig = {}) {
115115
instrumentation.setConfig(config);
116116
instrumentation.enable();
117+
118+
// Disable and enable the instrumentation to visit unwrap calls
119+
instrumentation.disable();
120+
instrumentation.enable();
117121
}
118122

119123
let pool: pgPool<pg.Client>;
@@ -540,7 +544,7 @@ describe('pg-pool', () => {
540544
);
541545
assert.strictEqual(
542546
metrics[1].dataPoints[0].attributes[
543-
ATTR_DB_CLIENT_CONNECTION_STATE
547+
ATTR_DB_CLIENT_CONNECTION_STATE
544548
],
545549
'used'
546550
);
@@ -551,7 +555,7 @@ describe('pg-pool', () => {
551555
);
552556
assert.strictEqual(
553557
metrics[1].dataPoints[1].attributes[
554-
ATTR_DB_CLIENT_CONNECTION_STATE
558+
ATTR_DB_CLIENT_CONNECTION_STATE
555559
],
556560
'idle'
557561
);
@@ -764,7 +768,7 @@ describe('pg-pool', () => {
764768
);
765769
assert.strictEqual(
766770
metrics[1].dataPoints[0].attributes[
767-
ATTR_DB_CLIENT_CONNECTION_STATE
771+
ATTR_DB_CLIENT_CONNECTION_STATE
768772
],
769773
'used'
770774
);

plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ describe('pg', () => {
108108
function create(config: PgInstrumentationConfig = {}) {
109109
instrumentation.setConfig(config);
110110
instrumentation.enable();
111+
112+
// Disable and enable the instrumentation to visit unwrap calls
113+
instrumentation.disable();
114+
instrumentation.enable();
111115
}
112116

113117
let postgres: typeof pg;

0 commit comments

Comments
 (0)