Sha256: 8cc08b5261110d6ee1013db6304d5f2b63d674237e2d5924ccedc25ee0d039bd

Contents?: true

Size: 732 Bytes

Versions: 10

Compression:

Stored size: 732 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  module Activators
    class Redis < Activator
      def can_instrument?
        defined?(::Redis) && defined?(::Redis::Client) && ::Instana.config[:redis][:enabled] &&
          (Gem::Specification.find_by_name('redis').version < Gem::Version.new('5.0') || defined?(::RedisClient))
      end

      def instrument
        require 'instana/instrumentation/redis'

        if Gem::Specification.find_by_name('redis').version >= Gem::Version.new('5.0')
          ::RedisClient.prepend(::Instana::RedisInstrumentation)
        else
          ::Redis::Client.prepend(::Instana::RedisInstrumentation)
        end

        true
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
instana-1.217.1 lib/instana/activators/redis.rb
instana-1.217.0 lib/instana/activators/redis.rb
instana-1.216.0 lib/instana/activators/redis.rb
instana-1.215.1 lib/instana/activators/redis.rb
instana-1.215.0 lib/instana/activators/redis.rb
instana-1.214.4 lib/instana/activators/redis.rb
instana-1.214.3 lib/instana/activators/redis.rb
instana-1.214.2 lib/instana/activators/redis.rb
instana-1.214.1 lib/instana/activators/redis.rb
instana-1.214.0 lib/instana/activators/redis.rb