newrelic_rpm 2.13.6.beta1 → 2.13.6.beta2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

@@ -37,13 +37,25 @@
37
37
  # non-first metric in trace_execution_scoped() (docs say only first counts
38
38
  # towards scope) so they don't show up ine normal call graph/trace.
39
39
 
40
- DependencyDetector.defer do
40
+ DependencyDetection.defer do
41
41
  depends_on do
42
42
  defined?(::DataMapper)
43
43
  end
44
+
45
+ depends_on do
46
+ defined?(DataMapper::Model)
47
+ end
48
+
49
+ depends_on do
50
+ defined?(DataMapper::Resource)
51
+ end
52
+
53
+ depends_on do
54
+ defined?(DataMapper::Collection)
55
+ end
44
56
 
45
- executes_on(:'DataMapper::Model') do
46
- class_eval do
57
+ executes do
58
+ DataMapper::Model.class_eval do
47
59
  add_method_tracer :get, 'ActiveRecord/#{self.name}/get'
48
60
  add_method_tracer :first, 'ActiveRecord/#{self.name}/first'
49
61
  add_method_tracer :last, 'ActiveRecord/#{self.name}/last'
@@ -64,9 +76,9 @@ DependencyDetector.defer do
64
76
 
65
77
  end
66
78
  end
67
-
68
- executes_on(:'DataMapper::Resource') do
69
- class_eval do
79
+
80
+ executes do
81
+ DataMapper::Resource.class_eval do
70
82
  add_method_tracer :update, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/update'
71
83
  add_method_tracer :update!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/update'
72
84
  add_method_tracer :save, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
@@ -77,8 +89,8 @@ DependencyDetector.defer do
77
89
  end
78
90
  end
79
91
 
80
- executes_on(:'DataMapper::Collection') do
81
- class_eval do
92
+ executes do
93
+ DataMapper::Collection.class_eval do
82
94
  # DM's Collection instance methods
83
95
  add_method_tracer :get, 'ActiveRecord/#{self.name}/get'
84
96
  add_method_tracer :first, 'ActiveRecord/#{self.name}/first'
@@ -105,10 +117,16 @@ DependencyDetector.defer do
105
117
  end
106
118
 
107
119
  DependencyDetection.defer do
108
- executes_on(:'DataMapper::Adapters::DataObjectsAdapter') do
120
+
121
+ depends_on do
122
+ defined?(DataMapper) && defined?(DataMapper::Adapters) && defined?(DataMapper::Adapters::DataObjectsAdapter)
123
+ end
124
+
125
+ executes do
126
+
109
127
  # Catch the two entry points into DM::Repository::Adapter that bypass CRUD
110
128
  # (for when SQL is run directly).
111
- class_eval do
129
+ DataMapper::Adapters::DataObjectsAdapter.class_eval do
112
130
 
113
131
  add_method_tracer :select, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/select'
114
132
  add_method_tracer :execute, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/execute'
@@ -119,26 +137,33 @@ end
119
137
 
120
138
  DependencyDetection.defer do
121
139
 
140
+ depends_on do
141
+ defined?(DataMapper) && defined?(DataMapper::Validations) && defined?(DataMapper::Validations::ClassMethods)
142
+ end
143
+
122
144
  # DM::Validations overrides Model#create, but currently in a way that makes it
123
145
  # impossible to instrument from one place. I've got a patch pending inclusion
124
146
  # to make it instrumentable by putting the create method inside ClassMethods.
125
147
  # This will pick it up if/when that patch is accepted.
126
- executes_on(:'DataMapper::Validations::ClassMethods') do
127
- class_eval do
128
-
148
+ executes do
149
+ DataMapper::Validations::ClassMethods.class_eval do
129
150
  next unless method_defined? :create
130
151
  add_method_tracer :create, 'ActiveRecord/#{self.name}/create'
131
-
132
152
  end
133
153
  end
134
154
  end
135
155
 
136
156
  DependencyDetection.defer do
137
- # NOTE: DM::Transaction basically calls commit() twice, so as-is it will show
138
- # up in traces twice -- second time subordinate to the first's scope. Works
139
- # well enough.
140
- executes_on(:'DataMapper::Transaction') do
141
- module_eval do
157
+
158
+ depends_on do
159
+ defined?(DataMapper) && defined?(DataMapper::Transaction)
160
+ end
161
+
162
+ # NOTE: DM::Transaction basically calls commit() twice, so as-is it will show
163
+ # up in traces twice -- second time subordinate to the first's scope. Works
164
+ # well enough.
165
+ executes do
166
+ DataMapper::Transaction.module_eval do
142
167
  add_method_tracer :commit, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/commit'
143
168
  end
144
169
  end
@@ -194,8 +219,13 @@ module NewRelic
194
219
  end # NewRelic
195
220
 
196
221
  DependencyDetection.defer do
197
- executes_on(:'DataObjects::Connection') do
198
- class_eval do
222
+
223
+ depends_on do
224
+ defined?(DataObjects) && defined?(DataObjects::Connection)
225
+ end
226
+
227
+ executes do
228
+ DataObjects::Connection.class_eval do
199
229
  include ::NewRelic::Agent::Instrumentation::DataMapperInstrumentation
200
230
  end
201
231
  end
@@ -1,26 +1,36 @@
1
1
  require 'set'
2
- require 'merb-core/controller/merb_controller'
3
2
 
4
- Merb::Controller.class_eval do
5
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation
3
+ DependencyDetection.defer do
6
4
 
7
- class_inheritable_accessor :do_not_trace
8
- class_inheritable_accessor :ignore_apdex
9
-
10
- def self.newrelic_write_attr(attr_name, value) # :nodoc:
11
- self.send "#{attr_name}=", attr_name, value
5
+ depends_on do
6
+ defined?(Merb) && defined?(Merb::Controller)
12
7
  end
8
+
9
+ executes do
10
+ require 'merb-core/controller/merb_controller'
13
11
 
14
- def self.newrelic_read_attr(attr_name) # :nodoc:
15
- self.send attr_name
16
- end
12
+ Merb::Controller.class_eval do
13
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
14
+
15
+ class_inheritable_accessor :do_not_trace
16
+ class_inheritable_accessor :ignore_apdex
17
+
18
+ def self.newrelic_write_attr(attr_name, value) # :nodoc:
19
+ self.send "#{attr_name}=", attr_name, value
20
+ end
21
+
22
+ def self.newrelic_read_attr(attr_name) # :nodoc:
23
+ self.send attr_name
24
+ end
17
25
 
18
- protected
19
- # determine the path that is used in the metric name for
20
- # the called controller action
21
- def newrelic_metric_path
22
- "#{controller_name}/#{action_name}"
26
+ protected
27
+ # determine the path that is used in the metric name for
28
+ # the called controller action
29
+ def newrelic_metric_path
30
+ "#{controller_name}/#{action_name}"
31
+ end
32
+ alias_method :perform_action_without_newrelic_trace, :_dispatch
33
+ alias_method :_dispatch, :perform_action_with_newrelic_trace
34
+ end
23
35
  end
24
- alias_method :perform_action_without_newrelic_trace, :_dispatch
25
- alias_method :_dispatch, :perform_action_with_newrelic_trace
26
36
  end
@@ -1,9 +1,23 @@
1
- # Hook in the notification to merb
2
- error_notifier = Proc.new {
3
- if request.exceptions #check that there's actually an exception
4
- # Note, this assumes we have already captured the other information such as uri and params in the MetricFrame.
5
- NewRelic::Agent::Instrumentation::MetricFrame.notice_error(request.exceptions.first)
1
+ DependencyDetection.defer do
2
+ depends_on do
3
+ defined?(Merb) && defined?(Merb::Dispatcher) && defined?(Merb::Dispatcher::DefaultException)
6
4
  end
7
- }
8
- Merb::Dispatcher::DefaultException.before error_notifier
9
- Exceptions.before error_notifier
5
+
6
+ depends_on do
7
+ Merb::Dispatcher::DefaultException.respond_to?(:before)
8
+ end
9
+
10
+ executes do
11
+
12
+ # Hook in the notification to merb
13
+ error_notifier = Proc.new {
14
+ if request.exceptions #check that there's actually an exception
15
+ # Note, this assumes we have already captured the other information such as uri and params in the MetricFrame.
16
+ NewRelic::Agent::Instrumentation::MetricFrame.notice_error(request.exceptions.first)
17
+ end
18
+ }
19
+ Merb::Dispatcher::DefaultException.before error_notifier
20
+ Exceptions.before error_notifier
21
+
22
+ end
23
+ end
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 2
5
5
  MINOR = 13
6
6
  TINY = 6
7
- BUILD = 'beta1' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 'beta2' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
10
10
 
data/newrelic_rpm.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "2.13.6.beta1"
8
+ s.version = "2.13.6.beta2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser", "Justin George"]
12
- s.date = %q{2011-03-21}
12
+ s.date = %q{2011-03-22}
13
13
  s.description = %q{New Relic RPM is a Ruby performance management system, developed by
14
14
  New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
15
15
  information about the performance of your Ruby on Rails or Merb
@@ -135,6 +135,7 @@ http://github.com/newrelic/rpm/tree/master.
135
135
  "test/new_relic/agent/error_collector/notice_error_test.rb",
136
136
  "test/new_relic/agent/error_collector_test.rb",
137
137
  "test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb",
138
+ "test/new_relic/agent/instrumentation/instrumentation_test.rb",
138
139
  "test/new_relic/agent/instrumentation/metric_frame_test.rb",
139
140
  "test/new_relic/agent/instrumentation/net_instrumentation_test.rb",
140
141
  "test/new_relic/agent/instrumentation/queue_time_test.rb",
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper'))
2
+ class NewRelic::Agent::Instrumentation::InstrumentationTest < Test::Unit::TestCase
3
+ def test_load_all_instrumentation_files
4
+ # just checking for syntax errors and unguarded code
5
+ Dir.glob(NEWRELIC_PLUGIN_DIR + '/lib/new_relic/agent/instrumentation/**/*.rb') do |f|
6
+ require f
7
+ end
8
+ require 'new_relic/delayed_job_injection'
9
+ end
10
+ end
11
+
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196225
4
+ hash: 62196231
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 2
8
8
  - 13
9
9
  - 6
10
10
  - beta
11
- - 1
12
- version: 2.13.6.beta1
11
+ - 2
12
+ version: 2.13.6.beta2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Bill Kayser
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-03-21 00:00:00 -07:00
21
+ date: 2011-03-22 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -193,6 +193,7 @@ files:
193
193
  - test/new_relic/agent/error_collector/notice_error_test.rb
194
194
  - test/new_relic/agent/error_collector_test.rb
195
195
  - test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb
196
+ - test/new_relic/agent/instrumentation/instrumentation_test.rb
196
197
  - test/new_relic/agent/instrumentation/metric_frame_test.rb
197
198
  - test/new_relic/agent/instrumentation/net_instrumentation_test.rb
198
199
  - test/new_relic/agent/instrumentation/queue_time_test.rb