From 3f0eeaf808dfe175c0dfa617063a29ca45f346d7 Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 4 Dec 2024 10:33:00 +0100 Subject: [PATCH 1/5] chore(instr-mysql2): update to mysql2@3.11.5 --- package-lock.json | 17 ++++++++--------- .../package.json | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index f50df50692..18f942de96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26284,11 +26284,10 @@ } }, "node_modules/mysql2": { - "version": "3.11.3", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.3.tgz", - "integrity": "sha512-Qpu2ADfbKzyLdwC/5d4W7+5Yz7yBzCU05YWt5npWzACST37wJsB23wgOSo00qi043urkiRwXtEvJc9UnuLX/MQ==", + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.5.tgz", + "integrity": "sha512-0XFu8rUmFN9vC0ME36iBvCUObftiMHItrYFhlCRvFWbLgpNqtC4Br/NmZX1HNCszxT0GGy5QtP+k3Q3eCJPaYA==", "dev": true, - "license": "MIT", "dependencies": { "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", @@ -37853,7 +37852,7 @@ "@types/mocha": "7.0.2", "@types/node": "18.18.14", "@types/semver": "7.5.8", - "mysql2": "3.11.3", + "mysql2": "3.11.5", "nyc": "15.1.0", "rimraf": "5.0.10", "semver": "7.6.3", @@ -48554,7 +48553,7 @@ "@types/mocha": "7.0.2", "@types/node": "18.18.14", "@types/semver": "7.5.8", - "mysql2": "3.11.3", + "mysql2": "3.11.5", "nyc": "15.1.0", "rimraf": "5.0.10", "semver": "7.6.3", @@ -63019,9 +63018,9 @@ } }, "mysql2": { - "version": "3.11.3", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.3.tgz", - "integrity": "sha512-Qpu2ADfbKzyLdwC/5d4W7+5Yz7yBzCU05YWt5npWzACST37wJsB23wgOSo00qi043urkiRwXtEvJc9UnuLX/MQ==", + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.5.tgz", + "integrity": "sha512-0XFu8rUmFN9vC0ME36iBvCUObftiMHItrYFhlCRvFWbLgpNqtC4Br/NmZX1HNCszxT0GGy5QtP+k3Q3eCJPaYA==", "dev": true, "requires": { "aws-ssl-profiles": "^1.1.1", diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/package.json b/plugins/node/opentelemetry-instrumentation-mysql2/package.json index dcf3806e56..20de228c25 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql2/package.json @@ -50,7 +50,7 @@ "@types/mocha": "7.0.2", "@types/node": "18.18.14", "@types/semver": "7.5.8", - "mysql2": "3.11.3", + "mysql2": "3.11.5", "nyc": "15.1.0", "rimraf": "5.0.10", "semver": "7.6.3", From f715adfacf79d3fabeb0715daef050a24869da2e Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 4 Dec 2024 10:40:44 +0100 Subject: [PATCH 2/5] fix(instr-mysql2): fix for mysql2@3.11.5 --- .../src/instrumentation.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts index 7557cf7a01..a7ab5d8f7d 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts @@ -55,8 +55,8 @@ export class MySQL2Instrumentation extends InstrumentationBase=1.4.2 <4'], (moduleExports: any) => { - const ConnectionPrototype: mysqlTypes.Connection = - moduleExports.Connection.prototype; + const ConnectionPrototype = this._getConnectionPrototype(moduleExports); + if (isWrapped(ConnectionPrototype.query)) { this._unwrap(ConnectionPrototype, 'query'); } @@ -210,4 +210,17 @@ export class MySQL2Instrumentation extends InstrumentationBase Date: Wed, 4 Dec 2024 10:50:29 +0100 Subject: [PATCH 3/5] fix(instr-mysql2): fix unwrap for mysql2@3.11.5 --- .../src/instrumentation.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts index a7ab5d8f7d..a07af19654 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts @@ -79,8 +79,7 @@ export class MySQL2Instrumentation extends InstrumentationBase { if (moduleExports === undefined) return; - const ConnectionPrototype: mysqlTypes.Connection = - moduleExports.Connection.prototype; + const ConnectionPrototype = this._getConnectionPrototype(moduleExports); this._unwrap(ConnectionPrototype, 'query'); this._unwrap(ConnectionPrototype, 'execute'); } From 226745426297e167fffa3080b45308a756076325 Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 4 Dec 2024 10:54:51 +0100 Subject: [PATCH 4/5] chore(instr-mysql2): fix lint issues --- .../src/instrumentation.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts index a07af19654..5c9f65dd58 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts @@ -55,7 +55,8 @@ export class MySQL2Instrumentation extends InstrumentationBase=1.4.2 <4'], (moduleExports: any) => { - const ConnectionPrototype = this._getConnectionPrototype(moduleExports); + const ConnectionPrototype = + this._getConnectionPrototype(moduleExports); if (isWrapped(ConnectionPrototype.query)) { this._unwrap(ConnectionPrototype, 'query'); @@ -79,7 +80,8 @@ export class MySQL2Instrumentation extends InstrumentationBase { if (moduleExports === undefined) return; - const ConnectionPrototype = this._getConnectionPrototype(moduleExports); + const ConnectionPrototype = + this._getConnectionPrototype(moduleExports); this._unwrap(ConnectionPrototype, 'query'); this._unwrap(ConnectionPrototype, 'execute'); } From b5b72ec09d8663bcf83db4e8f1b3ff8d34355554 Mon Sep 17 00:00:00 2001 From: David Luna Date: Wed, 4 Dec 2024 15:16:22 +0100 Subject: [PATCH 5/5] fix(instr-mysql2): fix how prototype is extracted --- .../src/instrumentation.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts index 5c9f65dd58..60983abeb1 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts @@ -215,13 +215,12 @@ export class MySQL2Instrumentation extends InstrumentationBase