From 88b4474f17b5d5d5d2a736fdf810548a4bd2eedf Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 4 Dec 2024 16:02:56 +0100 Subject: [PATCH] fix: check existence of functions on prototype instead --- plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts index 43cbb0723e..5250996731 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts @@ -155,7 +155,8 @@ export function getConnectionPrototypeToInstrument(connection: any) { // so we need to instrument that instead, see https://github.com/sidorares/node-mysql2/pull/3081 // This checks if the functions we're instrumenting are there on the base - we cannot use the presence of a base // prototype since EventEmitter is the base for mysql2@<=3.11.4 - if (typeof basePrototype?.query === 'function' && typeof basePrototype?.execute === 'function') { + if (typeof basePrototype?.query === 'function' + && typeof basePrototype?.execute === 'function') { return basePrototype; }