Sha256: 06d6685975aa10eef49608f7574ef60011c395049f117e77135a6aecae99636a

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

module RorVsWild
  module Plugin
    class Redis
      def self.setup
        return if !defined?(::Redis)
        return if ::Redis::Client.method_defined?(:process_without_rorvswild)
        ::Redis::Client.class_eval do
          alias_method :process_without_rorvswild, :process

          def process(commands, &block)
            string = RorVsWild::Plugin::Redis.commands_to_string(commands)
            RorVsWild.agent.measure_section(string, "redis".freeze) do
              process_without_rorvswild(commands, &block)
            end
          end
        end
      end

      def self.commands_to_string(commands)
        commands.map { |c| c[0] == :auth ? "auth *****" : c.join(" ".freeze) }.join("\n".freeze)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rorvswild-1.0.0.pre.alpha3 lib/rorvswild/plugin/redis.rb