skylight: Add Redis probe
This commit is contained in:
parent
749ee8b943
commit
610d385171
25
config.ru
25
config.ru
|
@ -57,6 +57,31 @@ if ENV['SKYLIGHT_APPLICATION']
|
||||||
end
|
end
|
||||||
Skylight::Probes.register("Dalli::Client", "dalli", DalliProbe.new)
|
Skylight::Probes.register("Dalli::Client", "dalli", DalliProbe.new)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
Skylight.start!(config)
|
Skylight.start!(config)
|
||||||
|
|
||||||
use Skylight::Middleware
|
use Skylight::Middleware
|
||||||
|
|
Loading…
Reference in New Issue
Block a user