dolores_rpm 3.2.0.2 → 3.2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v3.2.0.3
2
+ * Slightly newer DataMapper support
3
+
1
4
  v3.2.0.2
2
5
  * Roll back to previous version of DataMapper instrumentation (current one does not work for our app)
3
6
 
@@ -0,0 +1,305 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "dolores_rpm"
8
+ s.version = "3.2.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Bill Kayser", "Jon Guymon", "Justin George", "Darin Swanson"]
12
+ s.date = "2012-05-02"
13
+ s.description = "New Relic is a performance management system, developed by New Relic,\nInc (http://www.newrelic.com). This is a fork that uses an older version\nof the DataMapper instrumentation. Newer versions did not work for us.\n"
14
+ s.email = "support@newrelic.com"
15
+ s.executables = ["newrelic_cmd", "newrelic", "mongrel_rpm"]
16
+ s.extra_rdoc_files = [
17
+ "CHANGELOG",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "newrelic.yml"
21
+ ]
22
+ s.files = [
23
+ "CHANGELOG",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "bin/mongrel_rpm",
27
+ "bin/newrelic",
28
+ "bin/newrelic_cmd",
29
+ "cert/cacert.pem",
30
+ "cert/oldsite.pem",
31
+ "cert/site.pem",
32
+ "dolores_rpm.gemspec",
33
+ "install.rb",
34
+ "lib/conditional_vendored_dependency_detection.rb",
35
+ "lib/conditional_vendored_metric_parser.rb",
36
+ "lib/new_relic/agent.rb",
37
+ "lib/new_relic/agent/agent.rb",
38
+ "lib/new_relic/agent/beacon_configuration.rb",
39
+ "lib/new_relic/agent/browser_monitoring.rb",
40
+ "lib/new_relic/agent/busy_calculator.rb",
41
+ "lib/new_relic/agent/chained_call.rb",
42
+ "lib/new_relic/agent/database.rb",
43
+ "lib/new_relic/agent/error_collector.rb",
44
+ "lib/new_relic/agent/instrumentation.rb",
45
+ "lib/new_relic/agent/instrumentation/active_merchant.rb",
46
+ "lib/new_relic/agent/instrumentation/acts_as_solr.rb",
47
+ "lib/new_relic/agent/instrumentation/authlogic.rb",
48
+ "lib/new_relic/agent/instrumentation/controller_instrumentation.rb",
49
+ "lib/new_relic/agent/instrumentation/data_mapper.rb",
50
+ "lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb",
51
+ "lib/new_relic/agent/instrumentation/memcache.rb",
52
+ "lib/new_relic/agent/instrumentation/merb/controller.rb",
53
+ "lib/new_relic/agent/instrumentation/merb/errors.rb",
54
+ "lib/new_relic/agent/instrumentation/metric_frame.rb",
55
+ "lib/new_relic/agent/instrumentation/metric_frame/pop.rb",
56
+ "lib/new_relic/agent/instrumentation/net.rb",
57
+ "lib/new_relic/agent/instrumentation/passenger_instrumentation.rb",
58
+ "lib/new_relic/agent/instrumentation/queue_time.rb",
59
+ "lib/new_relic/agent/instrumentation/rack.rb",
60
+ "lib/new_relic/agent/instrumentation/rails/action_controller.rb",
61
+ "lib/new_relic/agent/instrumentation/rails/action_web_service.rb",
62
+ "lib/new_relic/agent/instrumentation/rails/active_record_instrumentation.rb",
63
+ "lib/new_relic/agent/instrumentation/rails/errors.rb",
64
+ "lib/new_relic/agent/instrumentation/rails3/action_controller.rb",
65
+ "lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb",
66
+ "lib/new_relic/agent/instrumentation/rails3/errors.rb",
67
+ "lib/new_relic/agent/instrumentation/sinatra.rb",
68
+ "lib/new_relic/agent/instrumentation/sunspot.rb",
69
+ "lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb",
70
+ "lib/new_relic/agent/method_tracer.rb",
71
+ "lib/new_relic/agent/sampler.rb",
72
+ "lib/new_relic/agent/samplers/cpu_sampler.rb",
73
+ "lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb",
74
+ "lib/new_relic/agent/samplers/memory_sampler.rb",
75
+ "lib/new_relic/agent/samplers/object_sampler.rb",
76
+ "lib/new_relic/agent/shim_agent.rb",
77
+ "lib/new_relic/agent/sql_sampler.rb",
78
+ "lib/new_relic/agent/stats_engine.rb",
79
+ "lib/new_relic/agent/stats_engine/metric_stats.rb",
80
+ "lib/new_relic/agent/stats_engine/samplers.rb",
81
+ "lib/new_relic/agent/stats_engine/transactions.rb",
82
+ "lib/new_relic/agent/transaction_sample_builder.rb",
83
+ "lib/new_relic/agent/transaction_sampler.rb",
84
+ "lib/new_relic/agent/worker_loop.rb",
85
+ "lib/new_relic/collection_helper.rb",
86
+ "lib/new_relic/command.rb",
87
+ "lib/new_relic/commands/deployments.rb",
88
+ "lib/new_relic/commands/install.rb",
89
+ "lib/new_relic/control.rb",
90
+ "lib/new_relic/control/class_methods.rb",
91
+ "lib/new_relic/control/configuration.rb",
92
+ "lib/new_relic/control/frameworks.rb",
93
+ "lib/new_relic/control/frameworks/external.rb",
94
+ "lib/new_relic/control/frameworks/merb.rb",
95
+ "lib/new_relic/control/frameworks/rails.rb",
96
+ "lib/new_relic/control/frameworks/rails3.rb",
97
+ "lib/new_relic/control/frameworks/ruby.rb",
98
+ "lib/new_relic/control/frameworks/sinatra.rb",
99
+ "lib/new_relic/control/instance_methods.rb",
100
+ "lib/new_relic/control/instrumentation.rb",
101
+ "lib/new_relic/control/logging_methods.rb",
102
+ "lib/new_relic/control/profiling.rb",
103
+ "lib/new_relic/control/server_methods.rb",
104
+ "lib/new_relic/data_serialization.rb",
105
+ "lib/new_relic/delayed_job_injection.rb",
106
+ "lib/new_relic/language_support.rb",
107
+ "lib/new_relic/local_environment.rb",
108
+ "lib/new_relic/merbtasks.rb",
109
+ "lib/new_relic/metric_data.rb",
110
+ "lib/new_relic/metric_spec.rb",
111
+ "lib/new_relic/metrics.rb",
112
+ "lib/new_relic/noticed_error.rb",
113
+ "lib/new_relic/rack/browser_monitoring.rb",
114
+ "lib/new_relic/rack/developer_mode.rb",
115
+ "lib/new_relic/recipes.rb",
116
+ "lib/new_relic/stats.rb",
117
+ "lib/new_relic/timer_lib.rb",
118
+ "lib/new_relic/transaction_analysis.rb",
119
+ "lib/new_relic/transaction_analysis/segment_summary.rb",
120
+ "lib/new_relic/transaction_sample.rb",
121
+ "lib/new_relic/transaction_sample/composite_segment.rb",
122
+ "lib/new_relic/transaction_sample/fake_segment.rb",
123
+ "lib/new_relic/transaction_sample/segment.rb",
124
+ "lib/new_relic/transaction_sample/summary_segment.rb",
125
+ "lib/new_relic/url_rule.rb",
126
+ "lib/new_relic/version.rb",
127
+ "lib/newrelic_rpm.rb",
128
+ "lib/tasks/all.rb",
129
+ "lib/tasks/install.rake",
130
+ "lib/tasks/tests.rake",
131
+ "newrelic.yml",
132
+ "recipes/newrelic.rb",
133
+ "test/active_record_fixtures.rb",
134
+ "test/config/newrelic.yml",
135
+ "test/config/test_control.rb",
136
+ "test/new_relic/agent/agent/connect_test.rb",
137
+ "test/new_relic/agent/agent/start_test.rb",
138
+ "test/new_relic/agent/agent/start_worker_thread_test.rb",
139
+ "test/new_relic/agent/agent_test.rb",
140
+ "test/new_relic/agent/agent_test_controller.rb",
141
+ "test/new_relic/agent/agent_test_controller_test.rb",
142
+ "test/new_relic/agent/apdex_from_server_test.rb",
143
+ "test/new_relic/agent/beacon_configuration_test.rb",
144
+ "test/new_relic/agent/browser_monitoring_test.rb",
145
+ "test/new_relic/agent/busy_calculator_test.rb",
146
+ "test/new_relic/agent/database_test.rb",
147
+ "test/new_relic/agent/error_collector/notice_error_test.rb",
148
+ "test/new_relic/agent/error_collector_test.rb",
149
+ "test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb",
150
+ "test/new_relic/agent/instrumentation/controller_instrumentation_test.rb",
151
+ "test/new_relic/agent/instrumentation/instrumentation_test.rb",
152
+ "test/new_relic/agent/instrumentation/metric_frame/pop_test.rb",
153
+ "test/new_relic/agent/instrumentation/metric_frame_test.rb",
154
+ "test/new_relic/agent/instrumentation/net_instrumentation_test.rb",
155
+ "test/new_relic/agent/instrumentation/queue_time_test.rb",
156
+ "test/new_relic/agent/instrumentation/rack_test.rb",
157
+ "test/new_relic/agent/instrumentation/task_instrumentation_test.rb",
158
+ "test/new_relic/agent/memcache_instrumentation_test.rb",
159
+ "test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb",
160
+ "test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb",
161
+ "test/new_relic/agent/method_tracer_test.rb",
162
+ "test/new_relic/agent/mock_scope_listener.rb",
163
+ "test/new_relic/agent/rpm_agent_test.rb",
164
+ "test/new_relic/agent/sampler_test.rb",
165
+ "test/new_relic/agent/shim_agent_test.rb",
166
+ "test/new_relic/agent/sql_sampler_test.rb",
167
+ "test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb",
168
+ "test/new_relic/agent/stats_engine/metric_stats_test.rb",
169
+ "test/new_relic/agent/stats_engine/samplers_test.rb",
170
+ "test/new_relic/agent/stats_engine_test.rb",
171
+ "test/new_relic/agent/transaction_sample_builder_test.rb",
172
+ "test/new_relic/agent/transaction_sampler_test.rb",
173
+ "test/new_relic/agent/worker_loop_test.rb",
174
+ "test/new_relic/agent_test.rb",
175
+ "test/new_relic/collection_helper_test.rb",
176
+ "test/new_relic/command/deployments_test.rb",
177
+ "test/new_relic/control/class_methods_test.rb",
178
+ "test/new_relic/control/configuration_test.rb",
179
+ "test/new_relic/control/logging_methods_test.rb",
180
+ "test/new_relic/control_test.rb",
181
+ "test/new_relic/data_serialization_test.rb",
182
+ "test/new_relic/delayed_job_injection_test.rb",
183
+ "test/new_relic/local_environment_test.rb",
184
+ "test/new_relic/metric_data_test.rb",
185
+ "test/new_relic/metric_spec_test.rb",
186
+ "test/new_relic/rack/all_test.rb",
187
+ "test/new_relic/rack/browser_monitoring_test.rb",
188
+ "test/new_relic/rack/developer_mode_helper_test.rb",
189
+ "test/new_relic/rack/developer_mode_test.rb",
190
+ "test/new_relic/stats_test.rb",
191
+ "test/new_relic/transaction_analysis/segment_summary_test.rb",
192
+ "test/new_relic/transaction_analysis_test.rb",
193
+ "test/new_relic/transaction_sample/composite_segment_test.rb",
194
+ "test/new_relic/transaction_sample/fake_segment_test.rb",
195
+ "test/new_relic/transaction_sample/segment_test.rb",
196
+ "test/new_relic/transaction_sample/summary_segment_test.rb",
197
+ "test/new_relic/transaction_sample_subtest_test.rb",
198
+ "test/new_relic/transaction_sample_test.rb",
199
+ "test/new_relic/version_number_test.rb",
200
+ "test/test_contexts.rb",
201
+ "test/test_helper.rb",
202
+ "ui/helpers/developer_mode_helper.rb",
203
+ "ui/helpers/google_pie_chart.rb",
204
+ "ui/views/layouts/newrelic_default.rhtml",
205
+ "ui/views/newrelic/_explain_plans.rhtml",
206
+ "ui/views/newrelic/_sample.rhtml",
207
+ "ui/views/newrelic/_segment.rhtml",
208
+ "ui/views/newrelic/_segment_limit_message.rhtml",
209
+ "ui/views/newrelic/_segment_row.rhtml",
210
+ "ui/views/newrelic/_show_sample_detail.rhtml",
211
+ "ui/views/newrelic/_show_sample_sql.rhtml",
212
+ "ui/views/newrelic/_show_sample_summary.rhtml",
213
+ "ui/views/newrelic/_sql_row.rhtml",
214
+ "ui/views/newrelic/_stack_trace.rhtml",
215
+ "ui/views/newrelic/_table.rhtml",
216
+ "ui/views/newrelic/explain_sql.rhtml",
217
+ "ui/views/newrelic/file/images/arrow-close.png",
218
+ "ui/views/newrelic/file/images/arrow-open.png",
219
+ "ui/views/newrelic/file/images/blue_bar.gif",
220
+ "ui/views/newrelic/file/images/file_icon.png",
221
+ "ui/views/newrelic/file/images/gray_bar.gif",
222
+ "ui/views/newrelic/file/images/new-relic-rpm-desktop.gif",
223
+ "ui/views/newrelic/file/images/new_relic_rpm_desktop.gif",
224
+ "ui/views/newrelic/file/images/textmate.png",
225
+ "ui/views/newrelic/file/javascript/jquery-1.4.2.js",
226
+ "ui/views/newrelic/file/javascript/transaction_sample.js",
227
+ "ui/views/newrelic/file/stylesheets/style.css",
228
+ "ui/views/newrelic/index.rhtml",
229
+ "ui/views/newrelic/sample_not_found.rhtml",
230
+ "ui/views/newrelic/show_sample.rhtml",
231
+ "ui/views/newrelic/show_source.rhtml",
232
+ "ui/views/newrelic/threads.rhtml",
233
+ "vendor/gems/dependency_detection-0.0.1.build/LICENSE",
234
+ "vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb",
235
+ "vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb",
236
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb",
237
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb",
238
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb",
239
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb",
240
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb",
241
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/apdex.rb",
242
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb",
243
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb",
244
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb",
245
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb",
246
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb",
247
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb",
248
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb",
249
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb",
250
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb",
251
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb",
252
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb",
253
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb",
254
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb",
255
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb",
256
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb",
257
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb",
258
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb",
259
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb",
260
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb",
261
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb",
262
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb",
263
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb",
264
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb",
265
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb",
266
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb",
267
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb",
268
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb",
269
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb",
270
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb",
271
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb",
272
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb",
273
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb",
274
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb",
275
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb",
276
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb",
277
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb",
278
+ "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb"
279
+ ]
280
+ s.homepage = "http://www.github.com/newrelic/rpm"
281
+ s.post_install_message = "\nPLEASE NOTE:\n\nDeveloper Mode is now a Rack middleware.\n\nDeveloper Mode is no longer available in Rails 2.1 and earlier.\nHowever, starting in version 2.12 you can use Developer Mode in any\nRack based framework, in addition to Rails. To install developer mode\nin a non-Rails application, just add NewRelic::Rack::DeveloperMode to\nyour middleware stack.\n\nIf you are using JRuby, we recommend using at least version 1.4 or \nlater because of issues with the implementation of the timeout library.\n\nRefer to the README.md file for more information.\n\nPlease see http://github.com/newrelic/rpm/blob/master/CHANGELOG\nfor a complete description of the features and enhancements available\nin version 3.2 of the Ruby Agent.\n \n"
282
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Agent"]
283
+ s.require_paths = ["lib"]
284
+ s.rubygems_version = "1.8.10"
285
+ s.summary = "New Relic Ruby Agent"
286
+
287
+ if s.respond_to? :specification_version then
288
+ s.specification_version = 3
289
+
290
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
291
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
292
+ s.add_development_dependency(%q<mocha>, [">= 0"])
293
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
294
+ else
295
+ s.add_dependency(%q<jeweler>, [">= 0"])
296
+ s.add_dependency(%q<mocha>, [">= 0"])
297
+ s.add_dependency(%q<shoulda>, [">= 0"])
298
+ end
299
+ else
300
+ s.add_dependency(%q<jeweler>, [">= 0"])
301
+ s.add_dependency(%q<mocha>, [">= 0"])
302
+ s.add_dependency(%q<shoulda>, [">= 0"])
303
+ end
304
+ end
305
+
@@ -1,57 +1,181 @@
1
- # NewRelic instrumentation for DataMapper
2
- # For now, we have to refer to all db metrics as "ActiveRecord"
3
- if defined? DataMapper
4
-
5
- DataMapper::Model.class_eval do
6
- add_method_tracer :get, 'ActiveRecord/#{self.name}/find'
7
- add_method_tracer :first, 'ActiveRecord/#{self.name}/find'
8
- add_method_tracer :first_or_create, 'ActiveRecord/#{self.name}/find'
9
- add_method_tracer :all, 'ActiveRecord/#{self.name}/find_all'
10
- end
11
- DataMapper::Resource.class_eval do
1
+ ## NewRelic instrumentation for DataMapper
2
+ #
3
+ # Instrumenting DM has different key challenges versus AR:
4
+ #
5
+ # 1. The hooking of SQL logging in DM is decoupled from any knowledge of the
6
+ # Model#method that invoked it. But on the positive side, the duration is
7
+ # already calculated for you (and it happens inside the C-based DO code, so
8
+ # it's faster than a Ruby equivalent).
9
+ #
10
+ # 2. There are a lot more entry points that need to be hooked in order to
11
+ # understand call flow: DM::Model (model class) vs. DM::Resource (model
12
+ # instance) vs. DM::Collection (collection of model instances). And
13
+ # others.
14
+ #
15
+ # 3. Strategic Eager Loading (SEL) combined with separately-grouped
16
+ # lazy-loaded attributes presents a unique problem for tying resulting
17
+ # SEL-invoked SQL calls to their proper scope.
18
+ #
19
+ # NOTE: On using "Database" versus "ActiveRecord" as base metric name
20
+ #
21
+ # Using "Database" as the metric name base seems to properly identify methods
22
+ # as being DB-related in call graphs, but certain RPM views that show
23
+ # aggregations of DB CPM, etc still seem to rely solely on "ActiveRecord"
24
+ # being the base name, thus AFAICT "Database" calls to this are lost. (Though
25
+ # I haven't yet tested "Database/SQL/{find/save/destroy/all}" yet, as it seems
26
+ # like an intuitively good name to use.)
27
+ #
28
+ # So far I think these are the rules:
29
+ #
30
+ # - ActiveRecord/{find/save/destroy} populates "Database Throughput" and
31
+ # "Database Response Time" in the Database tab. [non-scoped]
32
+ #
33
+ # - ActiveRecord/all populates the main Overview tab of DB time. (still
34
+ # unsure about this one). [non-scoped]
35
+ #
36
+ # These metrics are represented as :push_scope => false or included as the
37
+ # non-first metric in trace_execution_scoped() (docs say only first counts
38
+ # towards scope) so they don't show up ine normal call graph/trace.
12
39
 
13
- @@my_sql_defined = defined? ActiveRecord::ConnectionAdapters::MysqlAdapter
14
- @@postgres_defined = defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
40
+ if defined? ::DataMapper
15
41
 
16
- for method in [:query] do
17
- add_method_tracer method, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/execute'
18
- add_method_tracer method, 'ActiveRecord/all', :push_scope => false
19
- end
20
- for method in [:update, :save] do
21
- add_method_tracer method, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
22
- add_method_tracer method, 'ActiveRecord/save', :push_scope => false
23
- end
24
- add_method_tracer :destroy, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/destroy'
25
- add_method_tracer :destroy, 'ActiveRecord/destroy', :push_scope => false
26
-
27
- def log_with_newrelic_instrumentation(sql, name, &block)
28
- # if we aren't in a blamed context, then add one so that we can
29
- # see that controllers are calling SQL directly we check
30
- # scope_depth vs 2 since the controller is 1
31
- if NewRelic::Agent.instance.transaction_sampler.scope_depth < 2
32
- self.class.trace_method_execution "Database/DirectSQL", true, true do
33
- log_with_capture_sql(sql, name, &block)
34
- end
35
- else
36
- log_with_capture_sql(sql, name, &block)
37
- end
42
+ # DM::Model class methods
43
+ ::DataMapper::Model.class_eval do
44
+
45
+ add_method_tracer :get, 'ActiveRecord/#{self.name}/get'
46
+ add_method_tracer :first, 'ActiveRecord/#{self.name}/first'
47
+ add_method_tracer :last, 'ActiveRecord/#{self.name}/last'
48
+ add_method_tracer :all, 'ActiveRecord/#{self.name}/all'
49
+
50
+ add_method_tracer :create, 'ActiveRecord/#{self.name}/create'
51
+ add_method_tracer :create!, 'ActiveRecord/#{self.name}/create'
52
+ add_method_tracer :update, 'ActiveRecord/#{self.name}/update'
53
+ add_method_tracer :update!, 'ActiveRecord/#{self.name}/update'
54
+ add_method_tracer :destroy, 'ActiveRecord/#{self.name}/destroy'
55
+ add_method_tracer :destroy!, 'ActiveRecord/#{self.name}/destroy'
56
+
57
+ # For dm-aggregates and partial dm-ar-finders support:
58
+ for method in [ :aggregate, :find, :find_by_sql ] do
59
+ next unless method_defined? method
60
+ add_method_tracer(method, 'ActiveRecord/#{self.name}/' + method.to_s)
38
61
  end
39
-
40
- def log_with_capture_sql(sql, name, &block)
41
- if @@my_sql_defined && self.is_a?(ActiveRecord::ConnectionAdapters::MysqlAdapter)
42
- config = @config
43
- elsif @@postgres_defined && self.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
44
- config = @config
45
- else
46
- config = nil
47
- end
48
-
49
- t0 = Time.now
50
- result = log_without_newrelic_instrumentation(sql, name, &block)
51
-
52
- NewRelic::Agent.instance.transaction_sampler.notice_sql(sql, config, (Time.now - t0).to_f)
53
-
54
- result
62
+
63
+ end
64
+
65
+ # DM's Model instance (Resource) methods
66
+ ::DataMapper::Resource.class_eval do
67
+
68
+ add_method_tracer :update, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/update'
69
+ add_method_tracer :update!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/update'
70
+ add_method_tracer :save, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
71
+ add_method_tracer :save!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
72
+ add_method_tracer :destroy, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/destroy'
73
+ add_method_tracer :destroy!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/destroy'
74
+
75
+ end
76
+
77
+ # DM's Collection instance methods
78
+ ::DataMapper::Collection.class_eval do
79
+
80
+ add_method_tracer :get, 'ActiveRecord/#{self.name}/get'
81
+ add_method_tracer :first, 'ActiveRecord/#{self.name}/first'
82
+ add_method_tracer :last, 'ActiveRecord/#{self.name}/last'
83
+ add_method_tracer :all, 'ActiveRecord/#{self.name}/all'
84
+
85
+ add_method_tracer :lazy_load, 'ActiveRecord/#{self.name}/lazy_load'
86
+
87
+ add_method_tracer :create, 'ActiveRecord/#{self.name}/create'
88
+ add_method_tracer :create!, 'ActiveRecord/#{self.name}/create'
89
+ add_method_tracer :update, 'ActiveRecord/#{self.name}/update'
90
+ add_method_tracer :update!, 'ActiveRecord/#{self.name}/update'
91
+ add_method_tracer :destroy, 'ActiveRecord/#{self.name}/destroy'
92
+ add_method_tracer :destroy!, 'ActiveRecord/#{self.name}/destroy'
93
+
94
+ # For dm-aggregates support:
95
+ for method in [ :aggregate ] do
96
+ next unless method_defined? method
97
+ add_method_tracer(method, 'ActiveRecord/#{self.name}/' + method.to_s)
55
98
  end
99
+
56
100
  end
57
- end
101
+
102
+ # Catch the two entry points into DM::Repository::Adapter that bypass CRUD
103
+ # (for when SQL is run directly).
104
+ ::DataMapper::Adapters::DataObjectsAdapter.class_eval do
105
+
106
+ add_method_tracer :select, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/select'
107
+ add_method_tracer :execute, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/execute'
108
+
109
+ end if defined? ::DataMapper::Adapters::DataObjectsAdapter
110
+
111
+ # DM::Validations overrides Model#create, but currently in a way that makes it
112
+ # impossible to instrument from one place. I've got a patch pending inclusion
113
+ # to make it instrumentable by putting the create method inside ClassMethods.
114
+ # This will pick it up if/when that patch is accepted.
115
+ ::DataMapper::Validations::ClassMethods.class_eval do
116
+
117
+ next unless method_defined? :create
118
+ add_method_tracer :create, 'ActiveRecord/#{self.name}/create'
119
+
120
+ end if defined? ::DataMapper::Validations::ClassMethods
121
+
122
+ # NOTE: DM::Transaction basically calls commit() twice, so as-is it will show
123
+ # up in traces twice -- second time subordinate to the first's scope. Works
124
+ # well enough.
125
+ ::DataMapper::Transaction.module_eval do
126
+ add_method_tracer :commit, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/commit'
127
+ end if defined? ::DataMapper::Transaction
128
+
129
+ module NewRelic
130
+ module Agent
131
+ module Instrumentation
132
+ module DataMapperInstrumentation
133
+
134
+ def self.included(klass)
135
+ klass.class_eval do
136
+ alias_method :log_without_newrelic_instrumentation, :log
137
+ alias_method :log, :log_with_newrelic_instrumentation
138
+ end
139
+ end
140
+
141
+ # Unlike in AR, log is called in DM after the query actually ran,
142
+ # complete with metrics. Since DO has already calculated the
143
+ # duration, there's nothing more to measure, so just record and log.
144
+ #
145
+ # We rely on the assumption that all possible entry points have been
146
+ # hooked with tracers, ensuring that notice_sql attaches this SQL to
147
+ # the proper call scope.
148
+ def log_with_newrelic_instrumentation(msg)
149
+ return unless NewRelic::Agent.is_execution_traced?
150
+ return unless operation = case msg.query
151
+ when /^\s*select/i then 'find'
152
+ when /^\s*(update|insert)/i then 'save'
153
+ when /^\s*delete/i then 'destroy'
154
+ else nil
155
+ end
156
+
157
+ # FYI: self.to_s will yield connection URI string.
158
+ duration = msg.duration / 1000000.0
159
+
160
+ # Attach SQL to current segment/scope.
161
+ NewRelic::Agent.instance.transaction_sampler.notice_sql(msg.query, nil, duration)
162
+
163
+ # Record query duration associated with each of the desired metrics.
164
+ metrics = [ "ActiveRecord/#{operation}", 'ActiveRecord/all' ]
165
+ metrics.each do |metric|
166
+ NewRelic::Agent.instance.stats_engine.get_stats_no_scope(metric).trace_call(duration)
167
+ end
168
+ ensure
169
+ log_without_newrelic_instrumentation(msg)
170
+ end
171
+
172
+ end # DataMapperInstrumentation
173
+ end # Instrumentation
174
+ end # Agent
175
+ end # NewRelic
176
+
177
+ ::DataObjects::Connection.class_eval do
178
+ include ::NewRelic::Agent::Instrumentation::DataMapperInstrumentation
179
+ end if defined? ::DataObjects::Connection
180
+
181
+ end # if defined? DataMapper
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 3
5
5
  MINOR = 2
6
6
  TINY = 0
7
- BUILD = 2 #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 3 #'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
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolores_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 107
4
+ hash: 105
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
- - 2
11
- version: 3.2.0.2
10
+ - 3
11
+ version: 3.2.0.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Bill Kayser
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2012-04-27 00:00:00 Z
22
+ date: 2012-05-02 00:00:00 Z
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: jeweler
@@ -90,7 +90,7 @@ files:
90
90
  - cert/cacert.pem
91
91
  - cert/oldsite.pem
92
92
  - cert/site.pem
93
- - dolores_rpm-3.3.4.fork.gem
93
+ - dolores_rpm.gemspec
94
94
  - install.rb
95
95
  - lib/conditional_vendored_dependency_detection.rb
96
96
  - lib/conditional_vendored_metric_parser.rb
@@ -390,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
390
  requirements: []
391
391
 
392
392
  rubyforge_project:
393
- rubygems_version: 1.8.23
393
+ rubygems_version: 1.8.10
394
394
  signing_key:
395
395
  specification_version: 3
396
396
  summary: New Relic Ruby Agent
Binary file