wd_newrelic_rpm 3.3.4.1 → 3.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. data/.gitignore +20 -0
  2. data/.project +23 -0
  3. data/.travis.yml +9 -0
  4. data/CHANGELOG +317 -39
  5. data/GUIDELINES_FOR_CONTRIBUTING.md +76 -0
  6. data/Gemfile +16 -0
  7. data/LICENSE +1 -1
  8. data/{README.rdoc → README.md} +71 -55
  9. data/Rakefile +62 -0
  10. data/bin/mongrel_rpm +1 -1
  11. data/config.dot +290 -0
  12. data/config/database.yml +5 -0
  13. data/init.rb +31 -0
  14. data/lib/new_relic/agent.rb +31 -60
  15. data/lib/new_relic/agent/agent.rb +277 -502
  16. data/lib/new_relic/agent/agent_logger.rb +165 -0
  17. data/lib/new_relic/agent/audit_logger.rb +72 -0
  18. data/lib/new_relic/agent/beacon_configuration.rb +36 -50
  19. data/lib/new_relic/agent/browser_monitoring.rb +114 -61
  20. data/lib/new_relic/agent/busy_calculator.rb +14 -6
  21. data/lib/new_relic/agent/configuration.rb +74 -0
  22. data/lib/new_relic/agent/configuration/defaults.rb +126 -0
  23. data/lib/new_relic/agent/configuration/environment_source.rb +49 -0
  24. data/lib/new_relic/agent/configuration/manager.rb +136 -0
  25. data/lib/new_relic/agent/configuration/mask_defaults.rb +10 -0
  26. data/lib/new_relic/agent/configuration/server_source.rb +27 -0
  27. data/lib/new_relic/agent/configuration/yaml_source.rb +63 -0
  28. data/lib/new_relic/agent/cross_process_monitoring.rb +43 -0
  29. data/lib/new_relic/agent/database.rb +39 -26
  30. data/lib/new_relic/agent/error_collector.rb +48 -49
  31. data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/active_record.rb +4 -7
  33. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +1 -1
  34. data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
  35. data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +41 -0
  36. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +35 -12
  37. data/lib/new_relic/agent/instrumentation/data_mapper.rb +4 -12
  38. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -2
  39. data/lib/new_relic/agent/instrumentation/memcache.rb +6 -6
  40. data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
  41. data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
  42. data/lib/new_relic/agent/instrumentation/metric_frame.rb +4 -14
  43. data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +1 -1
  44. data/lib/new_relic/agent/instrumentation/net.rb +1 -1
  45. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +6 -20
  46. data/lib/new_relic/agent/instrumentation/queue_time.rb +2 -2
  47. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  48. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +7 -7
  49. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
  50. data/lib/new_relic/agent/instrumentation/rails/errors.rb +1 -1
  51. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -5
  52. data/lib/new_relic/agent/instrumentation/rails3/errors.rb +6 -2
  53. data/lib/new_relic/agent/instrumentation/resque.rb +81 -0
  54. data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -10
  55. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  56. data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +5 -4
  57. data/lib/new_relic/agent/method_tracer.rb +11 -9
  58. data/lib/new_relic/agent/new_relic_service.rb +379 -0
  59. data/lib/new_relic/agent/pipe_channel_manager.rb +175 -0
  60. data/lib/new_relic/agent/pipe_service.rb +58 -0
  61. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +86 -0
  62. data/lib/new_relic/agent/samplers/memory_sampler.rb +6 -8
  63. data/lib/new_relic/agent/sql_sampler.rb +31 -74
  64. data/lib/new_relic/agent/stats_engine.rb +0 -5
  65. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +40 -24
  66. data/lib/new_relic/agent/stats_engine/metric_stats.rb +89 -14
  67. data/lib/new_relic/agent/stats_engine/samplers.rb +9 -7
  68. data/lib/new_relic/agent/stats_engine/transactions.rb +20 -12
  69. data/lib/new_relic/agent/thread.rb +32 -0
  70. data/lib/new_relic/agent/thread_profiler.rb +306 -0
  71. data/lib/new_relic/agent/transaction_info.rb +24 -4
  72. data/lib/new_relic/agent/transaction_sample_builder.rb +12 -13
  73. data/lib/new_relic/agent/transaction_sampler.rb +49 -65
  74. data/lib/new_relic/agent/worker_loop.rb +31 -25
  75. data/lib/new_relic/collection_helper.rb +1 -1
  76. data/lib/new_relic/commands/deployments.rb +19 -10
  77. data/lib/new_relic/control.rb +1 -3
  78. data/lib/new_relic/control/class_methods.rb +10 -5
  79. data/lib/new_relic/control/frameworks/merb.rb +0 -6
  80. data/lib/new_relic/control/frameworks/rails.rb +30 -45
  81. data/lib/new_relic/control/frameworks/rails3.rb +23 -18
  82. data/lib/new_relic/control/frameworks/rails4.rb +23 -0
  83. data/lib/new_relic/control/frameworks/ruby.rb +2 -23
  84. data/lib/new_relic/control/instance_methods.rb +35 -73
  85. data/lib/new_relic/control/instrumentation.rb +7 -12
  86. data/lib/new_relic/control/server_methods.rb +17 -19
  87. data/lib/new_relic/delayed_job_injection.rb +2 -2
  88. data/lib/new_relic/helper.rb +34 -0
  89. data/lib/new_relic/language_support.rb +56 -37
  90. data/lib/new_relic/local_environment.rb +32 -67
  91. data/lib/new_relic/metric_data.rb +10 -2
  92. data/lib/new_relic/metric_spec.rb +7 -3
  93. data/lib/new_relic/noticed_error.rb +32 -9
  94. data/lib/new_relic/rack.rb +4 -0
  95. data/lib/new_relic/rack/browser_monitoring.rb +34 -25
  96. data/lib/new_relic/rack/developer_mode.rb +3 -0
  97. data/lib/new_relic/rack/error_collector.rb +56 -0
  98. data/lib/new_relic/stats.rb +9 -7
  99. data/lib/new_relic/transaction_sample.rb +19 -18
  100. data/lib/new_relic/transaction_sample/segment.rb +13 -15
  101. data/lib/new_relic/version.rb +19 -3
  102. data/lib/newrelic_rpm.rb +1 -1
  103. data/lib/tasks/tests.rake +6 -8
  104. data/newrelic.yml +15 -32
  105. data/newrelic_rpm.gemspec +224 -43
  106. data/newrelic_rpm.gemspec.erb +54 -0
  107. data/test/config/newrelic.yml +4 -3
  108. data/test/config/test_control.rb +18 -18
  109. data/test/fixtures/gemspec_no_build.rb +442 -0
  110. data/test/fixtures/gemspec_with_build.rb +442 -0
  111. data/test/fixtures/gemspec_with_build_and_stage.rb +442 -0
  112. data/test/intentional_fail.rb +10 -0
  113. data/test/multiverse/.gitignore +10 -0
  114. data/test/multiverse/README.md +85 -0
  115. data/test/multiverse/lib/multiverse/color.rb +13 -0
  116. data/test/multiverse/lib/multiverse/envfile.rb +66 -0
  117. data/test/multiverse/lib/multiverse/environment.rb +16 -0
  118. data/test/multiverse/lib/multiverse/output_collector.rb +29 -0
  119. data/test/multiverse/lib/multiverse/runner.rb +44 -0
  120. data/test/multiverse/lib/multiverse/suite.rb +162 -0
  121. data/test/multiverse/script/run_one +3 -0
  122. data/test/multiverse/script/runner +9 -0
  123. data/test/multiverse/suites/active_record/Envfile +13 -0
  124. data/test/multiverse/suites/active_record/ar_method_aliasing.rb +94 -0
  125. data/test/multiverse/suites/active_record/config/newrelic.yml +22 -0
  126. data/test/multiverse/suites/active_record/encoding_test.rb +26 -0
  127. data/test/multiverse/suites/agent_only/Envfile +4 -0
  128. data/test/multiverse/suites/agent_only/audit_log_test.rb +99 -0
  129. data/test/multiverse/suites/agent_only/config/newrelic.yml +22 -0
  130. data/test/multiverse/suites/agent_only/http_response_code_test.rb +53 -0
  131. data/test/multiverse/suites/agent_only/marshaling_test.rb +109 -0
  132. data/test/multiverse/suites/agent_only/method_visibility_test.rb +98 -0
  133. data/test/multiverse/suites/agent_only/pipe_manager_test.rb +33 -0
  134. data/test/multiverse/suites/agent_only/service_timeout_test.rb +29 -0
  135. data/test/multiverse/suites/agent_only/test_trace_method_with_punctuation.rb +30 -0
  136. data/test/multiverse/suites/agent_only/test_trace_transaction_with_punctuation.rb +32 -0
  137. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +80 -0
  138. data/test/multiverse/suites/config_file_loading/Envfile +7 -0
  139. data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +106 -0
  140. data/test/multiverse/suites/datamapper/Envfile +8 -0
  141. data/test/multiverse/suites/datamapper/config/newrelic.yml +22 -0
  142. data/test/multiverse/suites/datamapper/encoding_test.rb +36 -0
  143. data/test/multiverse/suites/logging/Envfile +4 -0
  144. data/test/multiverse/suites/logging/config/newrelic.yml +22 -0
  145. data/test/multiverse/suites/logging/logging_test.rb +143 -0
  146. data/test/multiverse/suites/monitor_mode_false/Envfile +2 -0
  147. data/test/multiverse/suites/monitor_mode_false/config/newrelic.yml +25 -0
  148. data/test/multiverse/suites/monitor_mode_false/no_dns_resolv.rb +29 -0
  149. data/test/multiverse/suites/no_load/Envfile +2 -0
  150. data/test/multiverse/suites/no_load/config/newrelic.yml +22 -0
  151. data/test/multiverse/suites/no_load/start_up_test.rb +14 -0
  152. data/test/multiverse/suites/rails_3_error_tracing/Envfile +15 -0
  153. data/test/multiverse/suites/rails_3_error_tracing/config/newrelic.yml +165 -0
  154. data/test/multiverse/suites/rails_3_error_tracing/error_tracing_test.rb +236 -0
  155. data/test/multiverse/suites/rails_3_gc/Envfile +8 -0
  156. data/test/multiverse/suites/rails_3_gc/config/newrelic.yml +167 -0
  157. data/test/multiverse/suites/rails_3_gc/instrumentation_test.rb +92 -0
  158. data/test/multiverse/suites/rails_3_queue_time/Envfile +15 -0
  159. data/test/multiverse/suites/rails_3_queue_time/config/newrelic.yml +165 -0
  160. data/test/multiverse/suites/rails_3_queue_time/queue_time_test.rb +75 -0
  161. data/test/multiverse/suites/rails_3_views/.gitignore +3 -0
  162. data/test/multiverse/suites/rails_3_views/Envfile +16 -0
  163. data/test/multiverse/suites/rails_3_views/app/views/foos/_foo.html.haml +1 -0
  164. data/test/multiverse/suites/rails_3_views/app/views/test/_a_partial.html.erb +1 -0
  165. data/test/multiverse/suites/rails_3_views/app/views/test/_mid_partial.html.erb +1 -0
  166. data/test/multiverse/suites/rails_3_views/app/views/test/_top_partial.html.erb +3 -0
  167. data/test/multiverse/suites/rails_3_views/app/views/test/deep_partial.html.erb +3 -0
  168. data/test/multiverse/suites/rails_3_views/app/views/test/haml_view.html.haml +6 -0
  169. data/test/multiverse/suites/rails_3_views/app/views/test/index.html.erb +4 -0
  170. data/test/multiverse/suites/rails_3_views/config/newrelic.yml +164 -0
  171. data/test/multiverse/suites/rails_3_views/view_instrumentation_test.rb +245 -0
  172. data/test/multiverse/suites/resque/Envfile +21 -0
  173. data/test/multiverse/suites/resque/config/newrelic.yml +22 -0
  174. data/test/multiverse/suites/resque/dump.rdb +0 -0
  175. data/test/multiverse/suites/resque/instrumentation_test.rb +73 -0
  176. data/test/multiverse/suites/rum_auto_instrumentation/Envfile +4 -0
  177. data/test/multiverse/suites/rum_auto_instrumentation/config/newrelic.yml +24 -0
  178. data/test/multiverse/suites/rum_auto_instrumentation/responses/worst_case_small.html +5000 -0
  179. data/test/multiverse/suites/rum_auto_instrumentation/sanity_test.rb +102 -0
  180. data/test/multiverse/suites/sinatra/Envfile +13 -0
  181. data/test/multiverse/suites/sinatra/config/newrelic.yml +24 -0
  182. data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +77 -0
  183. data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +46 -0
  184. data/test/multiverse/suites/sinatra/sinatra_test.rb +55 -0
  185. data/test/multiverse/test/multiverse_test.rb +55 -0
  186. data/test/multiverse/test/suite_examples/one/a/Envfile +3 -0
  187. data/test/multiverse/test/suite_examples/one/a/a_test.rb +11 -0
  188. data/test/multiverse/test/suite_examples/one/a/config/newrelic.yml +24 -0
  189. data/test/multiverse/test/suite_examples/one/b/Envfile +3 -0
  190. data/test/multiverse/test/suite_examples/one/b/b_test.rb +11 -0
  191. data/test/multiverse/test/suite_examples/one/b/config/newrelic.yml +24 -0
  192. data/test/multiverse/test/suite_examples/three/a/Envfile +2 -0
  193. data/test/multiverse/test/suite_examples/three/a/fail_test.rb +6 -0
  194. data/test/multiverse/test/suite_examples/three/b/Envfile +2 -0
  195. data/test/multiverse/test/suite_examples/three/b/win_test.rb +6 -0
  196. data/test/multiverse/test/suite_examples/two/a/Envfile +1 -0
  197. data/test/multiverse/test/suite_examples/two/a/fail_test.rb +6 -0
  198. data/test/new_relic/agent/agent/connect_test.rb +151 -227
  199. data/test/new_relic/agent/agent/start_test.rb +68 -118
  200. data/test/new_relic/agent/agent/start_worker_thread_test.rb +12 -74
  201. data/test/new_relic/agent/agent_logger_test.rb +153 -0
  202. data/test/new_relic/agent/agent_test.rb +116 -30
  203. data/test/new_relic/agent/agent_test_controller.rb +1 -1
  204. data/test/new_relic/agent/agent_test_controller_test.rb +42 -10
  205. data/test/new_relic/agent/audit_logger_test.rb +105 -0
  206. data/test/new_relic/agent/beacon_configuration_test.rb +63 -67
  207. data/test/new_relic/agent/browser_monitoring_test.rb +151 -79
  208. data/test/new_relic/agent/busy_calculator_test.rb +7 -0
  209. data/test/new_relic/agent/configuration/environment_source_test.rb +79 -0
  210. data/test/new_relic/agent/configuration/manager_test.rb +204 -0
  211. data/test/new_relic/agent/configuration/server_source_test.rb +45 -0
  212. data/test/new_relic/agent/configuration/yaml_source_test.rb +75 -0
  213. data/test/new_relic/agent/cross_process_monitoring_test.rb +77 -0
  214. data/test/new_relic/agent/database_test.rb +12 -11
  215. data/test/new_relic/agent/error_collector/notice_error_test.rb +64 -53
  216. data/test/new_relic/agent/error_collector_test.rb +33 -19
  217. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +60 -30
  218. data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +39 -0
  219. data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +1 -1
  220. data/test/new_relic/agent/instrumentation/metric_frame_test.rb +6 -0
  221. data/test/new_relic/agent/instrumentation/queue_time_test.rb +14 -0
  222. data/test/new_relic/agent/instrumentation/sinatra_test.rb +25 -0
  223. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +2 -2
  224. data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +4 -10
  225. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +3 -15
  226. data/test/new_relic/agent/method_tracer_test.rb +7 -6
  227. data/test/new_relic/agent/mock_scope_listener.rb +3 -0
  228. data/test/new_relic/agent/new_relic_service_test.rb +376 -0
  229. data/test/new_relic/agent/pipe_channel_manager_test.rb +131 -0
  230. data/test/new_relic/agent/pipe_service_test.rb +113 -0
  231. data/test/new_relic/agent/rpm_agent_test.rb +27 -50
  232. data/test/new_relic/agent/sql_sampler_test.rb +81 -56
  233. data/test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb +3 -20
  234. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +12 -1
  235. data/test/new_relic/agent/stats_engine_test.rb +17 -8
  236. data/test/new_relic/agent/thread_profiler_test.rb +537 -0
  237. data/test/new_relic/agent/thread_test.rb +89 -0
  238. data/test/new_relic/agent/threaded_test.rb +65 -0
  239. data/test/new_relic/agent/transaction_info_test.rb +45 -4
  240. data/test/new_relic/agent/transaction_sample_builder_test.rb +8 -7
  241. data/test/new_relic/agent/transaction_sampler_test.rb +193 -204
  242. data/test/new_relic/agent/worker_loop_test.rb +26 -11
  243. data/test/new_relic/agent_test.rb +113 -33
  244. data/test/new_relic/collection_helper_test.rb +7 -8
  245. data/test/new_relic/command/deployments_test.rb +18 -2
  246. data/test/new_relic/control/class_methods_test.rb +0 -18
  247. data/test/new_relic/control/frameworks/rails_test.rb +26 -0
  248. data/test/new_relic/control_test.rb +96 -137
  249. data/test/new_relic/delayed_job_injection_test.rb +6 -1
  250. data/test/new_relic/dispatcher_test.rb +54 -0
  251. data/test/new_relic/fake_collector.rb +283 -0
  252. data/test/new_relic/fake_service.rb +53 -0
  253. data/test/new_relic/fakes_sending_data.rb +30 -0
  254. data/test/new_relic/framework_test.rb +53 -0
  255. data/test/new_relic/load_test.rb +13 -0
  256. data/test/new_relic/local_environment_test.rb +11 -11
  257. data/test/new_relic/metric_data_test.rb +45 -16
  258. data/test/new_relic/noticed_error_test.rb +24 -0
  259. data/test/new_relic/rack/browser_monitoring_test.rb +20 -10
  260. data/test/new_relic/rack/developer_mode_test.rb +13 -7
  261. data/test/new_relic/rack/error_collector_test.rb +74 -0
  262. data/test/new_relic/stats_test.rb +10 -0
  263. data/test/new_relic/transaction_sample/segment_test.rb +23 -4
  264. data/test/new_relic/transaction_sample_test.rb +47 -2
  265. data/test/new_relic/version_number_test.rb +32 -0
  266. data/test/script/build_test_gem.sh +9 -3
  267. data/test/script/ci.sh +108 -35
  268. data/test/script/ci_agent-tests_runner.sh +82 -0
  269. data/test/script/ci_multiverse_runner.sh +63 -0
  270. data/test/test_contexts.rb +1 -0
  271. data/test/test_helper.rb +68 -18
  272. data/ui/helpers/developer_mode_helper.rb +21 -11
  273. data/ui/views/layouts/newrelic_default.rhtml +1 -0
  274. data/ui/views/newrelic/file/images/arrow-close.png +0 -0
  275. data/ui/views/newrelic/file/images/arrow-open.png +0 -0
  276. data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
  277. data/ui/views/newrelic/file/images/file_icon.png +0 -0
  278. data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
  279. data/ui/views/newrelic/show_sample.rhtml +1 -1
  280. data/ui/views/newrelic/threads.rhtml +2 -10
  281. data/vendor/gems/metric_parser-0.1.0.pre1/.specification +116 -0
  282. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_init.rb +7 -0
  283. metadata +191 -65
  284. data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +0 -40
  285. data/lib/new_relic/control/configuration.rb +0 -206
  286. data/lib/new_relic/control/logging_methods.rb +0 -143
  287. data/lib/new_relic/data_serialization.rb +0 -151
  288. data/test/new_relic/control/configuration_test.rb +0 -84
  289. data/test/new_relic/control/logging_methods_test.rb +0 -185
  290. data/test/new_relic/data_serialization_test.rb +0 -208
@@ -0,0 +1,15 @@
1
+ suite_condition("Rails 3 does not support 1.8.6") do
2
+ RUBY_VERSION != '1.8.6'
3
+ end
4
+
5
+ gemfile <<-RB
6
+ gem 'rails', '~>3.2.0'
7
+ RB
8
+
9
+ gemfile <<-RB
10
+ gem 'rails', '~>3.1.0'
11
+ RB
12
+
13
+ gemfile <<-RB
14
+ gem 'rails', '~>3.0.0'
15
+ RB
@@ -0,0 +1,165 @@
1
+ #
2
+ # This file configures the NewRelic RPM Agent, NewRelic RPM monitors Rails
3
+ # applications with deep visibility and low overhead. For more information,
4
+ # visit www.newrelic.com.
5
+ #
6
+ #
7
+ #
8
+ # here are the settings that are common to all environments
9
+ common: &default_settings
10
+
11
+ # ============================== LICENSE KEY ===============================
12
+ # You must specify the licence key associated with your New Relic account.
13
+ # This key binds your Agent's data to your account in the New Relic RPM service.
14
+
15
+ #license_key: 'bootstrap_newrelic_admin_license_key_000'
16
+ #host: localhost
17
+ #port: 3000
18
+
19
+ license_key: 'bd0e1d52adade840f7ca727d29a86249e89a6f1c'
20
+ host: localhost
21
+
22
+ # Agent Enabled
23
+ # Use this setting to force the agent to run or not run.
24
+ # Default is 'auto' which means the agent will install and run only if a
25
+ # valid dispatcher such as Mongrel is running. This prevents it from running
26
+ # with Rake or the console. Set to false to completely turn the agent off
27
+ # regardless of the other settings. Valid values are true, false and auto.
28
+ # agent_enabled: auto
29
+
30
+ # Application Name
31
+ # Set this to be the name of your application as you'd like it show up in RPM.
32
+ # RPM will then auto-map instances of your application into a RPM "application"
33
+ # on your home dashboard page. This setting does not prevent you from manually
34
+ # defining applications.
35
+ app_name: Rails 3 view test ap
36
+
37
+ # When 'enabled' is turned on, the agent collects performance data by inserting lightweight
38
+ # tracers on key methods inside the rails framework and asynchronously aggregating
39
+ # and reporting this performance data to the NewRelic RPM service at newrelic.com.
40
+ enabled: false
41
+
42
+ # The newrelic agent generates its own log file to keep its logging information
43
+ # separate from that of your application. Specify its log level here.
44
+ log_level: debug
45
+
46
+ # The newrelic agent communicates with the RPM service via http by default.
47
+ # If you want to communicate via https to increase security, then turn on
48
+ # SSL by setting this value to true. Note, this will result in increased
49
+ # CPU overhead to perform the encryption involved in SSL communication, but this
50
+ # work is done asynchronously to the threads that process your application code, so
51
+ # it should not impact response times.
52
+ ssl: false
53
+
54
+ # Set your application's Apdex threshold value with the 'apdex_t' setting, in seconds. The
55
+ # apdex_t value determines the buckets used to compute your overall Apdex score. Requests
56
+ # that take less than apdex_t seconds to process will be classified as Satisfying transactions;
57
+ # more than apdex_t seconds as Tolerating transactions; and more than four times the apdex_t
58
+ # value as Frustrating transactions. For more
59
+ # about the Apdex standard, see http://support.newrelic.com/faqs/general/apdex
60
+ apdex_t: 1.0
61
+
62
+
63
+ # Proxy settings for connecting to the RPM server.
64
+ #
65
+ # If a proxy is used, the host setting is required. Other settings are optional. Default
66
+ # port is 8080.
67
+ #
68
+ # proxy_host: hostname
69
+ # proxy_port: 8080
70
+ # proxy_user:
71
+ # proxy_pass:
72
+
73
+
74
+ # Tells transaction tracer and error collector (when enabled) whether or not to capture HTTP params.
75
+ # When true, the RoR filter_parameter_logging mechanism is used so that sensitive parameters are not recorded
76
+ capture_params: true
77
+
78
+
79
+ # Transaction tracer captures deep information about slow
80
+ # transactions and sends this to the RPM service once a minute. Included in the
81
+ # transaction is the exact call sequence of the transactions including any SQL statements
82
+ # issued.
83
+ transaction_tracer:
84
+
85
+ # Transaction tracer is enabled by default. Set this to false to turn it off. This feature
86
+ # is only available at the Silver and above product levels.
87
+ enabled: true
88
+
89
+ # Threshold in seconds for when to collect a transaction trace. When the response time of
90
+ # a controller action exceeds this threshold, a transaction trace will be recorded and sent
91
+ # to RPM. Valid values are any float value, or (default) "apdex_f", which will use the
92
+ # threshold for an dissatisfying Apdex controller action - four times the Apdex T value.
93
+ transaction_threshold: apdex_f
94
+
95
+ # When transaction tracer is on, SQL statements can optionally be recorded. The recorder
96
+ # has three modes, "off" which sends no SQL, "raw" which sends the SQL statement in its
97
+ # original form, and "obfuscated", which strips out numeric and string literals
98
+ record_sql: obfuscated
99
+
100
+ # Threshold in seconds for when to collect stack trace for a SQL call. In other words,
101
+ # when SQL statements exceed this threshold, then capture and send to RPM the current
102
+ # stack trace. This is helpful for pinpointing where long SQL calls originate from
103
+ stack_trace_threshold: 0.500
104
+
105
+ # Error collector captures information about uncaught exceptions and sends them to RPM for
106
+ # viewing
107
+ error_collector:
108
+
109
+ # Error collector is enabled by default. Set this to false to turn it off. This feature
110
+ # is only available at the Silver and above product levels
111
+ enabled: true
112
+
113
+ # Tells error collector whether or not to capture a source snippet around the place of the
114
+ # error when errors are View related.
115
+ capture_source: true
116
+
117
+ # To stop specific errors from reporting to RPM, set this property to comma separated
118
+ # values
119
+ #
120
+ #ignore_errors: ActionController::RoutingError, ...
121
+ ignore_errors: IgnoredError
122
+
123
+ # (Advanced) Uncomment this to ensure the cpu and memory samplers won't run. Useful when you
124
+ # are using the agent to monitor an external resource
125
+ # disable_samplers: true
126
+
127
+ # override default settings based on your application's environment
128
+
129
+ # NOTE if your application has other named environments, you should
130
+ # provide newrelic conifguration settings for these enviromnents here.
131
+
132
+ development:
133
+ <<: *default_settings
134
+ # turn off communication to RPM service in development mode.
135
+ # NOTE: for initial evaluation purposes, you may want to temporarily turn
136
+ # the agent on in development mode.
137
+ enabled: true
138
+
139
+ # When running in Developer Mode, the New Relic Agent will present
140
+ # performance information on the last 100 transactions you have
141
+ # executed since starting the mongrel. to view this data, go to
142
+ # http://localhost:3000/newrelic
143
+ developer: true
144
+
145
+ test:
146
+ <<: *default_settings
147
+ # it almost never makes sense to turn on the agent when running unit, functional or
148
+ # integration tests or the like.
149
+ enabled: true
150
+ log_level: debug
151
+
152
+ # Turn on the agent in production for 24x7 monitoring. NewRelic testing shows
153
+ # an average performance impact of < 5 ms per transaction, you you can leave this on
154
+ # all the time without incurring any user-visible performance degredation.
155
+ production:
156
+ <<: *default_settings
157
+ enabled: true
158
+
159
+ # many applications have a staging environment which behaves identically to production.
160
+ # Support for that environment is provided here. By default, the staging environment has
161
+ # the agent turned on.
162
+ staging:
163
+ <<: *default_settings
164
+ enabled: true
165
+ app_name: My Application (Staging)
@@ -0,0 +1,75 @@
1
+ # https://newrelic.atlassian.net/browse/RUBY-927
2
+
3
+ ENV['NEW_RELIC_DISPATCHER'] = 'test'
4
+
5
+ require 'action_controller/railtie'
6
+ require 'rails/test_unit/railtie'
7
+ require 'rails/test_help'
8
+ require 'test/unit'
9
+
10
+ # BEGIN RAILS APP
11
+
12
+ class MyApp < Rails::Application
13
+ # We need a secret token for session, cookies, etc.
14
+ config.active_support.deprecation = :log
15
+ config.secret_token = "49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk"
16
+ end
17
+ MyApp.initialize!
18
+
19
+ MyApp.routes.draw do
20
+ match '/:controller(/:action(/:id))'
21
+ end
22
+
23
+ class ApplicationController < ActionController::Base; end
24
+
25
+ class TestController < ApplicationController
26
+ include Rails.application.routes.url_helpers
27
+
28
+ def queued
29
+ respond_to do |format|
30
+ format.html { render :text => "<html><head></head><body>Queued</body></html>" }
31
+ end
32
+ end
33
+ end
34
+ # END RAILS APP
35
+
36
+ class QueueTimeTest < ActionDispatch::IntegrationTest
37
+ def setup
38
+ NewRelic::Agent.config.apply_config({
39
+ :beacon => "beacon",
40
+ :browser_key => "key"})
41
+
42
+ @agent = NewRelic::Agent::Agent.new
43
+ NewRelic::Agent::Agent.instance_variable_set(:@instance, @agent)
44
+ NewRelic::Agent.manual_start
45
+
46
+ @agent.finish_setup({})
47
+ end
48
+
49
+ def teardown
50
+ NewRelic::Agent::Agent.instance.shutdown if NewRelic::Agent::Agent.instance
51
+ end
52
+
53
+ def test_should_track_queue_time_metric
54
+ get_queued
55
+
56
+ stat = @agent.stats_engine.lookup_stats('WebFrontend/QueueTime')
57
+ assert_equal 1, stat.call_count
58
+ assert stat.total_call_time > 0, "Should track some queue time"
59
+ end
60
+
61
+ def test_should_see_queue_time_in_rum
62
+ get_queued
63
+ assert extract_queue_time_from_response > 0, "Queue time was missing or zero"
64
+ end
65
+
66
+ def get_queued(header="HTTP_X_QUEUE_START")
67
+ get('/test/queued', nil, \
68
+ header => "t=#{(Time.now.to_i * 1_000_000) - 1_000}")
69
+ end
70
+
71
+ def extract_queue_time_from_response
72
+ @response.body =~ /key\","",\".*\",(\d+.*),\d+,new Date/
73
+ $1.to_i
74
+ end
75
+ end
@@ -0,0 +1,3 @@
1
+ *.swp
2
+ log/
3
+ Gemfile.lock
@@ -0,0 +1,16 @@
1
+ suite_condition("Rails 3 not compatible with 1.8.6") do
2
+ RUBY_VERSION != '1.8.6'
3
+ end
4
+
5
+ gemfile <<-RB
6
+ gem 'rails', '~>3.2.0'
7
+ gem 'haml'
8
+ RB
9
+ gemfile <<-RB
10
+ gem 'rails', '~>3.1.0'
11
+ gem 'haml'
12
+ RB
13
+ gemfile <<-RB
14
+ gem 'rails', '~>3.0.0'
15
+ gem 'haml'
16
+ RB
@@ -0,0 +1 @@
1
+ <%= render 'a_partial' %>
@@ -0,0 +1,3 @@
1
+ <% (1..10).each do |i| %>
2
+ <%= render 'mid_partial', :i => i %>
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%- 10.times do |i| %>
2
+ <%= render 'top_partial' %>
3
+ <%- end %>
@@ -0,0 +1,6 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Hello
5
+ %body
6
+ hello from haml
@@ -0,0 +1,4 @@
1
+
2
+ <%- 3.times do |i| %>
3
+ <%= render "a_partial" %>
4
+ <%- end%>
@@ -0,0 +1,164 @@
1
+ #
2
+ # This file configures the NewRelic RPM Agent, NewRelic RPM monitors Rails
3
+ # applications with deep visibility and low overhead. For more information,
4
+ # visit www.newrelic.com.
5
+ #
6
+ #
7
+ #
8
+ # here are the settings that are common to all environments
9
+ common: &default_settings
10
+
11
+ # ============================== LICENSE KEY ===============================
12
+ # You must specify the licence key associated with your New Relic account.
13
+ # This key binds your Agent's data to your account in the New Relic RPM service.
14
+
15
+ #license_key: 'bootstrap_newrelic_admin_license_key_000'
16
+ #host: localhost
17
+ #port: 3000
18
+
19
+ license_key: 'bd0e1d52adade840f7ca727d29a86249e89a6f1c'
20
+ host: localhost
21
+
22
+ # Agent Enabled
23
+ # Use this setting to force the agent to run or not run.
24
+ # Default is 'auto' which means the agent will install and run only if a
25
+ # valid dispatcher such as Mongrel is running. This prevents it from running
26
+ # with Rake or the console. Set to false to completely turn the agent off
27
+ # regardless of the other settings. Valid values are true, false and auto.
28
+ # agent_enabled: auto
29
+
30
+ # Application Name
31
+ # Set this to be the name of your application as you'd like it show up in RPM.
32
+ # RPM will then auto-map instances of your application into a RPM "application"
33
+ # on your home dashboard page. This setting does not prevent you from manually
34
+ # defining applications.
35
+ app_name: Rails 3 view test ap
36
+
37
+ # When 'enabled' is turned on, the agent collects performance data by inserting lightweight
38
+ # tracers on key methods inside the rails framework and asynchronously aggregating
39
+ # and reporting this performance data to the NewRelic RPM service at newrelic.com.
40
+ enabled: false
41
+
42
+ # The newrelic agent generates its own log file to keep its logging information
43
+ # separate from that of your application. Specify its log level here.
44
+ log_level: debug
45
+
46
+ # The newrelic agent communicates with the RPM service via http by default.
47
+ # If you want to communicate via https to increase security, then turn on
48
+ # SSL by setting this value to true. Note, this will result in increased
49
+ # CPU overhead to perform the encryption involved in SSL communication, but this
50
+ # work is done asynchronously to the threads that process your application code, so
51
+ # it should not impact response times.
52
+ ssl: false
53
+
54
+ # Set your application's Apdex threshold value with the 'apdex_t' setting, in seconds. The
55
+ # apdex_t value determines the buckets used to compute your overall Apdex score. Requests
56
+ # that take less than apdex_t seconds to process will be classified as Satisfying transactions;
57
+ # more than apdex_t seconds as Tolerating transactions; and more than four times the apdex_t
58
+ # value as Frustrating transactions. For more
59
+ # about the Apdex standard, see http://support.newrelic.com/faqs/general/apdex
60
+ apdex_t: 1.0
61
+
62
+
63
+ # Proxy settings for connecting to the RPM server.
64
+ #
65
+ # If a proxy is used, the host setting is required. Other settings are optional. Default
66
+ # port is 8080.
67
+ #
68
+ # proxy_host: hostname
69
+ # proxy_port: 8080
70
+ # proxy_user:
71
+ # proxy_pass:
72
+
73
+
74
+ # Tells transaction tracer and error collector (when enabled) whether or not to capture HTTP params.
75
+ # When true, the RoR filter_parameter_logging mechanism is used so that sensitive parameters are not recorded
76
+ capture_params: false
77
+
78
+
79
+ # Transaction tracer captures deep information about slow
80
+ # transactions and sends this to the RPM service once a minute. Included in the
81
+ # transaction is the exact call sequence of the transactions including any SQL statements
82
+ # issued.
83
+ transaction_tracer:
84
+
85
+ # Transaction tracer is enabled by default. Set this to false to turn it off. This feature
86
+ # is only available at the Silver and above product levels.
87
+ enabled: true
88
+
89
+ # Threshold in seconds for when to collect a transaction trace. When the response time of
90
+ # a controller action exceeds this threshold, a transaction trace will be recorded and sent
91
+ # to RPM. Valid values are any float value, or (default) "apdex_f", which will use the
92
+ # threshold for an dissatisfying Apdex controller action - four times the Apdex T value.
93
+ transaction_threshold: apdex_f
94
+
95
+ # When transaction tracer is on, SQL statements can optionally be recorded. The recorder
96
+ # has three modes, "off" which sends no SQL, "raw" which sends the SQL statement in its
97
+ # original form, and "obfuscated", which strips out numeric and string literals
98
+ record_sql: obfuscated
99
+
100
+ # Threshold in seconds for when to collect stack trace for a SQL call. In other words,
101
+ # when SQL statements exceed this threshold, then capture and send to RPM the current
102
+ # stack trace. This is helpful for pinpointing where long SQL calls originate from
103
+ stack_trace_threshold: 0.500
104
+
105
+ # Error collector captures information about uncaught exceptions and sends them to RPM for
106
+ # viewing
107
+ error_collector:
108
+
109
+ # Error collector is enabled by default. Set this to false to turn it off. This feature
110
+ # is only available at the Silver and above product levels
111
+ enabled: true
112
+
113
+ # Tells error collector whether or not to capture a source snippet around the place of the
114
+ # error when errors are View related.
115
+ capture_source: true
116
+
117
+ # To stop specific errors from reporting to RPM, set this property to comma separated
118
+ # values
119
+ #
120
+ #ignore_errors: ActionController::RoutingError, ...
121
+
122
+ # (Advanced) Uncomment this to ensure the cpu and memory samplers won't run. Useful when you
123
+ # are using the agent to monitor an external resource
124
+ # disable_samplers: true
125
+
126
+ # override default settings based on your application's environment
127
+
128
+ # NOTE if your application has other named environments, you should
129
+ # provide newrelic conifguration settings for these enviromnents here.
130
+
131
+ development:
132
+ <<: *default_settings
133
+ # turn off communication to RPM service in development mode.
134
+ # NOTE: for initial evaluation purposes, you may want to temporarily turn
135
+ # the agent on in development mode.
136
+ enabled: true
137
+
138
+ # When running in Developer Mode, the New Relic Agent will present
139
+ # performance information on the last 100 transactions you have
140
+ # executed since starting the mongrel. to view this data, go to
141
+ # http://localhost:3000/newrelic
142
+ developer: true
143
+
144
+ test:
145
+ <<: *default_settings
146
+ # it almost never makes sense to turn on the agent when running unit, functional or
147
+ # integration tests or the like.
148
+ enabled: true
149
+ log_level: debug
150
+
151
+ # Turn on the agent in production for 24x7 monitoring. NewRelic testing shows
152
+ # an average performance impact of < 5 ms per transaction, you you can leave this on
153
+ # all the time without incurring any user-visible performance degredation.
154
+ production:
155
+ <<: *default_settings
156
+ enabled: true
157
+
158
+ # many applications have a staging environment which behaves identically to production.
159
+ # Support for that environment is provided here. By default, the staging environment has
160
+ # the agent turned on.
161
+ staging:
162
+ <<: *default_settings
163
+ enabled: true
164
+ app_name: My Application (Staging)