honkster-newrelic_rpm 2.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. data/CHANGELOG +462 -0
  2. data/LICENSE +37 -0
  3. data/README.rdoc +172 -0
  4. data/bin/mongrel_rpm +33 -0
  5. data/bin/newrelic +13 -0
  6. data/bin/newrelic_cmd +5 -0
  7. data/cert/cacert.pem +34 -0
  8. data/install.rb +9 -0
  9. data/lib/new_relic/agent.rb +382 -0
  10. data/lib/new_relic/agent/agent.rb +741 -0
  11. data/lib/new_relic/agent/busy_calculator.rb +91 -0
  12. data/lib/new_relic/agent/chained_call.rb +13 -0
  13. data/lib/new_relic/agent/error_collector.rb +131 -0
  14. data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
  15. data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +92 -0
  16. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +45 -0
  17. data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -0
  18. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +409 -0
  19. data/lib/new_relic/agent/instrumentation/data_mapper.rb +58 -0
  20. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +22 -0
  21. data/lib/new_relic/agent/instrumentation/memcache.rb +40 -0
  22. data/lib/new_relic/agent/instrumentation/merb/controller.rb +26 -0
  23. data/lib/new_relic/agent/instrumentation/merb/errors.rb +9 -0
  24. data/lib/new_relic/agent/instrumentation/metric_frame.rb +319 -0
  25. data/lib/new_relic/agent/instrumentation/net.rb +17 -0
  26. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +22 -0
  27. data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
  28. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +59 -0
  29. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
  30. data/lib/new_relic/agent/instrumentation/rails/errors.rb +24 -0
  31. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +45 -0
  32. data/lib/new_relic/agent/instrumentation/rails3/errors.rb +21 -0
  33. data/lib/new_relic/agent/instrumentation/sinatra.rb +46 -0
  34. data/lib/new_relic/agent/instrumentation/sunspot.rb +17 -0
  35. data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +10 -0
  36. data/lib/new_relic/agent/method_tracer.rb +350 -0
  37. data/lib/new_relic/agent/sampler.rb +50 -0
  38. data/lib/new_relic/agent/samplers/cpu_sampler.rb +54 -0
  39. data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +37 -0
  40. data/lib/new_relic/agent/samplers/memory_sampler.rb +142 -0
  41. data/lib/new_relic/agent/samplers/object_sampler.rb +24 -0
  42. data/lib/new_relic/agent/shim_agent.rb +25 -0
  43. data/lib/new_relic/agent/stats_engine.rb +24 -0
  44. data/lib/new_relic/agent/stats_engine/metric_stats.rb +118 -0
  45. data/lib/new_relic/agent/stats_engine/samplers.rb +83 -0
  46. data/lib/new_relic/agent/stats_engine/transactions.rb +149 -0
  47. data/lib/new_relic/agent/transaction_sampler.rb +330 -0
  48. data/lib/new_relic/agent/worker_loop.rb +81 -0
  49. data/lib/new_relic/collection_helper.rb +71 -0
  50. data/lib/new_relic/command.rb +85 -0
  51. data/lib/new_relic/commands/deployments.rb +105 -0
  52. data/lib/new_relic/commands/install.rb +81 -0
  53. data/lib/new_relic/control.rb +203 -0
  54. data/lib/new_relic/control/configuration.rb +149 -0
  55. data/lib/new_relic/control/frameworks/external.rb +13 -0
  56. data/lib/new_relic/control/frameworks/merb.rb +24 -0
  57. data/lib/new_relic/control/frameworks/rails.rb +126 -0
  58. data/lib/new_relic/control/frameworks/rails3.rb +60 -0
  59. data/lib/new_relic/control/frameworks/ruby.rb +36 -0
  60. data/lib/new_relic/control/frameworks/sinatra.rb +18 -0
  61. data/lib/new_relic/control/instrumentation.rb +95 -0
  62. data/lib/new_relic/control/logging_methods.rb +74 -0
  63. data/lib/new_relic/control/profiling.rb +24 -0
  64. data/lib/new_relic/control/server_methods.rb +88 -0
  65. data/lib/new_relic/delayed_job_injection.rb +27 -0
  66. data/lib/new_relic/histogram.rb +91 -0
  67. data/lib/new_relic/local_environment.rb +333 -0
  68. data/lib/new_relic/merbtasks.rb +6 -0
  69. data/lib/new_relic/metric_data.rb +42 -0
  70. data/lib/new_relic/metric_parser.rb +136 -0
  71. data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
  72. data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
  73. data/lib/new_relic/metric_parser/active_record.rb +28 -0
  74. data/lib/new_relic/metric_parser/apdex.rb +88 -0
  75. data/lib/new_relic/metric_parser/controller.rb +62 -0
  76. data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
  77. data/lib/new_relic/metric_parser/errors.rb +6 -0
  78. data/lib/new_relic/metric_parser/external.rb +50 -0
  79. data/lib/new_relic/metric_parser/mem_cache.rb +50 -0
  80. data/lib/new_relic/metric_parser/other_transaction.rb +36 -0
  81. data/lib/new_relic/metric_parser/view.rb +61 -0
  82. data/lib/new_relic/metric_parser/web_frontend.rb +14 -0
  83. data/lib/new_relic/metric_parser/web_service.rb +9 -0
  84. data/lib/new_relic/metric_spec.rb +67 -0
  85. data/lib/new_relic/metrics.rb +9 -0
  86. data/lib/new_relic/noticed_error.rb +24 -0
  87. data/lib/new_relic/rack/developer_mode.rb +257 -0
  88. data/lib/new_relic/rack/metric_app.rb +64 -0
  89. data/lib/new_relic/rack/mongrel_rpm.ru +26 -0
  90. data/lib/new_relic/rack/newrelic.yml +27 -0
  91. data/lib/new_relic/rack_app.rb +6 -0
  92. data/lib/new_relic/recipes.rb +82 -0
  93. data/lib/new_relic/stats.rb +368 -0
  94. data/lib/new_relic/timer_lib.rb +27 -0
  95. data/lib/new_relic/transaction_analysis.rb +119 -0
  96. data/lib/new_relic/transaction_sample.rb +586 -0
  97. data/lib/new_relic/url_rule.rb +14 -0
  98. data/lib/new_relic/version.rb +55 -0
  99. data/lib/new_relic_api.rb +276 -0
  100. data/lib/newrelic_rpm.rb +49 -0
  101. data/lib/tasks/all.rb +4 -0
  102. data/lib/tasks/install.rake +7 -0
  103. data/lib/tasks/tests.rake +15 -0
  104. data/newrelic.yml +246 -0
  105. data/newrelic_rpm.gemspec +254 -0
  106. data/recipes/newrelic.rb +6 -0
  107. data/test/active_record_fixtures.rb +55 -0
  108. data/test/config/newrelic.yml +48 -0
  109. data/test/config/test_control.rb +36 -0
  110. data/test/new_relic/agent/active_record_instrumentation_test.rb +286 -0
  111. data/test/new_relic/agent/agent_controller_test.rb +294 -0
  112. data/test/new_relic/agent/agent_test_controller.rb +77 -0
  113. data/test/new_relic/agent/busy_calculator_test.rb +81 -0
  114. data/test/new_relic/agent/collection_helper_test.rb +125 -0
  115. data/test/new_relic/agent/error_collector_test.rb +163 -0
  116. data/test/new_relic/agent/memcache_instrumentation_test.rb +103 -0
  117. data/test/new_relic/agent/method_tracer_test.rb +340 -0
  118. data/test/new_relic/agent/metric_data_test.rb +53 -0
  119. data/test/new_relic/agent/metric_frame_test.rb +51 -0
  120. data/test/new_relic/agent/mock_scope_listener.rb +23 -0
  121. data/test/new_relic/agent/net_instrumentation_test.rb +77 -0
  122. data/test/new_relic/agent/rpm_agent_test.rb +142 -0
  123. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +79 -0
  124. data/test/new_relic/agent/stats_engine/samplers_test.rb +72 -0
  125. data/test/new_relic/agent/stats_engine/stats_engine_test.rb +184 -0
  126. data/test/new_relic/agent/task_instrumentation_test.rb +188 -0
  127. data/test/new_relic/agent/testable_agent.rb +13 -0
  128. data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
  129. data/test/new_relic/agent/transaction_sample_test.rb +192 -0
  130. data/test/new_relic/agent/transaction_sampler_test.rb +385 -0
  131. data/test/new_relic/agent/worker_loop_test.rb +66 -0
  132. data/test/new_relic/control_test.rb +127 -0
  133. data/test/new_relic/deployments_api_test.rb +69 -0
  134. data/test/new_relic/environment_test.rb +75 -0
  135. data/test/new_relic/metric_parser_test.rb +226 -0
  136. data/test/new_relic/metric_spec_test.rb +177 -0
  137. data/test/new_relic/rack/episodes_test.rb +318 -0
  138. data/test/new_relic/shim_agent_test.rb +9 -0
  139. data/test/new_relic/stats_test.rb +312 -0
  140. data/test/new_relic/version_number_test.rb +89 -0
  141. data/test/test_contexts.rb +28 -0
  142. data/test/test_helper.rb +72 -0
  143. data/ui/helpers/developer_mode_helper.rb +359 -0
  144. data/ui/helpers/google_pie_chart.rb +49 -0
  145. data/ui/views/layouts/newrelic_default.rhtml +47 -0
  146. data/ui/views/newrelic/_explain_plans.rhtml +27 -0
  147. data/ui/views/newrelic/_sample.rhtml +20 -0
  148. data/ui/views/newrelic/_segment.rhtml +29 -0
  149. data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
  150. data/ui/views/newrelic/_segment_row.rhtml +14 -0
  151. data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
  152. data/ui/views/newrelic/_show_sample_sql.rhtml +20 -0
  153. data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
  154. data/ui/views/newrelic/_sql_row.rhtml +16 -0
  155. data/ui/views/newrelic/_stack_trace.rhtml +15 -0
  156. data/ui/views/newrelic/_table.rhtml +12 -0
  157. data/ui/views/newrelic/explain_sql.rhtml +43 -0
  158. data/ui/views/newrelic/file/images/arrow-close.png +0 -0
  159. data/ui/views/newrelic/file/images/arrow-open.png +0 -0
  160. data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
  161. data/ui/views/newrelic/file/images/file_icon.png +0 -0
  162. data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
  163. data/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif +0 -0
  164. data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
  165. data/ui/views/newrelic/file/images/textmate.png +0 -0
  166. data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
  167. data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
  168. data/ui/views/newrelic/file/stylesheets/style.css +484 -0
  169. data/ui/views/newrelic/index.rhtml +59 -0
  170. data/ui/views/newrelic/sample_not_found.rhtml +2 -0
  171. data/ui/views/newrelic/show_sample.rhtml +79 -0
  172. data/ui/views/newrelic/show_source.rhtml +3 -0
  173. data/ui/views/newrelic/threads.rhtml +52 -0
  174. metadata +307 -0
@@ -0,0 +1,254 @@
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{honkster-newrelic_rpm}
8
+ s.version = "2.13.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Bill Kayser", "Justin George"]
12
+ s.date = %q{2010-09-08}
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", "newrelic_cmd"]
22
+ s.extra_rdoc_files = [
23
+ "CHANGELOG",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "newrelic.yml"
27
+ ]
28
+ s.files = [
29
+ "CHANGELOG",
30
+ "LICENSE",
31
+ "README.rdoc",
32
+ "bin/mongrel_rpm",
33
+ "bin/newrelic",
34
+ "bin/newrelic_cmd",
35
+ "cert/cacert.pem",
36
+ "install.rb",
37
+ "lib/new_relic/agent.rb",
38
+ "lib/new_relic/agent/agent.rb",
39
+ "lib/new_relic/agent/busy_calculator.rb",
40
+ "lib/new_relic/agent/chained_call.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/acts_as_solr.rb",
45
+ "lib/new_relic/agent/instrumentation/authlogic.rb",
46
+ "lib/new_relic/agent/instrumentation/controller_instrumentation.rb",
47
+ "lib/new_relic/agent/instrumentation/data_mapper.rb",
48
+ "lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb",
49
+ "lib/new_relic/agent/instrumentation/memcache.rb",
50
+ "lib/new_relic/agent/instrumentation/merb/controller.rb",
51
+ "lib/new_relic/agent/instrumentation/merb/errors.rb",
52
+ "lib/new_relic/agent/instrumentation/metric_frame.rb",
53
+ "lib/new_relic/agent/instrumentation/net.rb",
54
+ "lib/new_relic/agent/instrumentation/passenger_instrumentation.rb",
55
+ "lib/new_relic/agent/instrumentation/rack.rb",
56
+ "lib/new_relic/agent/instrumentation/rails/action_controller.rb",
57
+ "lib/new_relic/agent/instrumentation/rails/action_web_service.rb",
58
+ "lib/new_relic/agent/instrumentation/rails/errors.rb",
59
+ "lib/new_relic/agent/instrumentation/rails3/action_controller.rb",
60
+ "lib/new_relic/agent/instrumentation/rails3/errors.rb",
61
+ "lib/new_relic/agent/instrumentation/sinatra.rb",
62
+ "lib/new_relic/agent/instrumentation/sunspot.rb",
63
+ "lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb",
64
+ "lib/new_relic/agent/method_tracer.rb",
65
+ "lib/new_relic/agent/sampler.rb",
66
+ "lib/new_relic/agent/samplers/cpu_sampler.rb",
67
+ "lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb",
68
+ "lib/new_relic/agent/samplers/memory_sampler.rb",
69
+ "lib/new_relic/agent/samplers/object_sampler.rb",
70
+ "lib/new_relic/agent/shim_agent.rb",
71
+ "lib/new_relic/agent/stats_engine.rb",
72
+ "lib/new_relic/agent/stats_engine/metric_stats.rb",
73
+ "lib/new_relic/agent/stats_engine/samplers.rb",
74
+ "lib/new_relic/agent/stats_engine/transactions.rb",
75
+ "lib/new_relic/agent/transaction_sampler.rb",
76
+ "lib/new_relic/agent/worker_loop.rb",
77
+ "lib/new_relic/collection_helper.rb",
78
+ "lib/new_relic/command.rb",
79
+ "lib/new_relic/commands/deployments.rb",
80
+ "lib/new_relic/commands/install.rb",
81
+ "lib/new_relic/control.rb",
82
+ "lib/new_relic/control/configuration.rb",
83
+ "lib/new_relic/control/frameworks/external.rb",
84
+ "lib/new_relic/control/frameworks/merb.rb",
85
+ "lib/new_relic/control/frameworks/rails.rb",
86
+ "lib/new_relic/control/frameworks/rails3.rb",
87
+ "lib/new_relic/control/frameworks/ruby.rb",
88
+ "lib/new_relic/control/frameworks/sinatra.rb",
89
+ "lib/new_relic/control/instrumentation.rb",
90
+ "lib/new_relic/control/logging_methods.rb",
91
+ "lib/new_relic/control/profiling.rb",
92
+ "lib/new_relic/control/server_methods.rb",
93
+ "lib/new_relic/delayed_job_injection.rb",
94
+ "lib/new_relic/histogram.rb",
95
+ "lib/new_relic/local_environment.rb",
96
+ "lib/new_relic/merbtasks.rb",
97
+ "lib/new_relic/metric_data.rb",
98
+ "lib/new_relic/metric_parser.rb",
99
+ "lib/new_relic/metric_parser/action_mailer.rb",
100
+ "lib/new_relic/metric_parser/active_merchant.rb",
101
+ "lib/new_relic/metric_parser/active_record.rb",
102
+ "lib/new_relic/metric_parser/apdex.rb",
103
+ "lib/new_relic/metric_parser/controller.rb",
104
+ "lib/new_relic/metric_parser/controller_cpu.rb",
105
+ "lib/new_relic/metric_parser/errors.rb",
106
+ "lib/new_relic/metric_parser/external.rb",
107
+ "lib/new_relic/metric_parser/mem_cache.rb",
108
+ "lib/new_relic/metric_parser/other_transaction.rb",
109
+ "lib/new_relic/metric_parser/view.rb",
110
+ "lib/new_relic/metric_parser/web_frontend.rb",
111
+ "lib/new_relic/metric_parser/web_service.rb",
112
+ "lib/new_relic/metric_spec.rb",
113
+ "lib/new_relic/metrics.rb",
114
+ "lib/new_relic/noticed_error.rb",
115
+ "lib/new_relic/rack/developer_mode.rb",
116
+ "lib/new_relic/rack/metric_app.rb",
117
+ "lib/new_relic/rack/mongrel_rpm.ru",
118
+ "lib/new_relic/rack/newrelic.yml",
119
+ "lib/new_relic/rack_app.rb",
120
+ "lib/new_relic/recipes.rb",
121
+ "lib/new_relic/stats.rb",
122
+ "lib/new_relic/timer_lib.rb",
123
+ "lib/new_relic/transaction_analysis.rb",
124
+ "lib/new_relic/transaction_sample.rb",
125
+ "lib/new_relic/url_rule.rb",
126
+ "lib/new_relic/version.rb",
127
+ "lib/new_relic_api.rb",
128
+ "lib/newrelic_rpm.rb",
129
+ "lib/tasks/all.rb",
130
+ "lib/tasks/install.rake",
131
+ "lib/tasks/tests.rake",
132
+ "newrelic.yml",
133
+ "newrelic_rpm.gemspec",
134
+ "recipes/newrelic.rb",
135
+ "test/active_record_fixtures.rb",
136
+ "test/config/newrelic.yml",
137
+ "test/config/test_control.rb",
138
+ "test/new_relic/agent/active_record_instrumentation_test.rb",
139
+ "test/new_relic/agent/agent_controller_test.rb",
140
+ "test/new_relic/agent/agent_test_controller.rb",
141
+ "test/new_relic/agent/busy_calculator_test.rb",
142
+ "test/new_relic/agent/collection_helper_test.rb",
143
+ "test/new_relic/agent/error_collector_test.rb",
144
+ "test/new_relic/agent/memcache_instrumentation_test.rb",
145
+ "test/new_relic/agent/method_tracer_test.rb",
146
+ "test/new_relic/agent/metric_data_test.rb",
147
+ "test/new_relic/agent/metric_frame_test.rb",
148
+ "test/new_relic/agent/mock_scope_listener.rb",
149
+ "test/new_relic/agent/net_instrumentation_test.rb",
150
+ "test/new_relic/agent/rpm_agent_test.rb",
151
+ "test/new_relic/agent/stats_engine/metric_stats_test.rb",
152
+ "test/new_relic/agent/stats_engine/samplers_test.rb",
153
+ "test/new_relic/agent/stats_engine/stats_engine_test.rb",
154
+ "test/new_relic/agent/task_instrumentation_test.rb",
155
+ "test/new_relic/agent/testable_agent.rb",
156
+ "test/new_relic/agent/transaction_sample_builder_test.rb",
157
+ "test/new_relic/agent/transaction_sample_test.rb",
158
+ "test/new_relic/agent/transaction_sampler_test.rb",
159
+ "test/new_relic/agent/worker_loop_test.rb",
160
+ "test/new_relic/control_test.rb",
161
+ "test/new_relic/deployments_api_test.rb",
162
+ "test/new_relic/environment_test.rb",
163
+ "test/new_relic/metric_parser_test.rb",
164
+ "test/new_relic/metric_spec_test.rb",
165
+ "test/new_relic/rack/episodes_test.rb",
166
+ "test/new_relic/shim_agent_test.rb",
167
+ "test/new_relic/stats_test.rb",
168
+ "test/new_relic/version_number_test.rb",
169
+ "test/test_contexts.rb",
170
+ "test/test_helper.rb",
171
+ "ui/helpers/developer_mode_helper.rb",
172
+ "ui/helpers/google_pie_chart.rb",
173
+ "ui/views/layouts/newrelic_default.rhtml",
174
+ "ui/views/newrelic/_explain_plans.rhtml",
175
+ "ui/views/newrelic/_sample.rhtml",
176
+ "ui/views/newrelic/_segment.rhtml",
177
+ "ui/views/newrelic/_segment_limit_message.rhtml",
178
+ "ui/views/newrelic/_segment_row.rhtml",
179
+ "ui/views/newrelic/_show_sample_detail.rhtml",
180
+ "ui/views/newrelic/_show_sample_sql.rhtml",
181
+ "ui/views/newrelic/_show_sample_summary.rhtml",
182
+ "ui/views/newrelic/_sql_row.rhtml",
183
+ "ui/views/newrelic/_stack_trace.rhtml",
184
+ "ui/views/newrelic/_table.rhtml",
185
+ "ui/views/newrelic/explain_sql.rhtml",
186
+ "ui/views/newrelic/file/images/arrow-close.png",
187
+ "ui/views/newrelic/file/images/arrow-open.png",
188
+ "ui/views/newrelic/file/images/blue_bar.gif",
189
+ "ui/views/newrelic/file/images/file_icon.png",
190
+ "ui/views/newrelic/file/images/gray_bar.gif",
191
+ "ui/views/newrelic/file/images/new-relic-rpm-desktop.gif",
192
+ "ui/views/newrelic/file/images/new_relic_rpm_desktop.gif",
193
+ "ui/views/newrelic/file/images/textmate.png",
194
+ "ui/views/newrelic/file/javascript/jquery-1.4.2.js",
195
+ "ui/views/newrelic/file/javascript/transaction_sample.js",
196
+ "ui/views/newrelic/file/stylesheets/style.css",
197
+ "ui/views/newrelic/index.rhtml",
198
+ "ui/views/newrelic/sample_not_found.rhtml",
199
+ "ui/views/newrelic/show_sample.rhtml",
200
+ "ui/views/newrelic/show_source.rhtml",
201
+ "ui/views/newrelic/threads.rhtml"
202
+ ]
203
+ s.homepage = %q{http://www.github.com/newrelic/rpm}
204
+ s.post_install_message = %q{
205
+ PLEASE NOTE:
206
+
207
+ Developer Mode is now a Rack middleware.
208
+
209
+ RPM Developer Mode is no longer available in Rails 2.1 and earlier.
210
+ However, starting in version 2.12 you can use Developer Mode in any
211
+ Rack based framework, in addition to Rails. To install developer mode
212
+ in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
213
+ your middleware stack.
214
+
215
+ If you are using JRuby, we recommend using at least version 1.4 or
216
+ later because of issues with the implementation of the timeout library.
217
+
218
+ Refer to the README.md file for more information.
219
+
220
+ Please see http://support.newrelic.com/faqs/docs/ruby-agent-release-notes
221
+ for a complete description of the features and enhancements available
222
+ in version 2.13 of the Ruby Agent.
223
+
224
+ For details on this specific release, refer to the CHANGELOG file.
225
+
226
+ Notice: Developer Mode now supports only Rails 2.3+ - refer to README
227
+ for instructions for previous versions
228
+
229
+ }
230
+ s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source", "--title", "New Relic Ruby Performance Monitoring Agent"]
231
+ s.require_paths = ["lib"]
232
+ s.rubygems_version = %q{1.3.7}
233
+ s.summary = %q{New Relic Ruby Performance Monitoring Agent}
234
+
235
+ if s.respond_to? :specification_version then
236
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
237
+ s.specification_version = 3
238
+
239
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
240
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
241
+ s.add_development_dependency(%q<mocha>, [">= 0"])
242
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
243
+ else
244
+ s.add_dependency(%q<jeweler>, [">= 0"])
245
+ s.add_dependency(%q<mocha>, [">= 0"])
246
+ s.add_dependency(%q<shoulda>, [">= 0"])
247
+ end
248
+ else
249
+ s.add_dependency(%q<jeweler>, [">= 0"])
250
+ s.add_dependency(%q<mocha>, [">= 0"])
251
+ s.add_dependency(%q<shoulda>, [">= 0"])
252
+ end
253
+ end
254
+
@@ -0,0 +1,6 @@
1
+ # The capistrano recipes in plugins are automatically
2
+ # loaded from here. From gems, they are available from
3
+ # the lib directory. We have to make them available from
4
+ # both locations
5
+
6
+ require File.join(File.dirname(__FILE__),'..','lib','new_relic','recipes')
@@ -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,48 @@
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
+ app_name:
24
+ - a
25
+ - b
26
+ - c
27
+ log_file_path: <%= RAILS_ROOT %>/log
28
+
29
+ # Some fixtures for newrelic.yml parsing tests
30
+ erb_value: <%= 'hey'*3 %>
31
+ tval: true
32
+ tstring: 'true'
33
+ fval: false
34
+ yval: yes
35
+ sval: sure
36
+
37
+ transaction_tracer:
38
+ record_sql: raw
39
+ transaction_threshold: Apdex_f # case insensitive
40
+ explain_threshold: 0.1
41
+ explain_enabled: true
42
+ stack_trace_threshold: 0.1
43
+
44
+ error_collector:
45
+ enabled: true
46
+ capture_source: true
47
+
48
+
@@ -0,0 +1,36 @@
1
+ require 'new_relic/control/frameworks/rails'
2
+
3
+ class NewRelic::Control::Frameworks::Test < NewRelic::Control::Frameworks::Rails #:nodoc:
4
+ def env
5
+ 'test'
6
+ end
7
+ def app
8
+ :rails
9
+ end
10
+
11
+ def initialize *args
12
+ super
13
+ setup_log
14
+ end
15
+ # when running tests, don't write out stderr
16
+ def log!(msg, level=:info)
17
+ log.send level, msg if log
18
+ end
19
+
20
+ # Add the default route in case it's missing. Need it for testing.
21
+ def install_devmode_route
22
+ super
23
+ ActionController::Routing::RouteSet.class_eval do
24
+ return if defined? draw_without_test_route
25
+ def draw_with_test_route
26
+ draw_without_test_route do | map |
27
+ map.connect ':controller/:action/:id'
28
+ yield map
29
+ end
30
+ end
31
+ alias_method_chain :draw, :test_route
32
+ end
33
+ # Force the routes to be reloaded
34
+ ActionController::Routing::Routes.reload!
35
+ end
36
+ end
@@ -0,0 +1,286 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
2
+ class ActiveRecordInstrumentationTest < Test::Unit::TestCase
3
+ require 'active_record_fixtures'
4
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
5
+ def setup
6
+ super
7
+ NewRelic::Agent.manual_start
8
+ ActiveRecordFixtures.setup
9
+ NewRelic::Agent.instance.transaction_sampler.reset!
10
+ NewRelic::Agent.instance.stats_engine.clear_stats
11
+ rescue
12
+ puts e
13
+ puts e.backtrace.join("\n")
14
+ end
15
+
16
+ def teardown
17
+ super
18
+ ActiveRecordFixtures.teardown
19
+ NewRelic::Agent.shutdown
20
+ end
21
+
22
+ def test_agent_setup
23
+ assert NewRelic::Agent.instance.class == NewRelic::Agent::Agent
24
+ end
25
+
26
+ def test_finder
27
+ ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
28
+ ActiveRecordFixtures::Order.find(:all)
29
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
30
+ assert_equal 1, s.call_count
31
+ ActiveRecordFixtures::Order.find_all_by_name "jeff"
32
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
33
+ assert_equal 2, s.call_count
34
+ ActiveRecordFixtures::Order.exists?(["name=?", 'jeff'])
35
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
36
+ assert_equal 3, s.call_count if NewRelic::Control.instance.rails_version > '2.3.4'
37
+ end
38
+
39
+ # multiple duplicate find calls should only cause metric trigger on the first
40
+ # call. the others are ignored.
41
+ def test_query_cache
42
+ # Not sure why we get a transaction error with sqlite
43
+ return if ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /sqlite/
44
+ ActiveRecordFixtures::Order.cache do
45
+ m = ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
46
+ ActiveRecordFixtures::Order.find(:all)
47
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
48
+ assert_equal 1, s.call_count
49
+
50
+ 10.times { ActiveRecordFixtures::Order.find m.id }
51
+ end
52
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
53
+ assert_equal 2, s.call_count
54
+ end
55
+
56
+ def test_metric_names
57
+ m = ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
58
+ m = ActiveRecordFixtures::Order.find(m.id)
59
+ m.id = 999
60
+ m.save!
61
+
62
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
63
+ # This doesn't work on hudson because the sampler metrics creep in.
64
+ # metrics = NewRelic::Agent.instance.stats_engine.metrics.select { |mname| mname =~ /ActiveRecord\/ActiveRecordFixtures::Order\// }.sort
65
+ expected = %W[
66
+ ActiveRecord/all
67
+ ActiveRecord/find
68
+ ActiveRecord/ActiveRecordFixtures::Order/find
69
+ ]
70
+ expected += %W[Database/SQL/insert] if ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /jdbc/
71
+ expected += %W[ActiveRecord/create] unless ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /jdbc/
72
+ expected += %W[Database/SQL/other] unless ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /jdbc|sqlite/
73
+ expected += %W[ActiveRecord/ActiveRecordFixtures::Order/create] unless ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /jdbc/
74
+ expected += %W[ActiveRecord/save ActiveRecord/ActiveRecordFixtures::Order/save] if NewRelic::Control.instance.rails_version < '2.1.0'
75
+ compare_metrics expected, metrics
76
+ assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find").call_count
77
+ assert_equal (defined?(JRuby) ? 0 : 1), NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/create").call_count
78
+ end
79
+ def test_join_metrics
80
+ m = ActiveRecordFixtures::Order.create :name => 'jeff'
81
+ m = ActiveRecordFixtures::Order.find(m.id)
82
+ s = m.shipments.create
83
+ m.shipments.to_a
84
+ m.destroy
85
+
86
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
87
+ # This doesn't work on hudson because the sampler metrics creep in.
88
+ # metrics = NewRelic::Agent.instance.stats_engine.metrics.select { |mname| mname =~ /ActiveRecord\/ActiveRecordFixtures::Order\// }.sort
89
+ expected_metrics = %W[
90
+ ActiveRecord/all
91
+ ActiveRecord/destroy
92
+ ActiveRecord/ActiveRecordFixtures::Order/destroy
93
+ Database/SQL/insert
94
+ Database/SQL/delete
95
+ ActiveRecord/find
96
+ ActiveRecord/ActiveRecordFixtures::Order/find
97
+ ActiveRecord/ActiveRecordFixtures::Shipment/find
98
+ ]
99
+
100
+ expected_metrics += %W[
101
+ Database/SQL/other
102
+ Database/SQL/show
103
+ ] unless ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /jdbc|sqlite/
104
+ expected_metrics += %W[
105
+ ActiveRecord/create
106
+ ActiveRecord/ActiveRecordFixtures::Shipment/create
107
+ ActiveRecord/ActiveRecordFixtures::Order/create
108
+ ] unless ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /jdbc/
109
+
110
+ compare_metrics expected_metrics, metrics
111
+ # This number may be different with different db adapters, not sure
112
+ # assert_equal 17, NewRelic::Agent.get_stats("ActiveRecord/all").call_count
113
+ 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/
114
+ assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find").call_count
115
+ assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Shipment/find").call_count
116
+ assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/insert").call_count unless defined? JRuby
117
+ assert_equal 3, NewRelic::Agent.get_stats("Database/SQL/insert").call_count if defined? JRuby
118
+ assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/delete").call_count
119
+ end
120
+ def test_direct_sql
121
+ assert_nil NewRelic::Agent::Instrumentation::MetricFrame.current
122
+ assert_equal nil, NewRelic::Agent.instance.stats_engine.scope_name
123
+ assert_equal 0, NewRelic::Agent.instance.stats_engine.metrics.size, NewRelic::Agent.instance.stats_engine.metrics.inspect
124
+ ActiveRecordFixtures::Order.connection.select_rows "select * from #{ActiveRecordFixtures::Order.table_name}"
125
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
126
+ compare_metrics %W[
127
+ ActiveRecord/all
128
+ Database/SQL/select
129
+ ], metrics
130
+ assert_equal 1, NewRelic::Agent.instance.stats_engine.get_stats_no_scope("Database/SQL/select").call_count, NewRelic::Agent.instance.stats_engine.get_stats_no_scope("Database/SQL/select")
131
+ end
132
+
133
+ def test_other_sql
134
+ list = ActiveRecordFixtures::Order.connection.execute "begin"
135
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
136
+ compare_metrics %W[
137
+ ActiveRecord/all
138
+ Database/SQL/other
139
+ ], metrics
140
+ assert_equal 1, NewRelic::Agent.get_stats_no_scope("Database/SQL/other").call_count
141
+ end
142
+
143
+ def test_show_sql
144
+ return if ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /sqlite/
145
+ list = ActiveRecordFixtures::Order.connection.execute "show tables"
146
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
147
+ compare_metrics %W[
148
+ ActiveRecord/all
149
+ Database/SQL/show
150
+ ], metrics
151
+ assert_equal 1, NewRelic::Agent.get_stats_no_scope("Database/SQL/show").call_count
152
+ end
153
+
154
+ def test_blocked_instrumentation
155
+ ActiveRecordFixtures::Order.add_delay
156
+ NewRelic::Agent.disable_all_tracing do
157
+ perform_action_with_newrelic_trace :name => 'bogosity' do
158
+ ActiveRecordFixtures::Order.find(:all)
159
+ end
160
+ end
161
+ assert_nil NewRelic::Agent.instance.transaction_sampler.last_sample
162
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
163
+ compare_metrics [], metrics
164
+ end
165
+ def test_run_explains
166
+ perform_action_with_newrelic_trace :name => 'bogosity' do
167
+ ActiveRecordFixtures::Order.add_delay
168
+ ActiveRecordFixtures::Order.find(:all)
169
+ end
170
+ sample = NewRelic::Agent.instance.transaction_sampler.last_sample
171
+
172
+ segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first
173
+ assert_match /^SELECT \* FROM ["`]?#{ActiveRecordFixtures::Order.table_name}["`]?$/i, segment.params[:sql].strip
174
+ NewRelic::TransactionSample::Segment.any_instance.expects(:explain_sql).returns([])
175
+ sample = sample.prepare_to_send(:record_sql => :obfuscated, :explain_sql => 0.0)
176
+ segment = sample.root_segment.called_segments.first.called_segments.first
177
+ end
178
+ def test_prepare_to_send
179
+ perform_action_with_newrelic_trace :name => 'bogosity' do
180
+ ActiveRecordFixtures::Order.add_delay
181
+ ActiveRecordFixtures::Order.find(:all)
182
+ end
183
+ sample = NewRelic::Agent.instance.transaction_sampler.last_sample
184
+ assert_not_nil sample
185
+ assert_equal 3, sample.count_segments, sample.to_s
186
+ #
187
+ sql_segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first rescue nil
188
+ assert_not_nil sql_segment, sample.to_s
189
+ assert_match /^SELECT /, sql_segment.params[:sql]
190
+ assert sql_segment.duration > 0.0, "Segment duration must be greater than zero."
191
+ sample = sample.prepare_to_send(:record_sql => :raw, :explain_sql => 0.0)
192
+ sql_segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first
193
+ assert_match /^SELECT /, sql_segment.params[:sql]
194
+ explanations = sql_segment.params[:explanation]
195
+ if isMysql? || isPostgres?
196
+ assert_not_nil explanations, "No explains in segment: #{sql_segment}"
197
+ assert_equal 1, explanations.size,"No explains in segment: #{sql_segment}"
198
+ assert_equal 1, explanations.first.size
199
+ end
200
+ end
201
+ def test_transaction
202
+ sample = NewRelic::Agent.instance.transaction_sampler.reset!
203
+ perform_action_with_newrelic_trace :name => 'bogosity' do
204
+ ActiveRecordFixtures::Order.add_delay
205
+ ActiveRecordFixtures::Order.find(:all)
206
+ end
207
+
208
+ sample = NewRelic::Agent.instance.transaction_sampler.last_sample
209
+
210
+ sample = sample.prepare_to_send(:record_sql => :obfuscated, :explain_sql => 0.0)
211
+ segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first
212
+ explanations = segment.params[:explanation]
213
+ if isMysql? || isPostgres?
214
+ assert_not_nil explanations, "No explains in segment: #{segment}"
215
+ assert_equal 1, explanations.size,"No explains in segment: #{segment}"
216
+ assert_equal 1, explanations.first.size
217
+ end
218
+ if isPostgres?
219
+ assert_equal Array, explanations.class
220
+ assert_equal Array, explanations[0].class
221
+ assert_equal Array, explanations[0][0].class
222
+ assert_match /Seq Scan on test_data/, explanations[0][0].join(";")
223
+ elsif isMysql?
224
+ assert_equal "1;SIMPLE;#{ActiveRecordFixtures::Order.table_name};ALL;;;;;1;", explanations.first.first.join(";")
225
+ end
226
+
227
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
228
+ assert_equal 1, s.call_count
229
+ end
230
+ # These are only valid for rails 2.1 and later
231
+ if NewRelic::Control.instance.rails_version >= NewRelic::VersionNumber.new("2.1.0")
232
+ ActiveRecordFixtures::Order.class_eval do
233
+ named_scope :jeffs, :conditions => { :name => 'Jeff' }
234
+ end
235
+ def test_named_scope
236
+ ActiveRecordFixtures::Order.create :name => 'Jeff'
237
+ s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
238
+ before_count = s.call_count
239
+ x = ActiveRecordFixtures::Order.jeffs.find(:all)
240
+ assert_equal 1, x.size
241
+ se = NewRelic::Agent.instance.stats_engine
242
+ assert_equal before_count+1, s.call_count
243
+ end
244
+ end
245
+
246
+ # This is to make sure the all metric is recorded for exceptional cases
247
+ def test_error_handling
248
+ # have the AR select throw an error
249
+ ActiveRecordFixtures::Order.connection.stubs(:log_info).with do | sql, x, y |
250
+ raise "Error" if sql =~ /select/
251
+ true
252
+ end
253
+ ActiveRecordFixtures::Order.connection.select_rows "select * from #{ActiveRecordFixtures::Order.table_name}" rescue nil
254
+ metrics = NewRelic::Agent.instance.stats_engine.metrics
255
+ compare_metrics %W[
256
+ ActiveRecord/all
257
+ Database/SQL/select
258
+ ], metrics
259
+ assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/select").call_count
260
+ assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/all").call_count
261
+ end
262
+
263
+ def test_rescue_handling
264
+ # Not sure why we get a transaction error with sqlite
265
+ return if ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] =~ /sqlite/
266
+ begin
267
+ ActiveRecordFixtures::Order.transaction do
268
+ raise ActiveRecord::ActiveRecordError.new('preserve-me!')
269
+ end
270
+ rescue ActiveRecord::ActiveRecordError => e
271
+ assert_equal 'preserve-me!', e.message
272
+ rescue
273
+ fail "Rescue2: Got something COMPLETELY unexpected: $!:#{$!.inspect}"
274
+ end
275
+
276
+ end
277
+
278
+ private
279
+
280
+ def isPostgres?
281
+ ActiveRecordFixtures::Order.configurations[RAILS_ENV]['adapter'] =~ /postgres/
282
+ end
283
+ def isMysql?
284
+ ActiveRecordFixtures::Order.connection.class.name =~ /mysql/i
285
+ end
286
+ end if defined? Rails