class Skylight::Core::Probes::Redis::Probe

Constants

MULTI_OPTS
PIPELINED_OPTS

Unfortunately, because of the nature of pipelining, there's no way for us to give a time breakdown on the individual items.

Public Instance Methods

call(command, &block) click to toggle source
# File lib/skylight/core/probes/redis.rb, line 18
def call(command, &block)
  command_name = command[0]

  return call_without_sk(command, &block) if command_name == :auth

  opts = {
    category: "db.redis.command",
    title:    command_name.upcase.to_s
  }

  Skylight::Core::Fanout.instrument(opts) do
    call_without_sk(command, &block)
  end
end
install() click to toggle source
# File lib/skylight/core/probes/redis.rb, line 5
def install
  version = defined?(::Redis::VERSION) ? Gem::Version.new(::Redis::VERSION) : nil

  if !version || version < Gem::Version.new("3.0.0")
    # Using $stderr here isn't great, but we don't have a logger accessible
    $stderr.puts "[SKYLIGHT::CORE] [#{Skylight::Core::VERSION}] The installed version of Redis doesn't " \
                  "support Middlewares. At least version 3.0.0 is required."
    return
  end

  ::Redis::Client.class_eval do
    alias_method :call_without_sk, :call

    def call(command, &block)
      command_name = command[0]

      return call_without_sk(command, &block) if command_name == :auth

      opts = {
        category: "db.redis.command",
        title:    command_name.upcase.to_s
      }

      Skylight::Core::Fanout.instrument(opts) do
        call_without_sk(command, &block)
      end
    end
  end
end
multi(&block) click to toggle source
# File lib/skylight/core/probes/redis.rb, line 59
def multi(&block)
  Skylight::Core::Fanout.instrument(MULTI_OPTS) do
    multi_without_sk(&block)
  end
end
pipelined(&block) click to toggle source
# File lib/skylight/core/probes/redis.rb, line 51
def pipelined(&block)
  Skylight::Core::Fanout.instrument(PIPELINED_OPTS) do
    pipelined_without_sk(&block)
  end
end