Sha256: 9fbfc4f4e9bd0bc72a65c0ebad304cca66fadc8677b315305f03fbd74f285d50

Contents?: true

Size: 755 Bytes

Versions: 19

Compression:

Stored size: 755 Bytes

Contents

module Appsignal
  class Hooks
    # @api private
    class RedisHook < Appsignal::Hooks::Hook
      register :redis

      def dependencies_present?
        defined?(::Redis) &&
          Appsignal.config &&
          Appsignal.config[:instrument_redis]
      end

      def install
        ::Redis::Client.class_eval do
          alias process_without_appsignal process

          def process(commands, &block)
            sanitized_commands = commands.map do |command, *args|
              "#{command}#{" ?" * args.size}"
            end.join("\n")

            Appsignal.instrument "query.redis", id, sanitized_commands do
              process_without_appsignal(commands, &block)
            end
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
appsignal-2.5.3-java lib/appsignal/hooks/redis.rb
appsignal-2.5.3 lib/appsignal/hooks/redis.rb
appsignal-2.5.3.alpha.2 lib/appsignal/hooks/redis.rb
appsignal-2.5.3.alpha.2-java lib/appsignal/hooks/redis.rb
appsignal-2.5.3.alpha.1 lib/appsignal/hooks/redis.rb
appsignal-2.5.3.alpha.1-java lib/appsignal/hooks/redis.rb
appsignal-2.5.2-java lib/appsignal/hooks/redis.rb
appsignal-2.5.2 lib/appsignal/hooks/redis.rb
appsignal-2.5.1-java lib/appsignal/hooks/redis.rb
appsignal-2.5.1 lib/appsignal/hooks/redis.rb
appsignal-2.5.1.beta.1-java lib/appsignal/hooks/redis.rb
appsignal-2.5.1.beta.1 lib/appsignal/hooks/redis.rb
appsignal-2.5.0-java lib/appsignal/hooks/redis.rb
appsignal-2.5.0 lib/appsignal/hooks/redis.rb
appsignal-2.5.0.beta.1-java lib/appsignal/hooks/redis.rb
appsignal-2.5.0.beta.1 lib/appsignal/hooks/redis.rb
appsignal-2.5.0.alpha.1-java lib/appsignal/hooks/redis.rb
appsignal-2.5.0.alpha.1 lib/appsignal/hooks/redis.rb
appsignal-2.4.3 lib/appsignal/hooks/redis.rb