rpm_contrib 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ * Version 1.0.7
2
+
3
+ Resque instrumentation now supports the resque-multi-job-forks plugin
4
+
1
5
  * Version 1.0.6
2
6
 
3
7
  Update newrelic dependency: depends on 2.11.1
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 New Relic, Inc.
1
+ Copyright (c) 2009-2010 New Relic, Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # The RPM Contrib Gem
1
+ = The RPM Contrib Gem
2
2
 
3
3
  The `rpm_contrib` gem contains instrumentation for the New Relic RPM
4
4
  agent contributed by the community of RPM users. It requires the RPM
@@ -24,28 +24,41 @@ initialized. No need for a separate require statement for
24
24
  `newrelic_rpm`. The `rpm_contrib` gem must be loaded before the
25
25
  `newrelic_rpm` gem initializes.
26
26
 
27
- # Supported Frameworks
27
+ = Supported Frameworks
28
28
 
29
29
  A number of frameworks are supported in the contrib gem. They are all
30
30
  turned on by default but you can add settings to your newrelic.yml to
31
31
  disable any of them.
32
32
 
33
- ### Camping
33
+ === Camping
34
34
 
35
- ### Paperclip
35
+ 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.
36
38
 
37
- ### Authlogic
39
+ === Paperclip
38
40
 
39
- ### MongoDB
41
+ No special configuration required for Paperclip visibility. You can disable
42
+ it by setting `disable_paperclip` to true in the newrelic.yml file.
40
43
 
41
- ### Resque
44
+ === Authlogic
45
+
46
+ No special configuration required for Authlogic visibility. You can disable
47
+ it by setting `disable_authlogic` to true in the newrelic.yml file.
48
+
49
+ === MongoDB
50
+
51
+ No special configuration required for MongoDB visibility. You can disable
52
+ it by setting `disable_mongodb` to true in the newrelic.yml file.
53
+
54
+ === Resque
42
55
 
43
56
  To disable resque, add this to your newrelic.yml:
44
57
 
45
58
  disable_resque: true
46
59
 
47
60
 
48
- # How to Add Custom Instrumentation
61
+ = How to Add Custom Instrumentation
49
62
 
50
63
  We encourage contributions to this project and will provide whatever
51
64
  assistance we can to those wishing to develop instrumentation for
@@ -66,7 +79,7 @@ with this gem.
66
79
  web dispatcher, or be [started manually](http://support.newrelic.com/faqs/general/manual-start).
67
80
  * Framework support, for alternatives to Rails like Camping or Ramaze
68
81
 
69
- ## Custom Tracers
82
+ == Custom Tracers
70
83
 
71
84
  Custom tracers for frameworks should be added to the `lib/rpm_contrib/instrumentation`
72
85
  directory. These files are loaded at the time the Agent starts. **They will not
@@ -86,7 +99,7 @@ docs.
86
99
 
87
100
  A good example can be found in `lib/rpm_contrib/instrumentation/paperclip.rb`.
88
101
 
89
- ## Samplers
102
+ == Samplers
90
103
 
91
104
  You can add samplers which will record metrics approximately once a minute. Samplers
92
105
  are useful for capturing generic instrumentation for display in
@@ -97,7 +110,7 @@ class. They should be placed in the `samplers` directory.
97
110
 
98
111
  Refer to examples in the RPM agent to see how to get started.
99
112
 
100
- ## Supporting New Dispatchers
113
+ == Supporting New Dispatchers
101
114
 
102
115
  If you want to add support for a new dispatcher which is not being recognized by default
103
116
  by the RPM agent, add code to the `rpm_contrib/detection` directory. This code needs
@@ -108,7 +121,7 @@ This module should define the method `discover_dispatcher` and return the name o
108
121
  dispatcher if detected, or defer to super. See `rpm_contrib/detection/camping.rb`
109
122
  for a good example.
110
123
 
111
- ## Supporting New Frameworks
124
+ == Supporting New Frameworks
112
125
 
113
126
  Supporting new frameworks can be pretty involved and generally involves both
114
127
  adding custom instrumentation as well as framework and dispatcher detection.
@@ -121,7 +134,7 @@ Refer to the camping example in this gem to see how this is done in general.
121
134
  If you decide to tackle any new frameworks, contact support@newrelic.com and
122
135
  we'll be happy to help you work through it.
123
136
 
124
- # Note on Patches/Pull Requests
137
+ = Note on Patches/Pull Requests
125
138
 
126
139
  * Fork the http://www.github.com/newrelic/rpm_contrib project.
127
140
  * Add instrumentation files to `lib/rpm_contrib/instrumentation`. These
@@ -134,14 +147,15 @@ we'll be happy to help you work through it.
134
147
  commit by itself I can ignore when I pull)
135
148
  * Send me a pull request. Bonus points for topic branches.
136
149
 
137
- # Further Information
150
+ = Further Information
138
151
 
139
- Refer to the [Agent API Documentation](http://newrelic.github.com/rpm).
152
+ Refer to the Agent API Documentation at http://newrelic.github.com/rpm
140
153
 
141
- See [the support site](http://support.newrelic.com/faqs) for additional tips and documentation.
154
+ See the support site faqs at http://support.newrelic.com/faqs for
155
+ additional tips and documentation.
142
156
 
143
157
  Contact support@newrelic.com for help.
144
158
 
145
- ### Copyright
159
+ === Copyright
146
160
 
147
- Copyright (c) 2010 New Relic. See LICENSE for details.
161
+ Copyright (c) 2009-2010 New Relic. See LICENSE for details.
data/Rakefile CHANGED
@@ -55,8 +55,15 @@ require 'rake/rdoctask'
55
55
  Rake::RDocTask.new do |rdoc|
56
56
  rdoc.rdoc_dir = 'rdoc'
57
57
  rdoc.title = "rpm_contrib #{version}"
58
+ rdoc.main = "README.rdoc"
58
59
  rdoc.rdoc_files.include('README*')
59
60
  rdoc.rdoc_files.include('LICENSE')
60
61
  rdoc.rdoc_files.include('CHANGELOG')
61
62
  rdoc.rdoc_files.include('lib/**/*.rb')
62
63
  end
64
+
65
+ begin
66
+ require 'sdoc_helpers'
67
+ rescue LoadError
68
+ puts "sdoc support not enabled. Please gem install sdoc-helpers."
69
+ end
@@ -1,4 +1,4 @@
1
- if defined? Authlogic::Session::Base
1
+ if defined? Authlogic::Session::Base && !NewRelic::Control.instance['disable_authlogic']
2
2
  Authlogic::Session::Base.class_eval do
3
3
  # add_method_tracer :record, 'Authlogic/record'
4
4
  class << self
@@ -1,8 +1,9 @@
1
1
  # Just drop this little diddy in your app to get some (not perfect) information on query times and such
2
2
  # This will eventually become an official plugin but for those who can't wait, enjoy.
3
3
 
4
- if defined?(::MongoMapper)
5
- module MMNewRelicTracing
4
+
5
+ module RPMContrib::Instrumentation
6
+ module MongoDB
6
7
  def self.included(model)
7
8
  model.metaclass.class_eval do
8
9
  add_method_tracer :find, 'Database/#{self.name}/find'
@@ -36,5 +37,5 @@ if defined?(::MongoMapper)
36
37
  end
37
38
  end
38
39
  end
39
- ::MongoMapper::Document.append_inclusions(MMNewRelicTracing)
40
- end
40
+ ::MongoMapper::Document.append_inclusions(::RPMContrib::Instrumentation::MongoDB)
41
+ end if defined?(::MongoMapper) && !NewRelic::Control.instance['disable_mongodb']
@@ -1,6 +1,6 @@
1
1
  # Paperclip Instrumentation.
2
2
 
3
- if defined? ::Paperclip
3
+ if defined?(::Paperclip) && !NewRelic::Control.instance['disable_paperclip']
4
4
 
5
5
  ::Paperclip::Attachment.class_eval do
6
6
  add_method_tracer :save, 'Paperclip/#{name}/save'
@@ -7,34 +7,28 @@
7
7
  module RPMContrib
8
8
  module Instrumentation
9
9
  module ResqueInstrumentation
10
-
11
- ::Resque::Worker.class_eval do
10
+ ::Resque::Job.class_eval do
12
11
  include NewRelic::Agent::Instrumentation::ControllerInstrumentation
13
- old_process_method = instance_method(:process)
14
- define_method(:process) do | *args |
15
- if args[0]
16
- class_name = args[0].payload_class.name
17
- else
18
- class_name = 'Resque::Job'
19
- end
20
- name = 'process'
12
+
13
+ old_perform_method = instance_method(:perform)
14
+
15
+ define_method(:perform) do
16
+ class_name = (payload_class ||self.class).name
21
17
  NewRelic::Agent.reset_stats if NewRelic::Agent.respond_to? :reset_stats
22
- perform_action_with_newrelic_trace(:name => name, :class_name => class_name,
18
+ perform_action_with_newrelic_trace(:name => 'perform', :class_name => class_name,
23
19
  :category => 'OtherTransaction/ResqueJob') do
24
- old_process_method.bind(self).call(*args)
20
+ old_perform_method.bind(self).call
25
21
  end
26
- NewRelic::Agent.shutdown
22
+
23
+ NewRelic::Agent.shutdown unless defined?(::Resque.before_child_exit)
27
24
  end
28
-
29
- old_work_method = instance_method(:work)
30
-
31
- define_method(:work) do | *args |
32
- RAILS_DEFAULT_LOGGER.info "Sarting Resque monitoring"
33
- old_work_method.bind(self).call(*args)
25
+ end
26
+
27
+ if defined?(::Resque.before_child_exit)
28
+ ::Resque.before_child_exit do |worker|
29
+ NewRelic::Agent.shutdown
34
30
  end
35
31
  end
36
-
37
32
  end
38
33
  end
39
- end if defined?(::Resque::Worker) and not NewRelic::Control.instance['disable_resque']
40
-
34
+ end if defined?(::Resque::Job) and not NewRelic::Control.instance['disable_resque']
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 6
9
- version: 1.0.6
8
+ - 7
9
+ version: 1.0.7
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-04-02 00:00:00 -07:00
17
+ date: 2010-04-14 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -39,11 +39,11 @@ extensions: []
39
39
 
40
40
  extra_rdoc_files:
41
41
  - LICENSE
42
- - README.md
42
+ - README.rdoc
43
43
  files:
44
44
  - CHANGELOG
45
45
  - LICENSE
46
- - README.md
46
+ - README.rdoc
47
47
  - Rakefile
48
48
  - lib/new_relic/control/camping.rb
49
49
  - lib/rpm_contrib.rb