Sha256: e45dafcfd35f41456f964ec116311eb577f9b91d02086d6ca2a54862abe0888c
Contents?: true
Size: 1.04 KB
Versions: 38
Compression:
Stored size: 1.04 KB
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) appendable = RorVsWild::Plugin::Redis.appendable_commands?(commands) RorVsWild.agent.measure_section(string, appendable_command: appendable, kind: "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 *****".freeze : c.join(" ".freeze) }.join("\n".freeze) end APPENDABLE_COMMANDS = [:auth, :select] def self.appendable_commands?(commands) commands.size == 1 && APPENDABLE_COMMANDS.include?(commands.first.first) end end end end
Version data entries
38 entries across 38 versions & 1 rubygems