newrelic-redis 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,10 +5,6 @@ require 'redis'
5
5
  # Originally contributed by Ashley Martens of ngmoco
6
6
  # Rewritten, reorganized, and repackaged by Evan Phoenix
7
7
 
8
- # defined?(::Redis) && !NewRelic::Control.instance['disable_redis']
9
-
10
- NewRelic::Agent.logger.debug 'Installing Redis instrumentation'
11
-
12
8
  ::Redis::Client.class_eval do
13
9
 
14
10
  include NewRelic::Agent::MethodTracer
@@ -19,27 +15,27 @@ NewRelic::Agent.logger.debug 'Installing Redis instrumentation'
19
15
  call_method =
20
16
  ::Redis::Client.new.respond_to?(:call) ? :call : :raw_call_command
21
17
 
22
- def call_with_newrelic_trace(*args)
23
- if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
24
- total_metric = 'Database/Redis/allWeb'
25
- else
26
- total_metric = 'Database/Redis/allOther'
27
- end
18
+ def call_with_newrelic_trace(*args)
19
+ if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
20
+ total_metric = 'Database/Redis/allWeb'
21
+ else
22
+ total_metric = 'Database/Redis/allOther'
23
+ end
28
24
 
29
- method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
30
- metrics = ["Database/Redis/#{method_name.to_s.upcase}", total_metric]
25
+ method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
26
+ metrics = ["Database/Redis/#{method_name.to_s.upcase}", total_metric]
31
27
 
32
- self.class.trace_execution_scoped(metrics) do
33
- start = Time.now
28
+ self.class.trace_execution_scoped(metrics) do
29
+ start = Time.now
34
30
 
35
- begin
36
- call_without_newrelic_trace(*args)
37
- ensure
38
- s = NewRelic::Agent.instance.transaction_sampler
39
- s.notice_nosql(args.inspect, (Time.now - start).to_f) rescue nil
40
- end
31
+ begin
32
+ call_without_newrelic_trace(*args)
33
+ ensure
34
+ s = NewRelic::Agent.instance.transaction_sampler
35
+ s.notice_nosql(args.inspect, (Time.now - start).to_f) rescue nil
41
36
  end
42
37
  end
38
+ end
43
39
 
44
40
  alias_method :call_without_newrelic_trace, call_method
45
41
  alias_method call_method, :call_with_newrelic_trace
@@ -1,3 +1,3 @@
1
1
  class NewRelicRedis
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic-redis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Phoenix
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-09 00:00:00 Z
18
+ date: 2012-03-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: redis
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements: []
131
131
 
132
132
  rubyforge_project: newrelic-redis
133
- rubygems_version: 1.8.17
133
+ rubygems_version: 1.8.18
134
134
  signing_key:
135
135
  specification_version: 3
136
136
  summary: Redis instrumentation for Newrelic.