factorylabs-newrelic_rpm 2.10.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +354 -0
- data/LICENSE +37 -0
- data/README-2.10.2.2 +10 -0
- data/README.md +138 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic_cmd +4 -0
- data/cert/cacert.pem +34 -0
- data/install.rb +45 -0
- data/lib/new_relic/agent.rb +315 -0
- data/lib/new_relic/agent/agent.rb +647 -0
- data/lib/new_relic/agent/busy_calculator.rb +86 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/collection_helper.rb +66 -0
- data/lib/new_relic/agent/error_collector.rb +117 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +91 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +389 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +90 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +12 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +24 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +26 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +8 -0
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +199 -0
- data/lib/new_relic/agent/instrumentation/net.rb +21 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +20 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +109 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +59 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +24 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +39 -0
- data/lib/new_relic/agent/method_tracer.rb +348 -0
- data/lib/new_relic/agent/patch_const_missing.rb +125 -0
- data/lib/new_relic/agent/sampler.rb +46 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +50 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +141 -0
- data/lib/new_relic/agent/samplers/mongrel_sampler.rb +23 -0
- data/lib/new_relic/agent/samplers/object_sampler.rb +24 -0
- data/lib/new_relic/agent/shim_agent.rb +21 -0
- data/lib/new_relic/agent/stats_engine.rb +22 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +116 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +74 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +154 -0
- data/lib/new_relic/agent/transaction_sampler.rb +315 -0
- data/lib/new_relic/agent/worker_loop.rb +118 -0
- data/lib/new_relic/commands/deployments.rb +145 -0
- data/lib/new_relic/commands/new_relic_commands.rb +30 -0
- data/lib/new_relic/control.rb +484 -0
- data/lib/new_relic/control/external.rb +13 -0
- data/lib/new_relic/control/merb.rb +24 -0
- data/lib/new_relic/control/rails.rb +151 -0
- data/lib/new_relic/control/ruby.rb +36 -0
- data/lib/new_relic/control/sinatra.rb +14 -0
- data/lib/new_relic/histogram.rb +89 -0
- data/lib/new_relic/local_environment.rb +299 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +42 -0
- data/lib/new_relic/metric_parser.rb +124 -0
- data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
- data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
- data/lib/new_relic/metric_parser/active_record.rb +25 -0
- data/lib/new_relic/metric_parser/controller.rb +54 -0
- data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
- data/lib/new_relic/metric_parser/errors.rb +6 -0
- data/lib/new_relic/metric_parser/external.rb +50 -0
- data/lib/new_relic/metric_parser/mem_cache.rb +12 -0
- data/lib/new_relic/metric_parser/other_transaction.rb +15 -0
- data/lib/new_relic/metric_parser/view.rb +61 -0
- data/lib/new_relic/metric_parser/web_frontend.rb +14 -0
- data/lib/new_relic/metric_parser/web_service.rb +9 -0
- data/lib/new_relic/metric_spec.rb +67 -0
- data/lib/new_relic/metrics.rb +7 -0
- data/lib/new_relic/noticed_error.rb +23 -0
- data/lib/new_relic/rack/metric_app.rb +56 -0
- data/lib/new_relic/rack/mongrel_rpm.ru +25 -0
- data/lib/new_relic/rack/newrelic.yml +26 -0
- data/lib/new_relic/rack_app.rb +5 -0
- data/lib/new_relic/recipes.rb +82 -0
- data/lib/new_relic/stats.rb +362 -0
- data/lib/new_relic/transaction_analysis.rb +121 -0
- data/lib/new_relic/transaction_sample.rb +671 -0
- data/lib/new_relic/version.rb +54 -0
- data/lib/new_relic_api.rb +276 -0
- data/lib/newrelic_rpm.rb +45 -0
- data/lib/tasks/all.rb +4 -0
- data/lib/tasks/install.rake +7 -0
- data/lib/tasks/tests.rake +15 -0
- data/newrelic.yml +227 -0
- data/newrelic_rpm.gemspec +214 -0
- data/recipes/newrelic.rb +6 -0
- data/test/active_record_fixtures.rb +55 -0
- data/test/config/newrelic.yml +46 -0
- data/test/config/test_control.rb +38 -0
- data/test/new_relic/agent/active_record_instrumentation_test.rb +268 -0
- data/test/new_relic/agent/agent_controller_test.rb +254 -0
- data/test/new_relic/agent/agent_test_controller.rb +78 -0
- data/test/new_relic/agent/busy_calculator_test.rb +79 -0
- data/test/new_relic/agent/classloader_patch_test.rb +56 -0
- data/test/new_relic/agent/collection_helper_test.rb +125 -0
- data/test/new_relic/agent/error_collector_test.rb +173 -0
- data/test/new_relic/agent/method_tracer_test.rb +340 -0
- data/test/new_relic/agent/metric_data_test.rb +56 -0
- data/test/new_relic/agent/mock_ar_connection.rb +40 -0
- data/test/new_relic/agent/mock_scope_listener.rb +23 -0
- data/test/new_relic/agent/net_instrumentation_test.rb +63 -0
- data/test/new_relic/agent/rpm_agent_test.rb +125 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +79 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +88 -0
- data/test/new_relic/agent/stats_engine/stats_engine_test.rb +184 -0
- data/test/new_relic/agent/task_instrumentation_test.rb +177 -0
- data/test/new_relic/agent/testable_agent.rb +13 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
- data/test/new_relic/agent/transaction_sample_test.rb +186 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +404 -0
- data/test/new_relic/agent/worker_loop_test.rb +103 -0
- data/test/new_relic/control_test.rb +110 -0
- data/test/new_relic/delayed_job_test.rb +108 -0
- data/test/new_relic/deployments_api_test.rb +68 -0
- data/test/new_relic/environment_test.rb +75 -0
- data/test/new_relic/metric_parser_test.rb +172 -0
- data/test/new_relic/metric_spec_test.rb +177 -0
- data/test/new_relic/shim_agent_test.rb +9 -0
- data/test/new_relic/stats_test.rb +291 -0
- data/test/new_relic/version_number_test.rb +76 -0
- data/test/test_helper.rb +53 -0
- data/test/ui/newrelic_controller_test.rb +14 -0
- data/test/ui/newrelic_helper_test.rb +53 -0
- data/ui/controllers/newrelic_controller.rb +220 -0
- data/ui/helpers/google_pie_chart.rb +49 -0
- data/ui/helpers/newrelic_helper.rb +320 -0
- data/ui/views/layouts/newrelic_default.rhtml +47 -0
- data/ui/views/newrelic/_explain_plans.rhtml +27 -0
- data/ui/views/newrelic/_sample.rhtml +19 -0
- data/ui/views/newrelic/_segment.rhtml +28 -0
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
- data/ui/views/newrelic/_segment_row.rhtml +14 -0
- data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +20 -0
- data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
- data/ui/views/newrelic/_sql_row.rhtml +11 -0
- data/ui/views/newrelic/_stack_trace.rhtml +30 -0
- data/ui/views/newrelic/_table.rhtml +12 -0
- data/ui/views/newrelic/explain_sql.rhtml +42 -0
- data/ui/views/newrelic/images/arrow-close.png +0 -0
- data/ui/views/newrelic/images/arrow-open.png +0 -0
- data/ui/views/newrelic/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/images/file_icon.png +0 -0
- data/ui/views/newrelic/images/gray_bar.gif +0 -0
- data/ui/views/newrelic/images/new-relic-rpm-desktop.gif +0 -0
- data/ui/views/newrelic/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/images/textmate.png +0 -0
- data/ui/views/newrelic/index.rhtml +57 -0
- data/ui/views/newrelic/javascript/prototype-scriptaculous.js +7288 -0
- data/ui/views/newrelic/javascript/transaction_sample.js +107 -0
- data/ui/views/newrelic/sample_not_found.rhtml +2 -0
- data/ui/views/newrelic/show_sample.rhtml +80 -0
- data/ui/views/newrelic/show_source.rhtml +3 -0
- data/ui/views/newrelic/stylesheets/style.css +484 -0
- data/ui/views/newrelic/threads.rhtml +52 -0
- metadata +238 -0
@@ -0,0 +1,214 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{newrelic_rpm}
|
8
|
+
s.version = "2.10.2.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Bill Kayser"]
|
12
|
+
s.date = %q{2010-02-04}
|
13
|
+
s.description = %q{New Relic RPM is a Ruby performance management system, developed by
|
14
|
+
New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
|
15
|
+
information about the performance of your Ruby on Rails or Merb
|
16
|
+
application as it runs in production. The New Relic Agent is
|
17
|
+
dual-purposed as a either a Rails plugin or a Gem, hosted on
|
18
|
+
http://github.com/newrelic/rpm/tree/master.
|
19
|
+
}
|
20
|
+
s.email = %q{support@newrelic.com}
|
21
|
+
s.executables = ["mongrel_rpm", "newrelic_cmd"]
|
22
|
+
s.extra_rdoc_files = [
|
23
|
+
"LICENSE",
|
24
|
+
"README-2.10.2.2",
|
25
|
+
"README.md"
|
26
|
+
]
|
27
|
+
s.files = [
|
28
|
+
"CHANGELOG",
|
29
|
+
"LICENSE",
|
30
|
+
"README-2.10.2.2",
|
31
|
+
"README.md",
|
32
|
+
"bin/mongrel_rpm",
|
33
|
+
"bin/newrelic_cmd",
|
34
|
+
"cert/cacert.pem",
|
35
|
+
"install.rb",
|
36
|
+
"lib/new_relic/agent.rb",
|
37
|
+
"lib/new_relic/agent/agent.rb",
|
38
|
+
"lib/new_relic/agent/busy_calculator.rb",
|
39
|
+
"lib/new_relic/agent/chained_call.rb",
|
40
|
+
"lib/new_relic/agent/collection_helper.rb",
|
41
|
+
"lib/new_relic/agent/error_collector.rb",
|
42
|
+
"lib/new_relic/agent/instrumentation/active_merchant.rb",
|
43
|
+
"lib/new_relic/agent/instrumentation/active_record_instrumentation.rb",
|
44
|
+
"lib/new_relic/agent/instrumentation/authlogic.rb",
|
45
|
+
"lib/new_relic/agent/instrumentation/controller_instrumentation.rb",
|
46
|
+
"lib/new_relic/agent/instrumentation/data_mapper.rb",
|
47
|
+
"lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb",
|
48
|
+
"lib/new_relic/agent/instrumentation/memcache.rb",
|
49
|
+
"lib/new_relic/agent/instrumentation/merb/controller.rb",
|
50
|
+
"lib/new_relic/agent/instrumentation/merb/errors.rb",
|
51
|
+
"lib/new_relic/agent/instrumentation/metric_frame.rb",
|
52
|
+
"lib/new_relic/agent/instrumentation/net.rb",
|
53
|
+
"lib/new_relic/agent/instrumentation/passenger_instrumentation.rb",
|
54
|
+
"lib/new_relic/agent/instrumentation/rack.rb",
|
55
|
+
"lib/new_relic/agent/instrumentation/rails/action_controller.rb",
|
56
|
+
"lib/new_relic/agent/instrumentation/rails/action_web_service.rb",
|
57
|
+
"lib/new_relic/agent/instrumentation/rails/errors.rb",
|
58
|
+
"lib/new_relic/agent/instrumentation/sinatra.rb",
|
59
|
+
"lib/new_relic/agent/method_tracer.rb",
|
60
|
+
"lib/new_relic/agent/patch_const_missing.rb",
|
61
|
+
"lib/new_relic/agent/sampler.rb",
|
62
|
+
"lib/new_relic/agent/samplers/cpu_sampler.rb",
|
63
|
+
"lib/new_relic/agent/samplers/memory_sampler.rb",
|
64
|
+
"lib/new_relic/agent/samplers/mongrel_sampler.rb",
|
65
|
+
"lib/new_relic/agent/samplers/object_sampler.rb",
|
66
|
+
"lib/new_relic/agent/shim_agent.rb",
|
67
|
+
"lib/new_relic/agent/stats_engine.rb",
|
68
|
+
"lib/new_relic/agent/stats_engine/metric_stats.rb",
|
69
|
+
"lib/new_relic/agent/stats_engine/samplers.rb",
|
70
|
+
"lib/new_relic/agent/stats_engine/transactions.rb",
|
71
|
+
"lib/new_relic/agent/transaction_sampler.rb",
|
72
|
+
"lib/new_relic/agent/worker_loop.rb",
|
73
|
+
"lib/new_relic/commands/deployments.rb",
|
74
|
+
"lib/new_relic/commands/new_relic_commands.rb",
|
75
|
+
"lib/new_relic/control.rb",
|
76
|
+
"lib/new_relic/control/external.rb",
|
77
|
+
"lib/new_relic/control/merb.rb",
|
78
|
+
"lib/new_relic/control/rails.rb",
|
79
|
+
"lib/new_relic/control/ruby.rb",
|
80
|
+
"lib/new_relic/control/sinatra.rb",
|
81
|
+
"lib/new_relic/histogram.rb",
|
82
|
+
"lib/new_relic/local_environment.rb",
|
83
|
+
"lib/new_relic/merbtasks.rb",
|
84
|
+
"lib/new_relic/metric_data.rb",
|
85
|
+
"lib/new_relic/metric_parser.rb",
|
86
|
+
"lib/new_relic/metric_parser/action_mailer.rb",
|
87
|
+
"lib/new_relic/metric_parser/active_merchant.rb",
|
88
|
+
"lib/new_relic/metric_parser/active_record.rb",
|
89
|
+
"lib/new_relic/metric_parser/controller.rb",
|
90
|
+
"lib/new_relic/metric_parser/controller_cpu.rb",
|
91
|
+
"lib/new_relic/metric_parser/errors.rb",
|
92
|
+
"lib/new_relic/metric_parser/external.rb",
|
93
|
+
"lib/new_relic/metric_parser/mem_cache.rb",
|
94
|
+
"lib/new_relic/metric_parser/other_transaction.rb",
|
95
|
+
"lib/new_relic/metric_parser/view.rb",
|
96
|
+
"lib/new_relic/metric_parser/web_frontend.rb",
|
97
|
+
"lib/new_relic/metric_parser/web_service.rb",
|
98
|
+
"lib/new_relic/metric_spec.rb",
|
99
|
+
"lib/new_relic/metrics.rb",
|
100
|
+
"lib/new_relic/noticed_error.rb",
|
101
|
+
"lib/new_relic/rack/metric_app.rb",
|
102
|
+
"lib/new_relic/rack/mongrel_rpm.ru",
|
103
|
+
"lib/new_relic/rack/newrelic.yml",
|
104
|
+
"lib/new_relic/rack_app.rb",
|
105
|
+
"lib/new_relic/recipes.rb",
|
106
|
+
"lib/new_relic/stats.rb",
|
107
|
+
"lib/new_relic/transaction_analysis.rb",
|
108
|
+
"lib/new_relic/transaction_sample.rb",
|
109
|
+
"lib/new_relic/version.rb",
|
110
|
+
"lib/new_relic_api.rb",
|
111
|
+
"lib/newrelic_rpm.rb",
|
112
|
+
"lib/tasks/all.rb",
|
113
|
+
"lib/tasks/install.rake",
|
114
|
+
"lib/tasks/tests.rake",
|
115
|
+
"newrelic.yml",
|
116
|
+
"recipes/newrelic.rb",
|
117
|
+
"test/active_record_fixtures.rb",
|
118
|
+
"test/config/newrelic.yml",
|
119
|
+
"test/config/test_control.rb",
|
120
|
+
"test/new_relic/agent/active_record_instrumentation_test.rb",
|
121
|
+
"test/new_relic/agent/agent_controller_test.rb",
|
122
|
+
"test/new_relic/agent/agent_test_controller.rb",
|
123
|
+
"test/new_relic/agent/busy_calculator_test.rb",
|
124
|
+
"test/new_relic/agent/classloader_patch_test.rb",
|
125
|
+
"test/new_relic/agent/collection_helper_test.rb",
|
126
|
+
"test/new_relic/agent/error_collector_test.rb",
|
127
|
+
"test/new_relic/agent/method_tracer_test.rb",
|
128
|
+
"test/new_relic/agent/metric_data_test.rb",
|
129
|
+
"test/new_relic/agent/mock_ar_connection.rb",
|
130
|
+
"test/new_relic/agent/mock_scope_listener.rb",
|
131
|
+
"test/new_relic/agent/net_instrumentation_test.rb",
|
132
|
+
"test/new_relic/agent/rpm_agent_test.rb",
|
133
|
+
"test/new_relic/agent/stats_engine/metric_stats_test.rb",
|
134
|
+
"test/new_relic/agent/stats_engine/samplers_test.rb",
|
135
|
+
"test/new_relic/agent/stats_engine/stats_engine_test.rb",
|
136
|
+
"test/new_relic/agent/task_instrumentation_test.rb",
|
137
|
+
"test/new_relic/agent/testable_agent.rb",
|
138
|
+
"test/new_relic/agent/transaction_sample_builder_test.rb",
|
139
|
+
"test/new_relic/agent/transaction_sample_test.rb",
|
140
|
+
"test/new_relic/agent/transaction_sampler_test.rb",
|
141
|
+
"test/new_relic/agent/worker_loop_test.rb",
|
142
|
+
"test/new_relic/control_test.rb",
|
143
|
+
"test/new_relic/delayed_job_test.rb",
|
144
|
+
"test/new_relic/deployments_api_test.rb",
|
145
|
+
"test/new_relic/environment_test.rb",
|
146
|
+
"test/new_relic/metric_parser_test.rb",
|
147
|
+
"test/new_relic/metric_spec_test.rb",
|
148
|
+
"test/new_relic/shim_agent_test.rb",
|
149
|
+
"test/new_relic/stats_test.rb",
|
150
|
+
"test/new_relic/version_number_test.rb",
|
151
|
+
"test/test_helper.rb",
|
152
|
+
"test/ui/newrelic_controller_test.rb",
|
153
|
+
"test/ui/newrelic_helper_test.rb",
|
154
|
+
"ui/controllers/newrelic_controller.rb",
|
155
|
+
"ui/helpers/google_pie_chart.rb",
|
156
|
+
"ui/helpers/newrelic_helper.rb",
|
157
|
+
"ui/views/layouts/newrelic_default.rhtml",
|
158
|
+
"ui/views/newrelic/_explain_plans.rhtml",
|
159
|
+
"ui/views/newrelic/_sample.rhtml",
|
160
|
+
"ui/views/newrelic/_segment.rhtml",
|
161
|
+
"ui/views/newrelic/_segment_limit_message.rhtml",
|
162
|
+
"ui/views/newrelic/_segment_row.rhtml",
|
163
|
+
"ui/views/newrelic/_show_sample_detail.rhtml",
|
164
|
+
"ui/views/newrelic/_show_sample_sql.rhtml",
|
165
|
+
"ui/views/newrelic/_show_sample_summary.rhtml",
|
166
|
+
"ui/views/newrelic/_sql_row.rhtml",
|
167
|
+
"ui/views/newrelic/_stack_trace.rhtml",
|
168
|
+
"ui/views/newrelic/_table.rhtml",
|
169
|
+
"ui/views/newrelic/explain_sql.rhtml",
|
170
|
+
"ui/views/newrelic/images/arrow-close.png",
|
171
|
+
"ui/views/newrelic/images/arrow-open.png",
|
172
|
+
"ui/views/newrelic/images/blue_bar.gif",
|
173
|
+
"ui/views/newrelic/images/file_icon.png",
|
174
|
+
"ui/views/newrelic/images/gray_bar.gif",
|
175
|
+
"ui/views/newrelic/images/new-relic-rpm-desktop.gif",
|
176
|
+
"ui/views/newrelic/images/new_relic_rpm_desktop.gif",
|
177
|
+
"ui/views/newrelic/images/textmate.png",
|
178
|
+
"ui/views/newrelic/index.rhtml",
|
179
|
+
"ui/views/newrelic/javascript/prototype-scriptaculous.js",
|
180
|
+
"ui/views/newrelic/javascript/transaction_sample.js",
|
181
|
+
"ui/views/newrelic/sample_not_found.rhtml",
|
182
|
+
"ui/views/newrelic/show_sample.rhtml",
|
183
|
+
"ui/views/newrelic/show_source.rhtml",
|
184
|
+
"ui/views/newrelic/stylesheets/style.css",
|
185
|
+
"ui/views/newrelic/threads.rhtml"
|
186
|
+
]
|
187
|
+
s.homepage = %q{http://www.github.com/newrelic/rpm}
|
188
|
+
s.post_install_message = %q{
|
189
|
+
Important Note!
|
190
|
+
|
191
|
+
Starting in 2.10.2 we created an external 'rpm_contrib' gem and moved
|
192
|
+
some of the contributed instrumentation into it. If you were
|
193
|
+
using this gem to monitor DelayedJob then you will need to
|
194
|
+
install the rpm_contrib gem instead.
|
195
|
+
|
196
|
+
See http://github.com/newrelic/rpm_contrib
|
197
|
+
|
198
|
+
}
|
199
|
+
s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source", "--title", "New Relic RPM", "README.md"]
|
200
|
+
s.require_paths = ["lib"]
|
201
|
+
s.rubygems_version = %q{1.3.5}
|
202
|
+
s.summary = %q{New Relic Ruby Performance Monitoring Agent}
|
203
|
+
|
204
|
+
if s.respond_to? :specification_version then
|
205
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
206
|
+
s.specification_version = 3
|
207
|
+
|
208
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
209
|
+
else
|
210
|
+
end
|
211
|
+
else
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
data/recipes/newrelic.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Some test models
|
2
|
+
# These will get created and dropped during the active record tests
|
3
|
+
# Be sure and call setup and teardown
|
4
|
+
module ActiveRecordFixtures
|
5
|
+
extend self
|
6
|
+
def setup
|
7
|
+
ActiveRecordFixtures::Order.setup
|
8
|
+
ActiveRecordFixtures::Shipment.setup
|
9
|
+
end
|
10
|
+
def teardown
|
11
|
+
ActiveRecordFixtures::Shipment.teardown
|
12
|
+
ActiveRecordFixtures::Order.teardown
|
13
|
+
end
|
14
|
+
class Order < ActiveRecord::Base
|
15
|
+
self.table_name = 'newrelic_test_orders'
|
16
|
+
has_and_belongs_to_many :shipments, :class_name => 'ActiveRecordFixtures::Shipment'
|
17
|
+
def self.setup
|
18
|
+
connection.create_table self.table_name, :force => true do |t|
|
19
|
+
t.column :name, :string
|
20
|
+
end
|
21
|
+
end
|
22
|
+
def self.add_delay
|
23
|
+
# Introduce a 500 ms delay into db operations on Orders
|
24
|
+
def connection.log_info *args
|
25
|
+
sleep 0.5
|
26
|
+
super *args
|
27
|
+
end
|
28
|
+
end
|
29
|
+
def self.teardown
|
30
|
+
connection.drop_table table_name
|
31
|
+
def connection.log_info *args
|
32
|
+
super *args
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Shipment < ActiveRecord::Base
|
38
|
+
self.table_name = 'newrelic_test_shipment'
|
39
|
+
has_and_belongs_to_many :orders, :class_name => 'ActiveRecordFixtures::Order'
|
40
|
+
def self.setup
|
41
|
+
connection.create_table self.table_name, :force => true do |t|
|
42
|
+
# no other columns
|
43
|
+
end
|
44
|
+
connection.create_table 'orders_shipments', :force => true, :id => false do |t|
|
45
|
+
t.column :order_id, :integer
|
46
|
+
t.column :shipment_id, :integer
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.teardown
|
51
|
+
connection.drop_table 'orders_shipments'
|
52
|
+
connection.drop_table self.table_name
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# This is the config file loaded when running unit tests locally.
|
2
|
+
common: &default_settings
|
3
|
+
transaction_tracer:
|
4
|
+
enabled: true
|
5
|
+
record_sql: raw
|
6
|
+
|
7
|
+
test:
|
8
|
+
<<: *default_settings
|
9
|
+
host: localhost
|
10
|
+
port: 3000
|
11
|
+
log_level: info
|
12
|
+
capture_params: true
|
13
|
+
agent_enabled: false
|
14
|
+
monitor_mode: false
|
15
|
+
developer_mode: true
|
16
|
+
disable_samplers: true
|
17
|
+
api_host: 127.0.0.1
|
18
|
+
api_port: 443
|
19
|
+
message: '<%= generated_for_user %>'
|
20
|
+
license_key: '<%= license_key %>'
|
21
|
+
agent_enabled: auto
|
22
|
+
apdex_t: 1.1
|
23
|
+
|
24
|
+
# Some fixtures for newrelic.yml parsing tests
|
25
|
+
erb_value: <%= 'hey'*3 %>
|
26
|
+
tval: true
|
27
|
+
tstring: 'true'
|
28
|
+
fval: false
|
29
|
+
yval: yes
|
30
|
+
sval: sure
|
31
|
+
|
32
|
+
# checks for loading classes on the background thread
|
33
|
+
check_bg_loading: true
|
34
|
+
|
35
|
+
transaction_tracer:
|
36
|
+
record_sql: raw
|
37
|
+
transaction_threshold: Apdex_f # case insensitive
|
38
|
+
explain_threshold: 0.1
|
39
|
+
explain_enabled: true
|
40
|
+
stack_trace_threshold: 0.1
|
41
|
+
|
42
|
+
error_collector:
|
43
|
+
enabled: true
|
44
|
+
capture_source: true
|
45
|
+
|
46
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'new_relic/control/rails'
|
2
|
+
|
3
|
+
class NewRelic::Control::Test < NewRelic::Control::Rails #:nodoc:
|
4
|
+
def env
|
5
|
+
'test'
|
6
|
+
end
|
7
|
+
def app
|
8
|
+
:rails
|
9
|
+
end
|
10
|
+
def config_file
|
11
|
+
File.join(File.dirname(__FILE__), "newrelic.yml")
|
12
|
+
end
|
13
|
+
def initialize local_env
|
14
|
+
super local_env
|
15
|
+
setup_log
|
16
|
+
end
|
17
|
+
# when running tests, don't write out stderr
|
18
|
+
def log!(msg, level=:info)
|
19
|
+
log.send level, msg if log
|
20
|
+
end
|
21
|
+
|
22
|
+
# Add the default route in case it's missing. Need it for testing.
|
23
|
+
def install_devmode_route
|
24
|
+
super
|
25
|
+
ActionController::Routing::RouteSet.class_eval do
|
26
|
+
return if defined? draw_without_test_route
|
27
|
+
def draw_with_test_route
|
28
|
+
draw_without_test_route do | map |
|
29
|
+
map.connect ':controller/:action/:id'
|
30
|
+
yield map
|
31
|
+
end
|
32
|
+
end
|
33
|
+
alias_method_chain :draw, :test_route
|
34
|
+
end
|
35
|
+
# Force the routes to be reloaded
|
36
|
+
ActionController::Routing::Routes.reload!
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
2
|
+
require 'active_record_fixtures'
|
3
|
+
|
4
|
+
class ActiveRecordInstrumentationTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
NewRelic::Agent.manual_start
|
9
|
+
ActiveRecordFixtures.setup
|
10
|
+
NewRelic::Agent.instance.transaction_sampler.harvest
|
11
|
+
NewRelic::Agent.instance.stats_engine.clear_stats
|
12
|
+
rescue
|
13
|
+
puts e
|
14
|
+
puts e.backtrace.join("\n")
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
super
|
19
|
+
ActiveRecordFixtures.teardown
|
20
|
+
NewRelic::Agent.shutdown
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_agent_setup
|
24
|
+
assert NewRelic::Agent.instance.class == NewRelic::Agent::Agent
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_finder
|
28
|
+
ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
|
29
|
+
ActiveRecordFixtures::Order.find(:all)
|
30
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
31
|
+
assert_equal 1, s.call_count
|
32
|
+
ActiveRecordFixtures::Order.find_all_by_name "jeff"
|
33
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
34
|
+
assert_equal 2, s.call_count
|
35
|
+
ActiveRecordFixtures::Order.exists?(["name=?", 'jeff'])
|
36
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
37
|
+
assert_equal 3, s.call_count if NewRelic::Control.instance.rails_version > '2.3.4'
|
38
|
+
end
|
39
|
+
|
40
|
+
# multiple duplicate find calls should only cause metric trigger on the first
|
41
|
+
# call. the others are ignored.
|
42
|
+
def test_query_cache
|
43
|
+
ActiveRecordFixtures::Order.cache do
|
44
|
+
m = ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
|
45
|
+
ActiveRecordFixtures::Order.find(:all)
|
46
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
47
|
+
assert_equal 1, s.call_count
|
48
|
+
|
49
|
+
10.times { ActiveRecordFixtures::Order.find m.id }
|
50
|
+
end
|
51
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
52
|
+
assert_equal 2, s.call_count
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_metric_names
|
56
|
+
m = ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
|
57
|
+
m = ActiveRecordFixtures::Order.find(m.id)
|
58
|
+
m.id = 999
|
59
|
+
m.save!
|
60
|
+
|
61
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
62
|
+
# This doesn't work on hudson because the sampler metrics creep in.
|
63
|
+
# metrics = NewRelic::Agent.instance.stats_engine.metrics.select { |mname| mname =~ /ActiveRecord\/ActiveRecordFixtures::Order\// }.sort
|
64
|
+
expected = %W[
|
65
|
+
ActiveRecord/all
|
66
|
+
ActiveRecord/find
|
67
|
+
ActiveRecord/ActiveRecordFixtures::Order/find
|
68
|
+
]
|
69
|
+
expected += %W[Database/SQL/insert] if defined?(JRuby)
|
70
|
+
expected += %W[ActiveRecord/create Database/SQL/other ActiveRecord/ActiveRecordFixtures::Order/create] unless defined?(JRuby)
|
71
|
+
expected += %W[ActiveRecord/save ActiveRecord/ActiveRecordFixtures::Order/save] if NewRelic::Control.instance.rails_version < '2.1.0'
|
72
|
+
compare_metrics expected, metrics
|
73
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find").call_count
|
74
|
+
assert_equal (defined?(JRuby) ? 0 : 1), NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/create").call_count
|
75
|
+
end
|
76
|
+
def test_join_metrics
|
77
|
+
m = ActiveRecordFixtures::Order.create :name => 'jeff'
|
78
|
+
m = ActiveRecordFixtures::Order.find(m.id)
|
79
|
+
s = m.shipments.create
|
80
|
+
m.shipments.to_a
|
81
|
+
m.destroy
|
82
|
+
|
83
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
84
|
+
# This doesn't work on hudson because the sampler metrics creep in.
|
85
|
+
# metrics = NewRelic::Agent.instance.stats_engine.metrics.select { |mname| mname =~ /ActiveRecord\/ActiveRecordFixtures::Order\// }.sort
|
86
|
+
expected_metrics = %W[
|
87
|
+
ActiveRecord/all
|
88
|
+
ActiveRecord/destroy
|
89
|
+
ActiveRecord/ActiveRecordFixtures::Order/destroy
|
90
|
+
Database/SQL/insert
|
91
|
+
Database/SQL/delete
|
92
|
+
ActiveRecord/find
|
93
|
+
ActiveRecord/ActiveRecordFixtures::Order/find
|
94
|
+
ActiveRecord/ActiveRecordFixtures::Shipment/find
|
95
|
+
]
|
96
|
+
|
97
|
+
expected_metrics += %W[Database/SQL/other Database/SQL/show ActiveRecord/create
|
98
|
+
ActiveRecord/ActiveRecordFixtures::Shipment/create
|
99
|
+
ActiveRecord/ActiveRecordFixtures::Order/create
|
100
|
+
] unless defined? JRuby
|
101
|
+
|
102
|
+
compare_metrics expected_metrics, metrics
|
103
|
+
# This number may be different with different db adapters, not sure
|
104
|
+
# assert_equal 17, NewRelic::Agent.get_stats("ActiveRecord/all").call_count
|
105
|
+
assert_equal NewRelic::Agent.get_stats("ActiveRecord/all").total_exclusive_time, NewRelic::Agent.get_stats("ActiveRecord/all").total_call_time unless defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /Enterprise Edition/
|
106
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find").call_count
|
107
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Shipment/find").call_count
|
108
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/insert").call_count unless defined? JRuby
|
109
|
+
assert_equal 3, NewRelic::Agent.get_stats("Database/SQL/insert").call_count if defined? JRuby
|
110
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/delete").call_count
|
111
|
+
end
|
112
|
+
def test_direct_sql
|
113
|
+
list = ActiveRecordFixtures::Order.connection.select_rows "select * from #{ActiveRecordFixtures::Order.table_name}"
|
114
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
115
|
+
compare_metrics %W[
|
116
|
+
ActiveRecord/all
|
117
|
+
Database/SQL/select
|
118
|
+
], metrics
|
119
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/select").call_count
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_other_sql
|
123
|
+
list = ActiveRecordFixtures::Order.connection.execute "begin"
|
124
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
125
|
+
compare_metrics %W[
|
126
|
+
ActiveRecord/all
|
127
|
+
Database/SQL/other
|
128
|
+
], metrics
|
129
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/other").call_count
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_show_sql
|
133
|
+
list = ActiveRecordFixtures::Order.connection.execute "show tables"
|
134
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
135
|
+
compare_metrics %W[
|
136
|
+
ActiveRecord/all
|
137
|
+
Database/SQL/show
|
138
|
+
], metrics
|
139
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/show").call_count
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_blocked_instrumentation
|
143
|
+
NewRelic::Agent.instance.transaction_sampler.notice_transaction "ActiveRecord/bogus/bogosity"
|
144
|
+
ActiveRecordFixtures::Order.add_delay
|
145
|
+
NewRelic::Agent.disable_all_tracing do
|
146
|
+
ActiveRecordFixtures::Order.find(:all)
|
147
|
+
end
|
148
|
+
assert_nil NewRelic::Agent.instance.transaction_sampler.last_sample
|
149
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
150
|
+
compare_metrics [], metrics
|
151
|
+
end
|
152
|
+
def test_run_explains
|
153
|
+
NewRelic::Agent.instance.transaction_sampler.notice_transaction "ActiveRecord/bogus/bogosity"
|
154
|
+
ActiveRecordFixtures::Order.add_delay
|
155
|
+
ActiveRecordFixtures::Order.find(:all)
|
156
|
+
|
157
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
158
|
+
|
159
|
+
segment = sample.root_segment.called_segments.first.called_segments.first
|
160
|
+
assert_match /^SELECT \* FROM ["`]?#{ActiveRecordFixtures::Order.table_name}["`]?$/i, segment.params[:sql].strip
|
161
|
+
NewRelic::TransactionSample::Segment.any_instance.expects(:explain_sql).returns([])
|
162
|
+
sample = sample.prepare_to_send(:obfuscate_sql => true, :explain_enabled => true, :explain_sql => 0.0)
|
163
|
+
segment = sample.root_segment.called_segments.first.called_segments.first
|
164
|
+
end
|
165
|
+
def test_prepare_to_send
|
166
|
+
NewRelic::Agent.instance.transaction_sampler.notice_transaction "ActiveRecord/bogus/bogosity"
|
167
|
+
ActiveRecordFixtures::Order.add_delay
|
168
|
+
ActiveRecordFixtures::Order.find(:all)
|
169
|
+
|
170
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
171
|
+
assert_not_nil sample
|
172
|
+
#
|
173
|
+
sql_segment = sample.root_segment.called_segments.first.called_segments.first
|
174
|
+
assert_match /^SELECT /, sql_segment.params[:sql]
|
175
|
+
assert sql_segment.duration > 0.0, "Segment duration must be greater than zero."
|
176
|
+
sample = sample.prepare_to_send(:record_sql => :raw, :explain_enabled => true, :explain_sql => 0.0)
|
177
|
+
sql_segment = sample.root_segment.called_segments.first.called_segments.first
|
178
|
+
assert_match /^SELECT /, sql_segment.params[:sql]
|
179
|
+
explanations = sql_segment.params[:explanation]
|
180
|
+
if isMysql? || isPostgres?
|
181
|
+
assert_not_nil explanations, "No explains in segment: #{sql_segment}"
|
182
|
+
assert_equal 1, explanations.size,"No explains in segment: #{sql_segment}"
|
183
|
+
assert_equal 1, explanations.first.size
|
184
|
+
end
|
185
|
+
end
|
186
|
+
def test_transaction
|
187
|
+
NewRelic::Agent.instance.transaction_sampler.notice_transaction "ActiveRecord/bogus/bogosity"
|
188
|
+
ActiveRecordFixtures::Order.add_delay
|
189
|
+
ActiveRecordFixtures::Order.find(:all)
|
190
|
+
|
191
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
192
|
+
|
193
|
+
sample = sample.prepare_to_send(:obfuscate_sql => true, :explain_enabled => true, :explain_sql => 0.0)
|
194
|
+
segment = sample.root_segment.called_segments.first.called_segments.first
|
195
|
+
assert_nil segment.params[:sql], "SQL should have been removed."
|
196
|
+
explanations = segment.params[:explanation]
|
197
|
+
if isMysql? || isPostgres?
|
198
|
+
assert_not_nil explanations, "No explains in segment: #{segment}"
|
199
|
+
assert_equal 1, explanations.size,"No explains in segment: #{segment}"
|
200
|
+
assert_equal 1, explanations.first.size
|
201
|
+
end
|
202
|
+
if isPostgres?
|
203
|
+
assert_equal Array, explanations.class
|
204
|
+
assert_equal Array, explanations[0].class
|
205
|
+
assert_equal Array, explanations[0][0].class
|
206
|
+
assert_match /Seq Scan on test_data/, explanations[0][0].join(";")
|
207
|
+
elsif isMysql?
|
208
|
+
assert_equal "1;SIMPLE;#{ActiveRecordFixtures::Order.table_name};ALL;;;;;1;", explanations.first.first.join(";")
|
209
|
+
end
|
210
|
+
|
211
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
212
|
+
assert_equal 1, s.call_count
|
213
|
+
end
|
214
|
+
# These are only valid for rails 2.1 and later
|
215
|
+
if NewRelic::Control.instance.rails_version >= NewRelic::VersionNumber.new("2.1.0")
|
216
|
+
ActiveRecordFixtures::Order.class_eval do
|
217
|
+
named_scope :jeffs, :conditions => { :name => 'Jeff' }
|
218
|
+
end
|
219
|
+
def test_named_scope
|
220
|
+
ActiveRecordFixtures::Order.create :name => 'Jeff'
|
221
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
222
|
+
before_count = s.call_count
|
223
|
+
x = ActiveRecordFixtures::Order.jeffs.find(:all)
|
224
|
+
assert_equal 1, x.size
|
225
|
+
se = NewRelic::Agent.instance.stats_engine
|
226
|
+
assert_equal before_count+1, s.call_count
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
# This is to make sure the all metric is recorded for exceptional cases
|
231
|
+
def test_error_handling
|
232
|
+
# have the AR select throw an error
|
233
|
+
ActiveRecordFixtures::Order.connection.stubs(:log_info).with do | sql, x, y |
|
234
|
+
raise "Error" if sql =~ /select/
|
235
|
+
true
|
236
|
+
end
|
237
|
+
ActiveRecordFixtures::Order.connection.select_rows "select * from #{ActiveRecordFixtures::Order.table_name}" rescue nil
|
238
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
239
|
+
compare_metrics %W[
|
240
|
+
ActiveRecord/all
|
241
|
+
Database/SQL/select
|
242
|
+
], metrics
|
243
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/select").call_count
|
244
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/all").call_count
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_rescue_handling
|
248
|
+
begin
|
249
|
+
ActiveRecordFixtures::Order.transaction do
|
250
|
+
raise ActiveRecord::ActiveRecordError.new('preserve-me!')
|
251
|
+
end
|
252
|
+
rescue ActiveRecord::ActiveRecordError => e
|
253
|
+
assert_equal 'preserve-me!', e.message
|
254
|
+
rescue
|
255
|
+
fail "Rescue2: Got something COMPLETELY unexpected: $!:#{$!.inspect}"
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
private
|
261
|
+
|
262
|
+
def isPostgres?
|
263
|
+
ActiveRecordFixtures::Order.configurations[RAILS_ENV]['adapter'] =~ /postgres/
|
264
|
+
end
|
265
|
+
def isMysql?
|
266
|
+
ActiveRecordFixtures::Order.connection.class.name =~ /mysql/i
|
267
|
+
end
|
268
|
+
end
|