wireframe-rpm_contrib 1.0.12.7 → 2.1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGELOG +69 -3
  2. data/Gemfile +13 -0
  3. data/README.md +137 -14
  4. data/Rakefile +5 -3
  5. data/lib/rpm_contrib.rb +17 -24
  6. data/lib/rpm_contrib/agent_compatibility.rb +11 -0
  7. data/lib/rpm_contrib/detection.rb +5 -0
  8. data/lib/rpm_contrib/detection/camping.rb +1 -1
  9. data/lib/rpm_contrib/instrumentation.rb +16 -0
  10. data/lib/rpm_contrib/instrumentation/active_messaging.rb +22 -0
  11. data/lib/rpm_contrib/instrumentation/aws.rb +68 -0
  12. data/lib/rpm_contrib/instrumentation/camping.rb +7 -10
  13. data/lib/rpm_contrib/instrumentation/cassandra.rb +26 -19
  14. data/lib/rpm_contrib/instrumentation/crack.rb +41 -0
  15. data/lib/rpm_contrib/instrumentation/curb.rb +52 -0
  16. data/lib/rpm_contrib/instrumentation/elastic_search.rb +26 -0
  17. data/lib/rpm_contrib/instrumentation/kyototycoon.rb +28 -0
  18. data/lib/rpm_contrib/instrumentation/mongo.rb +54 -0
  19. data/lib/rpm_contrib/instrumentation/mongoid.rb +12 -44
  20. data/lib/rpm_contrib/instrumentation/paperclip.rb +25 -18
  21. data/lib/rpm_contrib/instrumentation/picky.rb +41 -0
  22. data/lib/rpm_contrib/instrumentation/redis.rb +29 -20
  23. data/lib/rpm_contrib/instrumentation/resque.rb +78 -42
  24. data/lib/rpm_contrib/instrumentation/riak_client.rb +48 -0
  25. data/lib/rpm_contrib/instrumentation/ripple.rb +37 -0
  26. data/lib/rpm_contrib/instrumentation/sinatra.rb +30 -0
  27. data/lib/rpm_contrib/instrumentation/thinking_sphinx.rb +22 -0
  28. data/lib/rpm_contrib/instrumentation/typhoeus.rb +33 -0
  29. data/lib/rpm_contrib/instrumentation/ultrasphinx.rb +22 -0
  30. data/lib/rpm_contrib/instrumentation/workling.rb +27 -0
  31. data/lib/rpm_contrib/instrumentation/yajl.rb +41 -0
  32. data/lib/rpm_contrib/language_support.rb +31 -0
  33. data/lib/rpm_contrib/samplers.rb +17 -0
  34. data/test/helper.rb +1 -1
  35. data/test/schema.rb +1 -1
  36. data/test/test_curb.rb +69 -0
  37. data/test/test_picky.rb +55 -0
  38. data/test/test_redis.rb +2 -2
  39. data/test/test_resque.rb +74 -0
  40. data/test/{test_mongoid.rb → test_workling.rb} +6 -14
  41. metadata +74 -64
  42. data/lib/rpm_contrib/detection/resque.rb +0 -15
  43. data/lib/rpm_contrib/instrumentation/aws/s3.rb +0 -56
  44. data/lib/rpm_contrib/instrumentation/mongo_mapper.rb +0 -44
data/CHANGELOG CHANGED
@@ -1,6 +1,72 @@
1
- * Version 1.0.12.7
1
+ * Version 2.1.6.1
2
2
 
3
- Add support for resque jobs running in backgrounded
3
+ Add instrumentation for Backgrounded Resque Job Processing Framework (Ryan
4
+ Sonnek)
5
+
6
+ * Version 2.1.6
7
+ Community contributed instrumentation
8
+ - ThinkingSphinx instrumentation (W. Andrew Loe III)
9
+ - Riak instrumentation (Bryce Kerley)
10
+ - KyotoTycoon instrumentation (Keisuke Kawahara)
11
+ Community Contributed Bug Fixes
12
+ - MongoDB instrumentation (Kenn Ejima)
13
+ - Yajl instrumentation (Chris Griego)
14
+ - UltraSphinx instrumentation (Jonathan Rudenberg)
15
+ Renamed ActiveMQ instrumentation to ActiveMessaging (W. Andrew Loe III)
16
+
17
+ * Version 2.1.5
18
+
19
+ Changed the resque detection so it does not depend on the load
20
+ order of resque => rpm_contrib => newrelic_rpm. The gems can be
21
+ installed in any order.
22
+
23
+ * Version 2.1.4
24
+
25
+ Updated requirements to latest agent with some bug fixes for background jobs
26
+ Converted instrumentation to install with DependencyDetection in the latest Agent
27
+ Changed Resque instrumentation from a plugin back to method chaining
28
+ Fixed several reported bugs related to resque
29
+
30
+ * Version 2.1.3
31
+
32
+ Fixed typo in Resque instrumentation
33
+ Fixed double loading of AWS instrumentation
34
+
35
+ * Version 2.1.2
36
+
37
+ Add a manual shutdown to the Resque instrumentation to make sure data is saved and sent - thanks to Jade Rubick
38
+
39
+ * Version 2.1.1
40
+
41
+ Fix namespacing problem with Resque
42
+ Add instrumentation to Mongo::Cursor #refresh and #close - thanks to Chris Griego
43
+
44
+ * Version 2.1.0
45
+
46
+ Included instrumentation from the community:
47
+ - Alexey Palazhchenko - mongo ORM-agnostic instrumentation
48
+ - Michael Breen - Elastic Search
49
+ - Paul Ingles - Sinatra Template instrumentation
50
+ - Siddharth Dawara - Typhoeus instrumentation
51
+ - Rob Meyer - ActiveMQ instrumentation
52
+ - Greg Hazel - Curb instrumentation
53
+ - Ben Poweski - Crack and Yajl instrumentation
54
+ - Chad Ingram and Scott Fleckenstein - Workling instrumentation
55
+ - Adam Weller - UltraSphinx instrumentation
56
+ - Liron Yahdav - work on the Resque instrumentation
57
+
58
+ * Version 2.0.1
59
+
60
+ Fixed an error with Bundler and RubyGems 1.8.2 which caused the gem to always fail to load
61
+
62
+ * Version 2.0.0
63
+
64
+ Updated to use the latest version of the Ruby Agent
65
+
66
+ * Version 1.0.13
67
+
68
+ Removed use of 'metaclass' - no longer available from ActiveSupport as of Rails 3
69
+ Contributed by Chris Griego
4
70
 
5
71
  * Version 1.0.12
6
72
 
@@ -47,7 +113,7 @@
47
113
  MongoDB instrumentation contributed by John Nunemaker
48
114
 
49
115
  * Version 1.0.2
50
-
116
+
51
117
  Improved Camping support
52
118
 
53
119
  * Version 1.0.1
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source :rubygems
2
+
3
+ gem 'newrelic_rpm', '>=3.1.1'
4
+
5
+ group :test do
6
+ gem 'resque'
7
+ gem 'json'
8
+ gem 'mocha'
9
+ end
10
+
11
+ group :build do
12
+ gem 'jeweler'
13
+ end
data/README.md CHANGED
@@ -7,13 +7,15 @@ To use the rpm_contrib gem, install the `rpm_contrib` gem from rubygems.org.
7
7
  It will also install the required version of the `newrelic_rpm` gem if it's not
8
8
  already installed.
9
9
 
10
- For Rails 3.0 and later, add this dependency to your Gemfile:
10
+ For Rails 3.0 and when using Bundler, add these dependencies to your Gemfile:
11
11
 
12
12
  gem 'rpm_contrib'
13
+ gem 'newrelic_rpm'
13
14
 
14
- For Rails 2.1 and later, add this dependency to your in your environment.rb:
15
+ For Rails 2.1 and later, add these dependencies to your in your environment.rb:
15
16
 
16
17
  config.gem 'rpm_contrib'
18
+ config.gem 'newrelic_rpm'
17
19
 
18
20
  For other frameworks, make sure you load rubygems if it isn't already, then just
19
21
  require the rpm_contrib gem:
@@ -22,40 +24,160 @@ require the rpm_contrib gem:
22
24
  require 'rpm_contrib'
23
25
 
24
26
  When you load the rpm_contrib gem, the `newrelic_rpm` gem will also be
25
- initialized. No need for a separate require statement for `newrelic_rpm`. The
26
- `rpm_contrib` gem must be loaded before the `newrelic_rpm` gem initializes.
27
+ initialized. No need for a separate require statement for `newrelic_rpm`.
27
28
 
28
- # Supported Frameworks
29
+ In non-Rails frameworks, it's important that the New Relic Agent gets
30
+ loaded as late as possible, or that the final initialization hook is called
31
+ after all other frameworks have loaded:
32
+
33
+ DependencyDetection.detect!
34
+
35
+ ### Troubleshooting Startup
36
+
37
+ If you've set up your gems to load as described above and you are still not seeing
38
+ data in RPM, there may be a bug in detecting your framework. Try setting the
39
+ environment variable `NEWRELIC_DISPATCHER` to the name of your app server (Camping,
40
+ Resque, Rake, etc), and please report to us if this fixes the problem so we can
41
+ fix the auto-detection logic.
42
+
43
+ If this does not help then set the `log_level` to `debug` in the `newrelic.yml` file
44
+ and examine the `newrelic_agent.log` file for errors after restarting your app.
45
+
46
+ ## Supported Frameworks
29
47
 
30
48
  A number of frameworks are supported in the contrib gem. They are all turned on
31
49
  by default but you can add settings to your newrelic.yml to disable any of them.
32
50
 
51
+ ### ActiveMessaging
52
+
53
+ The gem will detect the underlying ActiveMessaging::Processor class and instrument the `on_message` method
54
+
55
+ It can be disabled with the `disable_active_messaging` flag in your newrelic.yml file.
56
+
57
+ ### Cassandra
58
+
59
+ The gem will instrument Cassandra so it should be visible in transaction traces and the web transactions page.
60
+
61
+ You can disable it with `disable_cassandra_instrumentation` in your newrelic.yml file.
62
+
33
63
  ### Camping
34
64
 
35
65
  The gem will detect a Camping app but you need to manually add the
36
- instrumentation to your configuration file. See RPMContrib::Instrumentation::Camping
37
- for more information.
66
+ instrumentation to your configuration file. See
67
+ RPMContrib::Instrumentation::Camping for more information.
68
+
69
+ In addition you will need to load the gems in the following order: 1) Camping, 2) rpm_contrib,
70
+ 3) newrelic_rpm.
71
+
72
+ ### Crack
73
+
74
+ The gem will instrument the Crack parsers for JSON and XML - you
75
+ should see them in transaction traces and the web transactions page.
76
+
77
+ You can disable it with `disable_crack` in your newrelic.yml file.
78
+
79
+ ### Curb
80
+
81
+ The gem will instrument both Curl::Easy and Curl::Multi - they should show up similarly to Net::HTTP in the UI
82
+
83
+ You can disable it with `disable_curb` in your newrelic.yml file.
84
+
85
+ ## Elastic Search
86
+
87
+ The gem will instrument ElasticSearch::Client. The metrics should show up in the UI
88
+
89
+ You can disable it with `disable_elastic_search_instrumentation` in your newrelic.yml file.
90
+
91
+ ## KyotoTycoon
92
+
93
+ The gem will instrument KyotoTycoon.
94
+
95
+ You can disable it with `disable_kyototycoon` in your newrelic.yml file.
38
96
 
39
97
  ### Paperclip
40
98
 
41
- No special configuration required for Paperclip visibility. You can disable
42
- it by setting `disable_paperclip` to true in the newrelic.yml file.
99
+ No special configuration required for Paperclip visibility.
100
+
101
+ You can disable it by setting `disable_paperclip` to true in your newrelic.yml file.
102
+
103
+ ### Picky
104
+
105
+ The gem will instrument the [Picky semantic search engine](http://florianhanke.com/picky/) so it should be visible in transaction traces and the web transactions page.
106
+
107
+ You can disable it with `disable_picky` in your newrelic.yml file.
43
108
 
44
109
  ### MongoDB
45
110
 
46
- Both MongoMapper and Mongoid are supported. You can disable them both by setting
47
- 'disable_mongodb' to true in the newrelic.yml file.
111
+ Our instrumentation works on the underlying 'Mongo' library.
112
+
113
+ You can disable it by setting 'disable_mongodb' to true in your newrelic.yml file.
48
114
 
49
115
  ### Resque
50
116
 
117
+ To instrument jobs you no longer need to have your Job class inherit from Resque::Job or include
118
+ the Resque::Plugins::NewRelicInstrumentation module. The module definition was left in for
119
+ backward compatibility.
120
+
51
121
  To disable resque, set 'disable_resque' to true in your newrelic.yml file.
52
122
 
53
123
  ### Redis
54
124
 
55
125
  Redis instrumentation will record operations as well as `allWeb` and `allOther`
56
126
  summary metrics under the `Database/Redis` metric namespace. This instrumentation
57
- supports Redis versions 1.x and 2.x. To disable Redis instrumentation, set
58
- 'disable_redis' to true in your newrelic.yml file.
127
+ supports Redis versions 1.x and 2.x.
128
+
129
+ To disable Redis instrumentation, set 'disable_redis' to true in your newrelic.yml file.
130
+
131
+ ### Riak
132
+
133
+ RiakClient is instrumented. Its opereations are recorded under Database in the
134
+ the response time graph.
135
+
136
+ To disable Riak instrumentation, set 'disable_riak_client' to true in your newrelic.yml file.
137
+
138
+ ### Ripple
139
+
140
+ Ripple is instrumented. Its opereations are recorded under Database in the
141
+ the response time graph.
142
+
143
+ To disable Riak instrumentation, set 'disable_ripple' to true in your newrelic.yml file.
144
+
145
+ ### Sinatra view instrumentation
146
+
147
+ This adds instrumentation to the `render` methods in Sinatra::Base
148
+
149
+ You can disable it with `disable_sinatra_template` in your newrelic.yml file.
150
+
151
+ ### ThinkingSphinx instrumentation
152
+
153
+ This adds instrumentation to the `initialize` and `results` method of ThinkingSphinx::Search
154
+
155
+ You can disable it with `disable_thinking_sphinx` in your newrelic.yml file.
156
+
157
+
158
+ ### Typhoeus instrumentation
159
+
160
+ This adds instrumentation to the Typhoeus::Request class for 'GET' requests
161
+
162
+ You can disable it with `disable_typhoeus` in your newrelic.yml file.
163
+
164
+ ### Ultrasphinx instrumentation
165
+
166
+ This adds basic instrumentation to the `run` and `results` method of Ultrasphinx::Search
167
+
168
+ You can disable it with `disable_ultrasphinx` in your newrelic.yml file.
169
+
170
+ ### Workling
171
+
172
+ This adds instrumentation to the Workling::Base and all children, for all defined public methods not inherited from the Workling::Base class
173
+
174
+ You can disable it with `disable_workling` in your newrelic.yml file.
175
+
176
+ ### YAJL
177
+
178
+ This adds instrumentation to the YAJL json parser
179
+
180
+ You can disable it with `disable_yajl_instrumentation` in your newrelic.yml file.
59
181
 
60
182
  ### AWS/S3
61
183
 
@@ -150,7 +272,8 @@ we'll be happy to help you work through it.
150
272
  files will be loaded when the RPM agent is initialized.
151
273
  * Add samplers to `lib/rpm_contrib/samplers`. These classes are
152
274
  installed automatically when the RPM agent is initialized.
153
- * Add tests.
275
+ * Add tests.
276
+ * Update README.md
154
277
  * Commit, do not mess with the Rakefile, version, or history. (if you
155
278
  want to have your own version, that is fine but bump version in a
156
279
  commit by itself I can ignore when I pull)
data/Rakefile CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'rubygems'
2
+ require "bundler/setup"
2
3
  require 'rake'
3
4
  # See http://www.rubygems.org/read/chapter/20
4
5
 
5
6
  def version
6
- @rpm_contrib_version ||= File.read("CHANGELOG")[/Version ([\d\.]+)$/, 1]
7
+ @rpm_contrib_version ||= File.read("CHANGELOG")[/Version ([\d\.]+\w*)$/, 1]
7
8
  end
8
9
 
9
10
  RDOC_FILES = FileList['README*','LICENSE','CHANGELOG']
@@ -21,10 +22,11 @@ begin
21
22
  gem.description = DESCRIPTION
22
23
  gem.email = "support@newrelic.com"
23
24
  gem.homepage = "http://github.com/newrelic/rpm_contrib"
24
- gem.author = "Bill Kayser"
25
- gem.add_dependency 'newrelic_rpm', '>=2.13.1'
25
+ gem.authors = [ "Bill Kayser", "Jon Guymon" ]
26
+ gem.add_dependency 'newrelic_rpm', '>=3.1.1'
26
27
  gem.version = version
27
28
  gem.files = FileList['LICENSE', 'README*', 'lib/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*'].to_a
29
+ gem.files.exclude *File.read(File.join(File.dirname(__FILE__), '.gitignore')).split
28
30
  gem.rdoc_options <<
29
31
  "--line-numbers" <<
30
32
  "--inline-source" <<
@@ -1,43 +1,36 @@
1
1
  RPM_CONTRIB_LIB = File.dirname(__FILE__)
2
2
 
3
- module RPMContrib
4
- VERSION = File.read(RPM_CONTRIB_LIB+"/../CHANGELOG")[/Version ([\d\.]+)$/, 1]
3
+ module RPMContrib; end
5
4
 
6
- def self.init_sequence
7
- Proc.new do
8
- # Tell the agent to load all the files in the
9
- # rpm_contrib/instrumentation directory.
10
- NewRelic::Agent.add_instrumentation(RPM_CONTRIB_LIB+"/rpm_contrib/instrumentation/**/*.rb")
11
-
12
- # Load all the Sampler class definitions. These will register
13
- # automatically with the agent.
14
- Dir.glob(RPM_CONTRIB_LIB + "/rpm_contrib/samplers/**/*.rb") { |file| require file }
15
- end
16
- end
17
-
18
- end
19
-
20
- # Perform any framework/dispatcher detection before loading the rpm gem.
21
- raise "The rpm_contrib gem must be loaded before the newrelic_rpm gem." if defined?(::NewRelic)
22
-
23
- Dir.glob(RPM_CONTRIB_LIB + "/rpm_contrib/detection/**/*.rb") { |file| require file }
5
+ require 'rpm_contrib/detection'
24
6
 
25
7
  require 'newrelic_rpm'
8
+ require 'rpm_contrib/agent_compatibility'
9
+ require 'rpm_contrib/instrumentation'
10
+
11
+ # Load all the Sampler class definitions. These will register
12
+ # automatically with the agent.
13
+ require 'rpm_contrib/samplers'
26
14
 
27
15
  if defined? Rails
28
16
  # Rails 3.x+
29
17
  if Rails.respond_to?(:version) && Rails.version =~ /^3/
30
18
  module NewRelic
31
19
  class Railtie < Rails::Railtie
32
- initializer("rpm_contrib.start_plugin", &RPMContrib.init_sequence)
20
+ initializer("rpm_contrib.start_plugin"){ NewRelic::Control.instance.init_plugin }
33
21
  end
34
22
  end
35
23
  # Rails 2.x
36
24
  elsif defined?(Rails) && Rails.respond_to?(:configuration)
37
- Rails.configuration.after_initialize &RPMContrib.init_sequence
25
+ Rails.configuration.after_initialize { NewRelic::Control.instance.init_plugin }
38
26
  else
39
27
  raise "The rpm_contrib gem supports Rails 2.2+ only."
40
28
  end
41
29
  else
42
- RPMContrib.init_sequence.call
43
- end
30
+ # If not running Rails, it is important that you load the contrib gem as late
31
+ # as possible so the agent initializes after everything else. Either that
32
+ # or make the following call yourself at the end of your startup sequence
33
+ # (it is idempotent).
34
+ NewRelic::Control.instance.init_plugin
35
+ end
36
+
@@ -0,0 +1,11 @@
1
+ if NewRelic::VERSION::STRING < '3.2.0'
2
+ module DependencyDetection
3
+ def self.dependency_by_name(name)
4
+ @@items.find {|i| i.name == name }
5
+ end
6
+
7
+ class Dependent
8
+ attr_reader :name
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ # Currently the only framework we are detecting with an agent
2
+ # patch is camping. You need to specify the camping gem prior
3
+ # to the contrib gem and newrelic agent gem in order for this to work.
4
+ require 'rpm_contrib/detection/camping'
5
+
@@ -1,6 +1,6 @@
1
1
  module NewRelic #:nodoc:
2
2
  # The class defined in the
3
- # newrelic_rpm[http://newrelic.github.com/rpm] which can be ammended
3
+ # newrelic_rpm[http://newrelic.github.com/rpm] which can be amended
4
4
  # to support new frameworks by defining modules in this namespace.
5
5
  class LocalEnvironment #:nodoc:
6
6
  module Camping
@@ -0,0 +1,16 @@
1
+ require 'newrelic_rpm'
2
+ module RpmContrib
3
+ # Contributed instrumentation files for use with newrelic_rpm gem
4
+ module Instrumentation
5
+ end
6
+ end
7
+
8
+ pattern = File.expand_path "../instrumentation/**/*.rb", __FILE__
9
+ Dir.glob pattern do |file|
10
+ begin
11
+ require file.to_s
12
+ rescue Exception => e
13
+ NewRelic::Agent.logger.error "Skipping instrumentation file '#{file}': #{e}"
14
+ NewRelic::Agent.logger.debug e.backtrace.join("\n")
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ # ActiveMessaging Instrumentation
2
+
3
+ DependencyDetection.defer do
4
+ @name = :active_messaging
5
+
6
+ depends_on do
7
+ defined?(::ActiveMessaging::Processor) && !NewRelic::Control.instance['disable_active_messaging'] &&
8
+ !NewRelic::Control.instance['disable_active_mq']
9
+ end
10
+
11
+ executes do
12
+ NewRelic::Agent.logger.debug 'Installing ActiveMessaging instrumentation'
13
+ end
14
+
15
+ executes do
16
+ ::ActiveMessaging::Processor.class_eval do
17
+ include NewRelic::Agent::MethodTracer
18
+
19
+ add_method_tracer :on_message, 'ActiveMessaging/OnMessage'
20
+ end
21
+ end
22
+ end