lib/opentelemetry/instrumentation/redis/instrumentation.rb in opentelemetry-instrumentation-redis-0.23.0 vs lib/opentelemetry/instrumentation/redis/instrumentation.rb in opentelemetry-instrumentation-redis-0.24.0

- old
+ new

@@ -14,24 +14,26 @@ require_dependencies patch_client end present do - defined?(::Redis) + defined?(::Redis) || defined?(::RedisClient) end option :peer_service, default: nil, validate: :string option :trace_root_spans, default: true, validate: :boolean option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate] private def require_dependencies - require_relative 'patches/client' + require_relative 'patches/redis_v4_client' if defined?(::Redis) && ::Redis::VERSION < '5' + require_relative 'middlewares/redis_client' if defined?(::RedisClient) end def patch_client - ::Redis::Client.prepend(Patches::Client) + ::RedisClient.register(Middlewares::RedisClientInstrumentation) if defined?(::RedisClient) + ::Redis::Client.prepend(Patches::RedisV4Client) if defined?(::Redis) && ::Redis::VERSION < '5' end end end end end