From 610d38517187b6ba3b7fe0601b16cc3ecb8ce901 Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Wed, 9 Apr 2014 04:33:02 -0500 Subject: [PATCH] skylight: Add Redis probe --- config.ru | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/config.ru b/config.ru index c617e0ca..a1ed6919 100644 --- a/config.ru +++ b/config.ru @@ -57,6 +57,31 @@ if ENV['SKYLIGHT_APPLICATION'] end 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) use Skylight::Middleware