travis-api/lib/travis/api/app/skylight/redis_probe.rb
2014-04-09 14:34:20 -05:00

32 lines
748 B
Ruby

require 'skylight'
require 'travis/api/app'
class Travis::Api::App
module Skylight
class RedisProbe
def install
::Redis::Client.class_eval do
alias call_without_sk call
def call(command_parts, &block)
command = command_parts[0].upcase
opts = {
category: "api.redis.#{command.downcase}",
title: "Redis #{command}",
annotations: {
command: command.to_s
}
}
::Skylight.instrument(opts) do
call_without_sk(command_parts, &block)
end
end
end
end
end
::Skylight::Probes.register("Redis", "redis", RedisProbe.new)
end
end