Skip to content

Commit

Permalink
Refine the Redis method tracing to match memcache instrumentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleym1972 authored and Bill Kayser committed May 4, 2010
1 parent 73c84a7 commit 12cbca7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rpm_contrib/instrumentation/redis.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# == Redis Instrumentation
#

if defined?(::Redis) and not NewRelic::Control.instance['disable_redis']
if defined?(::Redis) and not NewRelic::Control.instance['disable_redis_instrumentation']

::Redis.class_eval do

include NewRelic::Agent::MethodTracer

def raw_call_command_with_newrelic_trace *args
self.class.trace_execution_scoped('Redis') do
# p "Instrumenting Redis Call!!!!:", args
method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
metrics = ["Redis/#{method_name}",
(NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction? ? 'Redis/allWeb' : 'Redis/allOther')]
self.class.trace_execution_scoped(metrics) do
# NewRelic::Control.instance.log.debug("Instrumenting Redis Call[#{method_name}]: #{args[0].inspect}")
raw_call_command_without_newrelic_trace(*args)
end
end
Expand Down

0 comments on commit 12cbca7

Please sign in to comment.