rpm_contrib 1.0.10 → 1.0.11

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ * Version 1.0.11
2
+
3
+ AWS/S3 instrumentation contributed by Brian Doll
4
+ Cassandra instrumentation contributed by Ashley Martens
5
+ Updated Redis instrumentation for 1.x and 2.x contributed by Karl Baum
6
+
1
7
  * Version 1.0.10
2
8
 
3
9
  Mongoid support contributed by Karl Baum
data/Rakefile CHANGED
@@ -57,7 +57,7 @@ rescue LoadError
57
57
  end
58
58
  end
59
59
 
60
- task :test => :check_dependencies
60
+ #task :test => :check_dependencies
61
61
 
62
62
  task :default => :test
63
63
 
@@ -0,0 +1,56 @@
1
+ # Instrumentation for the AWS-S3 gem for New Relic RPM by Brian Doll
2
+ if defined?(::AWS::S3) && !NewRelic::Control.instance['disable_aws-s3']
3
+
4
+ # Instrument connections to the AWS-S3 service
5
+ ::AWS::S3::Connection::Management::ClassMethods.module_eval do
6
+ add_method_tracer :establish_connection!, 'AWS-S3/establish_connection!'
7
+ end
8
+
9
+ # Instrument methods on Bucket
10
+ ::AWS::S3::Bucket.instance_eval do
11
+ class << self
12
+ add_method_tracer :create, 'AWS-S3/Bucket/create'
13
+ add_method_tracer :find, 'AWS-S3/Bucket/find'
14
+ add_method_tracer :objects, 'AWS-S3/Bucket/objects'
15
+ add_method_tracer :delete, 'AWS-S3/Bucket/delete'
16
+ add_method_tracer :list, 'AWS-S3/Bucket/list'
17
+ end
18
+ end
19
+
20
+ # Instrument methods on Bucket instances
21
+ ::AWS::S3::Bucket.class_eval do
22
+ add_method_tracer :[], 'AWS-S3/Bucket/#{self.name}/[]'
23
+ add_method_tracer :new_object,'AWS-S3/Bucket/#{self.name}/new_objects'
24
+ add_method_tracer :objects, 'AWS-S3/Bucket/#{self.name}/objects'
25
+ add_method_tracer :delete, 'AWS-S3/Bucket/#{self.name}/delete'
26
+ add_method_tracer :delete_all,'AWS-S3/Bucket/#{self.name}/delete_all'
27
+ add_method_tracer :update, 'AWS-S3/Bucket/#{self.name}/update'
28
+ end
29
+
30
+ # Instrument methods on S3Object
31
+ ::AWS::S3::S3Object.instance_eval do
32
+ class << self
33
+ add_method_tracer :about, 'AWS-S3/S3Object/about'
34
+ add_method_tracer :copy, 'AWS-S3/S3Object/copy'
35
+ add_method_tracer :delete, 'AWS-S3/S3Object/delete'
36
+ add_method_tracer :rename, 'AWS-S3/S3Object/rename'
37
+ add_method_tracer :store, 'AWS-S3/S3Object/store'
38
+ end
39
+ end
40
+
41
+ # Instrument methods on S3Object instances
42
+ # Metric names are aggregated across all S3Objects since having a metric for
43
+ # every single S3Object instance and method pair would be fairly useless
44
+ ::AWS::S3::S3Object.class_eval do
45
+ add_method_tracer :value, 'AWS-S3/S3Objects/value'
46
+ add_method_tracer :about, 'AWS-S3/S3Objects/about'
47
+ add_method_tracer :metadata, 'AWS-S3/S3Objects/metadata'
48
+ add_method_tracer :store, 'AWS-S3/S3Objects/store'
49
+ add_method_tracer :delete, 'AWS-S3/S3Objects/delete'
50
+ add_method_tracer :copy, 'AWS-S3/S3Objects/copy'
51
+ add_method_tracer :rename, 'AWS-S3/S3Objects/rename'
52
+ add_method_tracer :etag, 'AWS-S3/S3Objects/etag'
53
+ add_method_tracer :owner, 'AWS-S3/S3Objects/owner'
54
+ end
55
+
56
+ end
@@ -0,0 +1,23 @@
1
+ # == Cassandra Instrumentation
2
+ #
3
+
4
+ if defined?(::Cassandra) and not NewRelic::Control.instance['disable_cassandra_instrumentation']
5
+
6
+ ::Cassandra.class_eval do
7
+ add_method_tracer :insert, 'Database/Cassandra/insert'
8
+ add_method_tracer :remove, 'Database/Cassandra/remove'
9
+ add_method_tracer :clear_column_family!, 'Database/Cassandra/clear_column_family!'
10
+ add_method_tracer :clear_keyspace!, 'Database/Cassandra/clear_keyspace!'
11
+ add_method_tracer :count_columns, 'Database/Cassandra/count_columns'
12
+ add_method_tracer :multi_count_columns, 'Database/Cassandra/multi_count_columns'
13
+ add_method_tracer :get_columns, 'Database/Cassandra/get_columns'
14
+ add_method_tracer :multi_get_columns, 'Database/Cassandra/multi_get_columns'
15
+ add_method_tracer :get, 'Database/Cassandra/get'
16
+ add_method_tracer :multi_get, 'Database/Cassandra/multi_get'
17
+ add_method_tracer :exists?, 'Database/Cassandra/exists?'
18
+ add_method_tracer :get_range, 'Database/Cassandra/get_range'
19
+ add_method_tracer :count_range, 'Database/Cassandra/count_range'
20
+ add_method_tracer :batch, 'Database/Cassandra/batch'
21
+ end
22
+
23
+ end
@@ -2,10 +2,16 @@
2
2
  #
3
3
 
4
4
  if defined?(::Redis) and not NewRelic::Control.instance['disable_redis']
5
-
6
- ::Redis.class_eval do
5
+
6
+
7
+ Redis::Client.class_eval do
7
8
 
8
9
  include NewRelic::Agent::MethodTracer
10
+
11
+ def self.redis_call_method
12
+ Redis::Client.new.respond_to?(:call) ? :call : :raw_call_command
13
+ end
14
+
9
15
 
10
16
  def raw_call_command_with_newrelic_trace *args
11
17
  method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
@@ -16,11 +22,12 @@ if defined?(::Redis) and not NewRelic::Control.instance['disable_redis']
16
22
  raw_call_command_without_newrelic_trace(*args)
17
23
  end
18
24
  end
19
-
20
- # alias_method_chain :raw_call_command, :newrelic_trace
21
- alias raw_call_command_without_newrelic_trace raw_call_command
22
- alias raw_call_command raw_call_command_with_newrelic_trace
25
+
26
+ alias_method :raw_call_command_without_newrelic_trace, redis_call_method
27
+ alias_method redis_call_method, :raw_call_command_with_newrelic_trace
23
28
 
24
29
  end
25
30
 
31
+
32
+
26
33
  end
@@ -0,0 +1,34 @@
1
+ require "#{File.dirname(__FILE__)}/helper"
2
+ begin
3
+ require 'redis'
4
+ require 'ruby-debug'
5
+ rescue LoadError
6
+ end
7
+
8
+ require "#{File.dirname(__FILE__)}/../lib/rpm_contrib/instrumentation/redis"
9
+
10
+ if defined?(::Redis)
11
+
12
+
13
+ class RedisTest < Test::Unit::TestCase
14
+
15
+ # Called before every test method runs. Can be used
16
+ # to set up fixture information.
17
+ def setup
18
+ # Do nothing
19
+ end
20
+
21
+ # Called after every test method runs. Can be used to tear
22
+ # down fixture information.
23
+
24
+ def teardown
25
+ # Do nothing
26
+ end
27
+
28
+ # Fake test
29
+ def test_fail
30
+
31
+
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 10
9
- version: 1.0.10
8
+ - 11
9
+ version: 1.0.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bill Kayser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-21 00:00:00 -07:00
17
+ date: 2010-09-01 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -53,7 +53,9 @@ files:
53
53
  - lib/rpm_contrib.rb
54
54
  - lib/rpm_contrib/detection/camping.rb
55
55
  - lib/rpm_contrib/detection/resque.rb
56
+ - lib/rpm_contrib/instrumentation/aws/s3.rb
56
57
  - lib/rpm_contrib/instrumentation/camping.rb
58
+ - lib/rpm_contrib/instrumentation/cassandra.rb
57
59
  - lib/rpm_contrib/instrumentation/mongo_mapper.rb
58
60
  - lib/rpm_contrib/instrumentation/mongoid.rb
59
61
  - lib/rpm_contrib/instrumentation/paperclip.rb
@@ -62,6 +64,7 @@ files:
62
64
  - test/helper.rb
63
65
  - test/schema.rb
64
66
  - test/test_mongoid.rb
67
+ - test/test_redis.rb
65
68
  has_rdoc: true
66
69
  homepage: http://github.com/newrelic/rpm_contrib
67
70
  licenses: []
@@ -102,3 +105,4 @@ test_files:
102
105
  - test/helper.rb
103
106
  - test/schema.rb
104
107
  - test/test_mongoid.rb
108
+ - test/test_redis.rb