From 378f130befb2bd8be42d367b9db5ae9329d57b5e Mon Sep 17 00:00:00 2001 From: Osher Vaknin <81672378+osherv@users.noreply.github.com> Date: Wed, 21 Dec 2022 00:40:20 +0200 Subject: [PATCH] fix(redis-4): add support to new version of redis (#1324) * fix(redis-4): removed support for redis >4.5.1 (client >1.4.2) who breaks the CI) * fix(redis-4): added new wrap to MULTI function * fix(redis-4): added new wrap to MULTI function * fix(redis-4): fixed Amir's CR --- .../src/instrumentation.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/node/opentelemetry-instrumentation-redis-4/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-redis-4/src/instrumentation.ts index b4b229f66f..4bf503e6c4 100644 --- a/plugins/node/opentelemetry-instrumentation-redis-4/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-redis-4/src/instrumentation.ts @@ -175,6 +175,15 @@ export class RedisInstrumentation extends InstrumentationBase { this._getPatchRedisClientMulti() ); + if (isWrapped(redisClientPrototype?.MULTI)) { + this._unwrap(redisClientPrototype, 'MULTI'); + } + this._wrap( + redisClientPrototype, + 'MULTI', + this._getPatchRedisClientMulti() + ); + if (isWrapped(redisClientPrototype?.sendCommand)) { this._unwrap(redisClientPrototype, 'sendCommand'); } @@ -198,6 +207,9 @@ export class RedisInstrumentation extends InstrumentationBase { if (isWrapped(redisClientPrototype?.multi)) { this._unwrap(redisClientPrototype, 'multi'); } + if (isWrapped(redisClientPrototype?.MULTI)) { + this._unwrap(redisClientPrototype, 'MULTI'); + } if (isWrapped(redisClientPrototype?.sendCommand)) { this._unwrap(redisClientPrototype, 'sendCommand'); }