newrelic_rpm 3.6.6.147 → 3.6.7.152

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gitignore +0 -1
  3. data/CHANGELOG +55 -17
  4. data/Guardfile +7 -0
  5. data/Rakefile +6 -0
  6. data/bin/mongrel_rpm +33 -0
  7. data/bin/newrelic +13 -0
  8. data/bin/newrelic_cmd +5 -0
  9. data/bin/nrdebug +273 -0
  10. data/install.rb +3 -3
  11. data/lib/new_relic/agent.rb +4 -6
  12. data/lib/new_relic/agent/agent.rb +76 -72
  13. data/lib/new_relic/agent/autostart.rb +18 -5
  14. data/lib/new_relic/agent/browser_monitoring.rb +41 -35
  15. data/lib/new_relic/agent/browser_token.rb +38 -0
  16. data/lib/new_relic/agent/busy_calculator.rb +7 -5
  17. data/lib/new_relic/agent/commands/agent_command.rb +19 -0
  18. data/lib/new_relic/agent/commands/agent_command_router.rb +88 -0
  19. data/lib/new_relic/agent/commands/thread_profiler.rb +80 -0
  20. data/lib/new_relic/agent/configuration/default_source.rb +700 -0
  21. data/lib/new_relic/agent/configuration/environment_source.rb +83 -30
  22. data/lib/new_relic/agent/configuration/manager.rb +8 -8
  23. data/lib/new_relic/agent/configuration/mask_defaults.rb +2 -2
  24. data/lib/new_relic/agent/cross_app_monitor.rb +10 -21
  25. data/lib/new_relic/agent/cross_app_tracing.rb +3 -3
  26. data/lib/new_relic/agent/error_collector.rb +7 -10
  27. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -1
  28. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +5 -1
  29. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +5 -1
  30. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
  31. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +5 -12
  33. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +4 -0
  34. data/lib/new_relic/agent/instrumentation/{rails4/active_record.rb → active_record_4.rb} +1 -1
  35. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +11 -11
  36. data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -6
  37. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +12 -6
  38. data/lib/new_relic/agent/instrumentation/curb.rb +11 -2
  39. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +1 -3
  40. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +11 -2
  41. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +13 -4
  42. data/lib/new_relic/agent/instrumentation/puma.rb +2 -1
  43. data/lib/new_relic/agent/instrumentation/rack.rb +15 -17
  44. data/lib/new_relic/agent/method_tracer.rb +181 -191
  45. data/lib/new_relic/agent/new_relic_service.rb +16 -14
  46. data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
  47. data/lib/new_relic/agent/request_sampler.rb +32 -165
  48. data/lib/new_relic/agent/sampled_buffer.rb +79 -0
  49. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -8
  50. data/lib/new_relic/agent/sql_sampler.rb +3 -3
  51. data/lib/new_relic/agent/stats_engine.rb +1 -1
  52. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
  53. data/lib/new_relic/agent/stats_engine/metric_stats.rb +2 -3
  54. data/lib/new_relic/agent/stats_engine/transactions.rb +2 -22
  55. data/lib/new_relic/agent/threading/agent_thread.rb +41 -0
  56. data/lib/new_relic/agent/threading/backtrace_node.rb +71 -0
  57. data/lib/new_relic/agent/threading/thread_profile.rb +172 -0
  58. data/lib/new_relic/agent/transaction.rb +16 -4
  59. data/lib/new_relic/agent/transaction_sample_builder.rb +13 -3
  60. data/lib/new_relic/agent/transaction_sampler.rb +5 -8
  61. data/lib/new_relic/agent/transaction_state.rb +166 -0
  62. data/lib/new_relic/agent/transaction_timings.rb +53 -0
  63. data/lib/new_relic/cli/command.rb +91 -0
  64. data/lib/new_relic/{commands → cli}/deployments.rb +13 -9
  65. data/lib/new_relic/{commands → cli}/install.rb +2 -2
  66. data/lib/new_relic/control/frameworks/rails.rb +1 -8
  67. data/lib/new_relic/control/instance_methods.rb +1 -2
  68. data/lib/new_relic/helper.rb +9 -0
  69. data/lib/new_relic/local_environment.rb +16 -63
  70. data/lib/new_relic/rack/browser_monitoring.rb +8 -5
  71. data/lib/new_relic/recipes.rb +44 -31
  72. data/lib/new_relic/transaction_sample.rb +6 -2
  73. data/lib/new_relic/version.rb +1 -1
  74. data/lib/tasks/install.rake +21 -1
  75. data/newrelic_rpm.gemspec +5 -1
  76. data/test/agent_helper.rb +4 -9
  77. data/test/environments/.gitignore +16 -0
  78. data/test/environments/lib/environments/runner.rb +104 -0
  79. data/test/environments/norails/Gemfile +11 -0
  80. data/test/environments/norails/Rakefile +9 -0
  81. data/test/environments/rails21/Gemfile +24 -0
  82. data/test/environments/rails21/Rakefile +12 -0
  83. data/test/environments/rails21/app/controllers/application.rb +20 -0
  84. data/test/environments/rails21/config/boot.rb +113 -0
  85. data/test/environments/rails21/config/database.yml +31 -0
  86. data/test/environments/rails21/config/environment.rb +28 -0
  87. data/test/environments/rails21/config/environments/development.rb +16 -0
  88. data/test/environments/rails21/config/environments/production.rb +8 -0
  89. data/test/environments/rails21/config/environments/test.rb +10 -0
  90. data/test/environments/rails21/config/routes.rb +5 -0
  91. data/test/environments/rails21/db/schema.rb +5 -0
  92. data/test/environments/rails22/Gemfile +29 -0
  93. data/test/environments/rails22/Rakefile +12 -0
  94. data/test/environments/rails22/app/controllers/application.rb +20 -0
  95. data/test/environments/rails22/config/boot.rb +113 -0
  96. data/test/environments/rails22/config/database.yml +31 -0
  97. data/test/environments/rails22/config/environment.rb +27 -0
  98. data/test/environments/rails22/config/environments/development.rb +16 -0
  99. data/test/environments/rails22/config/environments/production.rb +8 -0
  100. data/test/environments/rails22/config/environments/test.rb +10 -0
  101. data/test/environments/rails22/config/routes.rb +5 -0
  102. data/test/environments/rails22/db/schema.rb +5 -0
  103. data/test/environments/rails23/Gemfile +22 -0
  104. data/test/environments/rails23/Rakefile +12 -0
  105. data/test/environments/rails23/app/controllers/application.rb +20 -0
  106. data/test/environments/rails23/config/boot.rb +127 -0
  107. data/test/environments/rails23/config/database.yml +31 -0
  108. data/test/environments/rails23/config/environment.rb +25 -0
  109. data/test/environments/rails23/config/environments/development.rb +16 -0
  110. data/test/environments/rails23/config/environments/production.rb +8 -0
  111. data/test/environments/rails23/config/environments/test.rb +10 -0
  112. data/test/environments/rails23/config/preinitializer.rb +25 -0
  113. data/test/environments/rails23/config/routes.rb +5 -0
  114. data/test/environments/rails23/db/schema.rb +5 -0
  115. data/test/environments/rails30/Gemfile +19 -0
  116. data/test/environments/rails30/Rakefile +9 -0
  117. data/test/environments/rails30/config/application.rb +17 -0
  118. data/test/environments/rails30/config/boot.rb +10 -0
  119. data/test/environments/rails30/config/database.yml +31 -0
  120. data/test/environments/rails30/config/environment.rb +6 -0
  121. data/test/environments/rails30/config/initializers/new_rails_defaults.rb +11 -0
  122. data/test/environments/rails30/db/schema.rb +5 -0
  123. data/test/environments/rails31/Gemfile +19 -0
  124. data/test/environments/rails31/Rakefile +9 -0
  125. data/test/environments/rails31/config/application.rb +18 -0
  126. data/test/environments/rails31/config/boot.rb +10 -0
  127. data/test/environments/rails31/config/database.yml +31 -0
  128. data/test/environments/rails31/config/environment.rb +6 -0
  129. data/test/environments/rails31/config/initializers/new_rails_defaults.rb +21 -0
  130. data/test/environments/rails31/db/schema.rb +5 -0
  131. data/test/environments/rails32/Gemfile +25 -0
  132. data/test/environments/rails32/Rakefile +9 -0
  133. data/test/environments/rails32/config/application.rb +19 -0
  134. data/test/environments/rails32/config/boot.rb +10 -0
  135. data/test/environments/rails32/config/database.yml +31 -0
  136. data/test/environments/rails32/config/environment.rb +6 -0
  137. data/test/environments/rails32/db/schema.rb +5 -0
  138. data/test/environments/rails40/Gemfile +25 -0
  139. data/test/environments/rails40/Rakefile +9 -0
  140. data/test/environments/rails40/config/application.rb +18 -0
  141. data/test/environments/rails40/config/boot.rb +10 -0
  142. data/test/environments/rails40/config/database.yml +31 -0
  143. data/test/environments/rails40/config/environment.rb +6 -0
  144. data/test/environments/rails40/db/schema.rb +5 -0
  145. data/test/multiverse/lib/multiverse/suite.rb +24 -12
  146. data/test/multiverse/suites/agent_only/logging_test.rb +18 -1
  147. data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +1 -8
  148. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +10 -7
  149. data/test/multiverse/suites/curb/curb_test.rb +17 -3
  150. data/test/multiverse/suites/excon/Envfile +1 -1
  151. data/test/multiverse/suites/excon/excon_test.rb +18 -2
  152. data/test/multiverse/suites/httpclient/httpclient_test.rb +2 -2
  153. data/test/multiverse/suites/net_http/net_http_test.rb +2 -2
  154. data/test/multiverse/suites/rails/error_tracing_test.rb +35 -8
  155. data/test/multiverse/suites/rails/ignore_test.rb +48 -0
  156. data/test/multiverse/suites/rails/mongrel_queue_depth_test.rb +44 -0
  157. data/test/multiverse/suites/sequel/sequel_test.rb +11 -0
  158. data/test/multiverse/suites/sinatra/ignoring_test.rb +2 -2
  159. data/test/multiverse/suites/typhoeus/Envfile +9 -2
  160. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +3 -2
  161. data/test/new_relic/agent/agent/start_test.rb +3 -22
  162. data/test/new_relic/agent/agent_test.rb +6 -5
  163. data/test/new_relic/agent/autostart_test.rb +39 -1
  164. data/test/new_relic/agent/browser_monitoring_test.rb +43 -88
  165. data/test/new_relic/agent/browser_token_test.rb +52 -0
  166. data/test/new_relic/agent/busy_calculator_test.rb +1 -1
  167. data/test/new_relic/agent/commands/agent_command_router_test.rb +98 -0
  168. data/test/new_relic/agent/commands/agent_command_test.rb +37 -0
  169. data/test/new_relic/agent/commands/thread_profiler_test.rb +177 -0
  170. data/test/new_relic/agent/configuration/default_source_test.rb +81 -0
  171. data/test/new_relic/agent/configuration/environment_source_test.rb +81 -7
  172. data/test/new_relic/agent/configuration/manager_test.rb +16 -1
  173. data/test/new_relic/agent/cross_app_monitor_test.rb +3 -5
  174. data/test/new_relic/agent/error_collector_test.rb +14 -0
  175. data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +1 -1
  176. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +2 -3
  177. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +29 -31
  178. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +22 -0
  179. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +2 -2
  180. data/test/new_relic/agent/method_tracer_test.rb +2 -2
  181. data/test/new_relic/agent/new_relic_service_test.rb +5 -49
  182. data/test/new_relic/agent/pipe_channel_manager_test.rb +1 -0
  183. data/test/new_relic/agent/request_sampler_test.rb +32 -95
  184. data/test/new_relic/agent/rpm_agent_test.rb +7 -5
  185. data/test/new_relic/agent/sampled_buffer_test.rb +178 -0
  186. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +0 -1
  187. data/test/new_relic/agent/stats_engine_test.rb +10 -17
  188. data/test/new_relic/agent/threading/agent_thread_test.rb +107 -0
  189. data/test/new_relic/agent/threading/backtrace_node_test.rb +96 -0
  190. data/test/new_relic/agent/{threaded_test.rb → threading/fake_thread.rb} +0 -25
  191. data/test/new_relic/agent/threading/thread_profile_test.rb +308 -0
  192. data/test/new_relic/agent/threading/threaded_test_case.rb +33 -0
  193. data/test/new_relic/agent/transaction/pop_test.rb +0 -16
  194. data/test/new_relic/agent/transaction_sample_builder_test.rb +23 -4
  195. data/test/new_relic/agent/transaction_sampler_test.rb +14 -15
  196. data/test/new_relic/agent/transaction_state_test.rb +75 -0
  197. data/test/new_relic/agent/transaction_test.rb +15 -0
  198. data/test/new_relic/agent/transaction_timings_test.rb +81 -0
  199. data/test/new_relic/agent_test.rb +12 -14
  200. data/test/new_relic/{command → cli}/deployments_test.rb +41 -13
  201. data/test/new_relic/control/frameworks/rails_test.rb +1 -2
  202. data/test/new_relic/control_test.rb +1 -2
  203. data/test/new_relic/dependency_detection_test.rb +14 -0
  204. data/test/new_relic/fake_collector.rb +1 -0
  205. data/test/new_relic/helper_test.rb +7 -2
  206. data/test/new_relic/http_client_test_cases.rb +33 -1
  207. data/test/new_relic/local_environment_test.rb +0 -23
  208. data/test/new_relic/metric_data_test.rb +4 -0
  209. data/test/new_relic/rack/browser_monitoring_test.rb +31 -30
  210. data/test/performance/lib/performance/result.rb +15 -4
  211. data/test/performance/lib/performance/timer.rb +7 -1
  212. data/test/performance/script/baselines +102 -0
  213. data/test/performance/suites/rum_autoinsertion.rb +57 -0
  214. data/test/rum/basic.result.html +10 -0
  215. data/test/rum/basic.source.html +10 -0
  216. data/test/rum/comments1.result.html +24 -0
  217. data/test/rum/comments1.source.html +24 -0
  218. data/test/rum/comments2.result.html +24 -0
  219. data/test/rum/comments2.source.html +24 -0
  220. data/test/rum/gt_in_quotes1.result.html +27 -0
  221. data/test/rum/gt_in_quotes1.source.html +27 -0
  222. data/test/rum/gt_in_quotes2.result.html +24 -0
  223. data/test/rum/gt_in_quotes2.source.html +24 -0
  224. data/test/rum/gt_in_quotes_mismatch.result.html +24 -0
  225. data/test/rum/gt_in_quotes_mismatch.source.html +24 -0
  226. data/test/rum/gt_in_single_quotes1.result.html +25 -0
  227. data/test/rum/gt_in_single_quotes1.source.html +25 -0
  228. data/test/rum/gt_in_single_quotes_mismatch.result.html +25 -0
  229. data/test/rum/gt_in_single_quotes_mismatch.source.html +25 -0
  230. data/test/rum/incomplete_non_meta_tags.result.html +10 -0
  231. data/test/rum/incomplete_non_meta_tags.source.html +10 -0
  232. data/test/rum/no_body.result.html +21 -0
  233. data/test/rum/no_body.source.html +21 -0
  234. data/test/rum/no_header.result.html +7 -0
  235. data/test/rum/no_header.source.html +7 -0
  236. data/test/rum/no_start_header.result.html +9 -0
  237. data/test/rum/no_start_header.source.html +9 -0
  238. data/test/rum/script1.result.html +19 -0
  239. data/test/rum/script1.source.html +19 -0
  240. data/test/rum/script2.result.html +17 -0
  241. data/test/rum/script2.source.html +17 -0
  242. data/test/rum/x_ua_meta_tag.result.html +10 -0
  243. data/test/rum/x_ua_meta_tag.source.html +10 -0
  244. data/test/rum/x_ua_meta_tag_multiline.result.html +11 -0
  245. data/test/rum/x_ua_meta_tag_multiline.source.html +11 -0
  246. data/test/rum/x_ua_meta_tag_with_others.result.html +11 -0
  247. data/test/rum/x_ua_meta_tag_with_others.source.html +11 -0
  248. data/test/rum/x_ua_meta_tag_with_spaces.result.html +10 -0
  249. data/test/rum/x_ua_meta_tag_with_spaces.source.html +10 -0
  250. data/test/script/ci.sh +1 -12
  251. data/test/test_helper.rb +1 -0
  252. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +11 -0
  253. metadata +225 -32
  254. metadata.gz.sig +0 -0
  255. data/lib/new_relic/agent/configuration/defaults.rb +0 -157
  256. data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +0 -56
  257. data/lib/new_relic/agent/thread.rb +0 -37
  258. data/lib/new_relic/agent/thread_profiler.rb +0 -323
  259. data/lib/new_relic/agent/transaction_info.rb +0 -114
  260. data/lib/new_relic/command.rb +0 -89
  261. data/test/new_relic/agent/agent_test_controller_test.rb +0 -348
  262. data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +0 -70
  263. data/test/new_relic/agent/thread_profiler_test.rb +0 -586
  264. data/test/new_relic/agent/thread_test.rb +0 -93
  265. data/test/new_relic/agent/transaction_info_test.rb +0 -99
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'rubygems'
6
+
7
+ # Set up gems listed in the Gemfile.
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
+
10
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,31 @@
1
+ # Shared properties for mysql db
2
+ mysql: &mysql
3
+ adapter: mysql
4
+ socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
+ username: root
6
+ host: localhost
7
+ database: rails_blog
8
+
9
+ # Shared properties for postgres. This won't work with our schema but
10
+ # Does work with agent tests
11
+ sqlite3: &sqlite3
12
+ <% if defined?(JRuby) %>
13
+ adapter: jdbcsqlite3
14
+ <% else %>
15
+ adapter: sqlite3
16
+ <% end %>
17
+ database: db/all.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+ host: localhost
21
+
22
+ # SQLite version 3.x
23
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
24
+ development:
25
+ <<: *sqlite3
26
+
27
+ test:
28
+ <<: *mysql
29
+
30
+ production:
31
+ <<: *mysql
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require File.expand_path('../application', __FILE__)
6
+ RpmTestApp::Application.initialize!
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ # File is required to exist by Rails
@@ -0,0 +1,25 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ gem 'rails', '~>4.0.0.rc2'
6
+
7
+ gem "mocha", '~>0.13.0', :require => false
8
+ gem 'rack'
9
+ gem 'rack-test'
10
+
11
+ platforms :jruby do
12
+ gem "activerecord-jdbcmysql-adapter"
13
+ gem "activerecord-jdbcsqlite3-adapter"
14
+ gem "jruby-openssl"
15
+ end
16
+
17
+ platforms :mri_19, :mri_20, :rbx do
18
+ gem "mysql"
19
+ gem "sqlite3-ruby"
20
+ gem "sqlite3"
21
+ end
22
+
23
+ gem 'sequel', '~> 3.46.0'
24
+
25
+ gem "newrelic_rpm", :path => "../../.."
@@ -0,0 +1,9 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ require 'tasks/all'
8
+
9
+ task :default => [:'test:newrelic']
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require File.expand_path('../boot', __FILE__)
6
+
7
+ require 'rails/all'
8
+
9
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
10
+
11
+ module RpmTestApp
12
+ class Application < Rails::Application
13
+ config.encoding = "utf-8"
14
+ config.filter_parameters += [:password]
15
+ config.secret_key_base = '414fd9af0cc192729b2b6bffe9e7077c9ac8eed5cbb74c8c4cd628906b716770598a2b7e1f328052753a4df72e559969dc05b408de73ce040c93cac7c51a348e'
16
+ config.eager_load = false
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'rubygems'
6
+
7
+ # Set up gems listed in the Gemfile.
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
+
10
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,31 @@
1
+ # Shared properties for mysql db
2
+ mysql: &mysql
3
+ adapter: mysql
4
+ socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
+ username: root
6
+ host: localhost
7
+ database: rails_blog
8
+
9
+ # Shared properties for postgres. This won't work with our schema but
10
+ # Does work with agent tests
11
+ sqlite3: &sqlite3
12
+ <% if defined?(JRuby) %>
13
+ adapter: jdbcsqlite3
14
+ <% else %>
15
+ adapter: sqlite3
16
+ <% end %>
17
+ database: db/all.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+ host: localhost
21
+
22
+ # SQLite version 3.x
23
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
24
+ development:
25
+ <<: *sqlite3
26
+
27
+ test:
28
+ <<: *mysql
29
+
30
+ production:
31
+ <<: *mysql
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require File.expand_path('../application', __FILE__)
6
+ RpmTestApp::Application.initialize!
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ # File is required to exist by Rails
@@ -150,23 +150,35 @@ module Multiverse
150
150
  environments.after.call if environments.after
151
151
  end
152
152
 
153
+ def with_clean_env
154
+ if defined?(Bundler)
155
+ # clear $BUNDLE_GEMFILE and $RUBYOPT so that the ruby subprocess can run
156
+ # in the context of another bundle.
157
+ Bundler.with_clean_env { yield }
158
+ else
159
+ yield
160
+ end
161
+ end
162
+
153
163
  def execute_with_pipe(env)
154
164
  Thread.new do
155
- suite = File.basename(directory)
156
- IO.popen("#{__FILE__} #{directory} #{env} '#{seed}' '#{names.join(",")}'") do |io|
157
- OutputCollector.write(suite, env, yellow("Running #{suite.inspect} for Envfile entry #{env}\n"))
158
- OutputCollector.write(suite, env, yellow("Starting tests in child PID #{io.pid}\n"))
159
- until io.eof do
160
- chars = io.read
161
- OutputCollector.write(suite, env, chars)
165
+ with_clean_env do
166
+ suite = File.basename(directory)
167
+ IO.popen("#{__FILE__} #{directory} #{env} '#{seed}' '#{names.join(",")}'") do |io|
168
+ OutputCollector.write(suite, env, yellow("Running #{suite.inspect} for Envfile entry #{env}\n"))
169
+ OutputCollector.write(suite, env, yellow("Starting tests in child PID #{io.pid}\n"))
170
+ until io.eof do
171
+ chars = io.read
172
+ OutputCollector.write(suite, env, chars)
173
+ end
174
+ OutputCollector.suite_report(suite, env)
162
175
  end
163
- OutputCollector.suite_report(suite, env)
164
- end
165
176
 
166
- if $? != 0
167
- OutputCollector.failed(suite, env)
177
+ if $? != 0
178
+ OutputCollector.failed(suite, env)
179
+ end
180
+ Multiverse::Runner.notice_exit_status $?
168
181
  end
169
- Multiverse::Runner.notice_exit_status $?
170
182
  end
171
183
  end
172
184
 
@@ -104,18 +104,35 @@ class LoggingTest < MiniTest::Unit::TestCase
104
104
  "Agent configured not to send data in this environment.")
105
105
  end
106
106
 
107
- def test_logs_mising_license_key
107
+ def test_logs_missing_license_key
108
108
  running_agent_writes_to_log(
109
109
  { :license_key => false },
110
110
  "No license key found in newrelic.yml config.")
111
111
  end
112
112
 
113
+ def test_logs_blank_license_key
114
+ running_agent_writes_to_log(
115
+ { :license_key => '' },
116
+ "No license key found in newrelic.yml config.")
117
+ end
118
+
113
119
  def test_logs_invalid_license_key
114
120
  running_agent_writes_to_log(
115
121
  { :license_key => 'a' * 30 },
116
122
  "Invalid license key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
117
123
  end
118
124
 
125
+ def test_logs_unknown_config_setting_from_environment
126
+ env_var = 'NEW_RELIC_TOTORO'
127
+ setting = env_var.gsub(/NEW_RELIC_|NEWRELIC_/,'').downcase
128
+
129
+ running_agent_writes_to_log({}, "#{env_var} does not have a corresponding configuration setting (#{setting} does not exist).") do
130
+ ENV[env_var] = 'Ponyo'
131
+ NewRelic::Agent::Configuration::EnvironmentSource.new
132
+ ENV.delete(env_var)
133
+ end
134
+ end
135
+
119
136
  def test_logs_forking_workers
120
137
  running_agent_writes_to_log(
121
138
  { :dispatcher => :passenger },
@@ -43,7 +43,7 @@ class RumAutoTest < MiniTest::Unit::TestCase
43
43
  assert(last_response.body.include?('<html><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script><body>'))
44
44
  end
45
45
 
46
- def test_autoinstrumentation_with_X_UA_Compatible_puts_header_at_end_of_head
46
+ def test_autoinstrumentation_with_X_UA_Compatible_puts_header_after_meta_tag
47
47
  @inner_app.response = '<html><head><meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" /></head><body><p>Hello World</p></body></html>'
48
48
  get '/'
49
49
  assert(last_response.body.include?(
@@ -51,13 +51,6 @@ class RumAutoTest < MiniTest::Unit::TestCase
51
51
  ))
52
52
  end
53
53
 
54
- # regression
55
- def test_autoinstrumentation_fails_gracefully_with_X_UA_Compatible_and_no_close_head_tag_puts_header_before_body_tag
56
- @inner_app.response = '<html><head><meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" /><body><p>Hello World</p></body></html>'
57
- get '/'
58
- assert(!last_response.body.include?(%'NREUMQ'))
59
- end
60
-
61
54
  def test_autoinstrumentation_doesnt_run_for_crazy_shit_like_this
62
55
  @inner_app.response = '<html><head <body </body>'
63
56
  get '/'
@@ -15,7 +15,7 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
15
15
 
16
16
  setup_and_teardown_agent(:'thread_profiler.enabled' => true, :force_send => true) do |collector|
17
17
  collector.stub('connect', {"agent_run_id" => 666 })
18
- collector.stub('get_agent_commands', START_COMMAND)
18
+ collector.stub('get_agent_commands', [])
19
19
  collector.stub('agent_command_results', [])
20
20
  end
21
21
 
@@ -37,7 +37,7 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
37
37
  "arguments" => {
38
38
  "profile_id" => -1,
39
39
  "sample_period" => 0.01,
40
- "duration" => 0.5,
40
+ "duration" => 0.75,
41
41
  "only_runnable_threads" => false,
42
42
  "only_request_threads" => false,
43
43
  "profile_agent_code" => true
@@ -60,7 +60,7 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
60
60
  # go only let a few cycles through, so we check less than 10
61
61
 
62
62
  def test_thread_profiling
63
- agent.send(:check_for_agent_commands)
63
+ issue_command(START_COMMAND)
64
64
 
65
65
  run_thread { NewRelic::Agent::Transaction.start(:controller, :request => stub) }
66
66
  run_thread { NewRelic::Agent::Transaction.start(:task) }
@@ -78,10 +78,8 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
78
78
  end
79
79
 
80
80
  def test_thread_profiling_can_stop
81
- agent.send(:check_for_agent_commands)
82
-
83
- $collector.mock['get_agent_commands'] = [200, {'return_value' => STOP_COMMAND}]
84
- agent.send(:check_for_agent_commands)
81
+ issue_command(START_COMMAND)
82
+ issue_command(STOP_COMMAND)
85
83
 
86
84
  let_it_finish
87
85
 
@@ -90,6 +88,11 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
90
88
  assert(profile_data.poll_count < 50, "Expected poll_count < 50, but was #{profile_data.poll_count}")
91
89
  end
92
90
 
91
+ def issue_command(cmd)
92
+ $collector.stub('get_agent_commands', cmd)
93
+ agent.send(:handle_agent_commands)
94
+ end
95
+
93
96
  # Runs a thread we expect to span entire test and be killed at the end
94
97
  def run_thread
95
98
  Thread.new do
@@ -79,6 +79,17 @@ class CurbTest < MiniTest::Unit::TestCase
79
79
  "Found some header lines appearing multiple times in header_str:\n#{header_str}")
80
80
  end
81
81
 
82
+ def test_get_via_multi_preserves_header_str
83
+ header_str = nil
84
+
85
+ Curl::Multi.get( [default_url] ) do |easy|
86
+ header_str = easy.header_str
87
+ end
88
+
89
+ assert_match(/^HTTP\/1\.1 200 OK\s+$/, header_str)
90
+ assert_match(/^Content-Length: \d+\s+$/, header_str)
91
+ end
92
+
82
93
  def test_get_doesnt_destroy_ability_to_call_status
83
94
  status_code = Curl.get( default_url ).status.to_i
84
95
  assert_equal(200, status_code)
@@ -94,7 +105,7 @@ class CurbTest < MiniTest::Unit::TestCase
94
105
  # def self.head_response
95
106
  # Curl.head( default_url )
96
107
  # end
97
- #
108
+ #
98
109
  # test_head
99
110
  # end
100
111
 
@@ -158,11 +169,14 @@ class CurbTest < MiniTest::Unit::TestCase
158
169
  "Curb"
159
170
  end
160
171
 
161
- def get_response(url=nil)
172
+ def get_response(url=nil, headers=nil)
162
173
  if @get_response_proc
163
174
  @get_response_proc.call(url)
164
175
  else
165
- Curl::Easy.http_get( url || default_url )
176
+ easy = Curl::Easy.new( url || default_url )
177
+ easy.headers = headers unless headers.nil?
178
+ easy.http_get
179
+ easy
166
180
  end
167
181
  end
168
182
 
@@ -2,7 +2,7 @@ suite_condition("Excon not supported in 1.8.6") do
2
2
  RUBY_VERSION != '1.8.6'
3
3
  end
4
4
 
5
- excon_versions = %w(0.24.0 0.19.0 0.18.0 0.10.0)
5
+ excon_versions = %w(0.25.0 0.24.0 0.19.0 0.18.0 0.10.0)
6
6
 
7
7
  excon_versions.each do |excon_version|
8
8
  gemfile <<-RB
@@ -16,8 +16,8 @@ class ExconTest < MiniTest::Unit::TestCase
16
16
  "Excon"
17
17
  end
18
18
 
19
- def get_response(url=nil)
20
- Excon.get(url || default_url)
19
+ def get_response(url=nil, headers=nil)
20
+ Excon.get(url || default_url, :headers => (headers || {}))
21
21
  end
22
22
 
23
23
  def get_response_multi(url, n)
@@ -44,6 +44,22 @@ class ExconTest < MiniTest::Unit::TestCase
44
44
  NewRelic::Agent::HTTPClients::ExconHTTPResponse.new(Excon::Response.new(:headers => headers))
45
45
  end
46
46
 
47
+ def test_still_records_tt_node_when_request_fails_with_idempotent_set
48
+ target_url = "#{default_url}/idempotent_test"
49
+
50
+ in_transaction do
51
+ conn = Excon.new("#{target_url}?status=404")
52
+ assert_raises(Excon::Errors::NotFound) do
53
+ conn.get(:expects => 200, :idempotent => true)
54
+ end
55
+ end
56
+
57
+ tt = NewRelic::Agent.agent.transaction_sampler.last_sample
58
+ segment = tt.root_segment.called_segments.first
59
+ assert_equal("External/localhost/Excon/GET", segment.metric_name)
60
+ assert_equal(target_url, segment.params[:uri])
61
+ end
62
+
47
63
  def test_still_records_tt_node_when_request_expects_different_response_code
48
64
  in_transaction do
49
65
  conn = Excon.new("#{default_url}?status=500")
@@ -16,8 +16,8 @@ class HTTPClientTest < MiniTest::Unit::TestCase
16
16
  "HTTPClient"
17
17
  end
18
18
 
19
- def get_response(url=nil)
20
- HTTPClient.get(url || default_url)
19
+ def get_response(url=nil, headers=nil)
20
+ HTTPClient.get(url || default_url, :header => headers)
21
21
  end
22
22
 
23
23
  def head_response
@@ -20,12 +20,12 @@ class NetHttpTest < MiniTest::Unit::TestCase
20
20
  "Net::HTTP"
21
21
  end
22
22
 
23
- def get_response(url=nil)
23
+ def get_response(url=nil, headers={})
24
24
  uri = default_uri
25
25
  uri = URI.parse(url) unless url.nil?
26
26
  path = uri.path.empty? ? '/' : uri.path
27
27
 
28
- start(uri) { |http| http.get(path) }
28
+ start(uri) { |http| http.get(path, headers) }
29
29
  end
30
30
 
31
31
  def get_response_multi(url, n)