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 +4 -0
- data/LICENSE +1 -1
- data/{README.md → README.rdoc} +32 -18
- data/Rakefile +7 -0
- data/lib/rpm_contrib/instrumentation/authlogic.rb +1 -1
- data/lib/rpm_contrib/instrumentation/mongodb.rb +5 -4
- data/lib/rpm_contrib/instrumentation/paperclip.rb +1 -1
- data/lib/rpm_contrib/instrumentation/resque.rb +16 -22
- metadata +5 -5
data/CHANGELOG
CHANGED
data/LICENSE
CHANGED
data/{README.md → README.rdoc}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
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
|
-
|
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
|
-
|
33
|
+
=== Camping
|
34
34
|
|
35
|
-
|
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
|
-
|
39
|
+
=== Paperclip
|
38
40
|
|
39
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
150
|
+
= Further Information
|
138
151
|
|
139
|
-
Refer to the
|
152
|
+
Refer to the Agent API Documentation at http://newrelic.github.com/rpm
|
140
153
|
|
141
|
-
See
|
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
|
-
|
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,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
|
-
|
5
|
-
|
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(
|
40
|
-
end
|
40
|
+
::MongoMapper::Document.append_inclusions(::RPMContrib::Instrumentation::MongoDB)
|
41
|
+
end if defined?(::MongoMapper) && !NewRelic::Control.instance['disable_mongodb']
|
@@ -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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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 =>
|
18
|
+
perform_action_with_newrelic_trace(:name => 'perform', :class_name => class_name,
|
23
19
|
:category => 'OtherTransaction/ResqueJob') do
|
24
|
-
|
20
|
+
old_perform_method.bind(self).call
|
25
21
|
end
|
26
|
-
|
22
|
+
|
23
|
+
NewRelic::Agent.shutdown unless defined?(::Resque.before_child_exit)
|
27
24
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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::
|
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
|
-
-
|
9
|
-
version: 1.0.
|
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-
|
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.
|
42
|
+
- README.rdoc
|
43
43
|
files:
|
44
44
|
- CHANGELOG
|
45
45
|
- LICENSE
|
46
|
-
- README.
|
46
|
+
- README.rdoc
|
47
47
|
- Rakefile
|
48
48
|
- lib/new_relic/control/camping.rb
|
49
49
|
- lib/rpm_contrib.rb
|