newrelic_rpm 3.6.8.168 → 3.6.9.171

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gitignore +1 -0
  3. data/.yardopts +17 -0
  4. data/CHANGELOG +48 -0
  5. data/README.md +8 -6
  6. data/lib/new_relic/agent.rb +65 -17
  7. data/lib/new_relic/agent/agent.rb +42 -113
  8. data/lib/new_relic/agent/browser_monitoring.rb +9 -1
  9. data/lib/new_relic/agent/configuration/default_source.rb +12 -0
  10. data/lib/new_relic/agent/error_collector.rb +13 -6
  11. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -5
  12. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +15 -0
  13. data/lib/new_relic/agent/instrumentation/curb.rb +2 -2
  14. data/lib/new_relic/agent/instrumentation/metric_frame.rb +2 -2
  15. data/lib/new_relic/agent/instrumentation/rack.rb +2 -0
  16. data/lib/new_relic/agent/instrumentation/resque.rb +9 -3
  17. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -0
  18. data/lib/new_relic/agent/method_tracer.rb +45 -27
  19. data/lib/new_relic/agent/new_relic_service.rb +14 -6
  20. data/lib/new_relic/agent/pipe_service.rb +1 -1
  21. data/lib/new_relic/agent/request_sampler.rb +10 -7
  22. data/lib/new_relic/agent/rules_engine.rb +5 -0
  23. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  24. data/lib/new_relic/agent/sql_sampler.rb +4 -2
  25. data/lib/new_relic/agent/stats_engine.rb +3 -0
  26. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +17 -7
  27. data/lib/new_relic/agent/stats_engine/metric_stats.rb +5 -7
  28. data/lib/new_relic/agent/stats_engine/stats_hash.rb +2 -0
  29. data/lib/new_relic/agent/supported_versions.rb +247 -0
  30. data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
  31. data/lib/new_relic/agent/threading/thread_profile.rb +2 -1
  32. data/lib/new_relic/agent/transaction.rb +7 -6
  33. data/lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb +11 -5
  34. data/lib/new_relic/agent/transaction/force_persist_sample_buffer.rb +3 -3
  35. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +3 -3
  36. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +23 -4
  37. data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +4 -4
  38. data/lib/new_relic/agent/transaction_sampler.rb +14 -18
  39. data/lib/new_relic/agent/worker_loop.rb +1 -0
  40. data/lib/new_relic/control.rb +1 -0
  41. data/lib/new_relic/control/instance_methods.rb +0 -1
  42. data/lib/new_relic/helper.rb +1 -2
  43. data/lib/new_relic/language_support.rb +12 -2
  44. data/lib/new_relic/local_environment.rb +12 -11
  45. data/lib/new_relic/rack.rb +9 -0
  46. data/lib/new_relic/rack/agent_hooks.rb +6 -0
  47. data/lib/new_relic/rack/browser_monitoring.rb +9 -2
  48. data/lib/new_relic/rack/developer_mode.rb +15 -1
  49. data/lib/new_relic/rack/error_collector.rb +7 -0
  50. data/lib/new_relic/recipes.rb +2 -0
  51. data/lib/new_relic/transaction_sample.rb +39 -48
  52. data/lib/new_relic/version.rb +1 -1
  53. data/lib/tasks/install.rake +44 -2
  54. data/lib/tasks/versions.html.erb +31 -0
  55. data/lib/tasks/versions.rake +52 -0
  56. data/lib/tasks/versions.txt.erb +14 -0
  57. data/newrelic_rpm.gemspec +4 -2
  58. data/test/agent_helper.rb +21 -1
  59. data/test/environments/lib/environments/runner.rb +19 -5
  60. data/test/environments/norails/Gemfile +4 -1
  61. data/test/environments/rails21/Gemfile +4 -6
  62. data/test/environments/rails21/Rakefile +4 -0
  63. data/test/environments/rails21/config/database.yml +2 -7
  64. data/test/environments/rails22/Gemfile +6 -13
  65. data/test/environments/rails22/Rakefile +4 -0
  66. data/test/environments/rails22/config/database.yml +2 -7
  67. data/test/environments/rails22/config/environment.rb +1 -1
  68. data/test/environments/rails23/Gemfile +3 -4
  69. data/test/environments/rails23/Rakefile +4 -0
  70. data/test/environments/rails23/config/database.yml +2 -7
  71. data/test/environments/rails30/Gemfile +2 -4
  72. data/test/environments/rails30/Rakefile +2 -0
  73. data/test/environments/rails30/config/database.yml +2 -7
  74. data/test/environments/rails31/Gemfile +2 -4
  75. data/test/environments/rails31/Rakefile +2 -0
  76. data/test/environments/rails31/config/database.yml +2 -7
  77. data/test/environments/rails32/Gemfile +2 -5
  78. data/test/environments/rails32/Rakefile +2 -0
  79. data/test/environments/rails32/config/database.yml +1 -1
  80. data/test/environments/rails40/Gemfile +7 -4
  81. data/test/environments/rails40/Rakefile +2 -0
  82. data/test/environments/rails40/config/database.yml +2 -7
  83. data/test/helpers/runtime_detection.rb +17 -0
  84. data/test/multiverse/lib/multiverse/suite.rb +20 -4
  85. data/test/multiverse/suites/agent_only/key_transactions_test.rb +1 -1
  86. data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -1
  87. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +32 -7
  88. data/test/multiverse/suites/agent_only/xray_sessions_test.rb +1 -0
  89. data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +4 -3
  90. data/test/multiverse/suites/curb/curb_test.rb +8 -0
  91. data/test/multiverse/suites/excon/excon_test.rb +8 -0
  92. data/test/multiverse/suites/httpclient/httpclient_test.rb +8 -0
  93. data/test/multiverse/suites/net_http/net_http_test.rb +8 -0
  94. data/test/multiverse/suites/padrino/Envfile +3 -2
  95. data/test/multiverse/suites/rails/gc_instrumentation_test.rb +17 -8
  96. data/test/multiverse/suites/resque/Envfile +3 -3
  97. data/test/multiverse/suites/resque/instrumentation_test.rb +47 -5
  98. data/test/multiverse/suites/sequel/Envfile +0 -3
  99. data/test/multiverse/suites/sequel/database.rb +53 -0
  100. data/test/{new_relic/agent/instrumentation/sequel_test.rb → multiverse/suites/sequel/sequel_instrumentation_test.rb} +12 -53
  101. data/test/multiverse/suites/sequel/{sequel_test.rb → sequel_safety_test.rb} +2 -17
  102. data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +50 -5
  103. data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +15 -2
  104. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +8 -0
  105. data/test/new_relic/agent/agent/connect_test.rb +3 -2
  106. data/test/new_relic/agent/agent_test.rb +89 -82
  107. data/test/new_relic/agent/browser_monitoring_test.rb +44 -1
  108. data/test/new_relic/agent/error_collector_test.rb +17 -20
  109. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +13 -10
  110. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +16 -1
  111. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +2 -2
  112. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +1 -1
  113. data/test/new_relic/agent/new_relic_service_test.rb +78 -9
  114. data/test/new_relic/agent/pipe_channel_manager_test.rb +7 -9
  115. data/test/new_relic/agent/pipe_service_test.rb +4 -4
  116. data/test/new_relic/agent/request_sampler_test.rb +2 -2
  117. data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +15 -35
  118. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +15 -7
  119. data/test/new_relic/agent/stats_engine_test.rb +4 -3
  120. data/test/new_relic/agent/threading/backtrace_service_test.rb +2 -0
  121. data/test/new_relic/agent/threading/thread_profile_test.rb +19 -0
  122. data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +4 -4
  123. data/test/new_relic/agent/transaction/force_persist_sample_buffer_test.rb +1 -1
  124. data/test/new_relic/agent/transaction_sampler_test.rb +60 -45
  125. data/test/new_relic/fake_collector.rb +37 -2
  126. data/test/new_relic/http_client_test_cases.rb +26 -1
  127. data/test/new_relic/language_support_test.rb +12 -31
  128. data/test/new_relic/local_environment_test.rb +6 -2
  129. data/test/new_relic/multiverse_helpers.rb +2 -5
  130. data/test/new_relic/transaction_sample_test.rb +57 -36
  131. data/test/performance/suites/config.rb +76 -0
  132. data/test/rum/no_html_and_no_header.result.html +3 -0
  133. data/test/rum/no_html_and_no_header.source.html +3 -0
  134. data/test/script/ci.sh +0 -2
  135. data/test/test_helper.rb +5 -0
  136. metadata +43 -26
  137. metadata.gz.sig +0 -0
@@ -2,11 +2,12 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "test-unit"
4
4
 
5
- gem "rails", "~> 2.3.0"
5
+ gem "rails", "~> 2.3.18"
6
6
 
7
7
  gem "mocha", "0.9.8"
8
8
  gem 'rack'
9
9
  gem 'rack-test'
10
+ gem 'rdoc'
10
11
 
11
12
  gem "newrelic_rpm", :path => '../../..'
12
13
 
@@ -15,8 +16,6 @@ if(RUBY_PLATFORM == 'java')
15
16
  gem "activerecord-jdbcsqlite3-adapter", "~>1.2.9"
16
17
  gem "jruby-openssl"
17
18
  else
18
- gem "mysql", RUBY_VERSION == '1.8.6' ? '2.7' : '2.8.1'
19
+ gem "mysql", "~>2.9.1"
19
20
  gem "sqlite3-ruby", "1.2.5"
20
21
  end
21
-
22
- gem 'sequel', '~> 3.46.0' unless RUBY_VERSION == '1.8.6'
@@ -5,8 +5,12 @@ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
5
 
6
6
  require 'rake'
7
7
  require 'rake/testtask'
8
+ require 'rdoc/task'
8
9
 
9
10
  gem 'newrelic_rpm'
11
+
12
+ require 'tasks/rails'
10
13
  require 'tasks/all'
11
14
 
15
+ Rake::Task["default"].clear
12
16
  task :default => [:'test:newrelic']
@@ -1,13 +1,10 @@
1
- # Shared properties for mysql db
2
1
  mysql: &mysql
3
2
  adapter: mysql
4
3
  socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
4
  username: root
6
5
  host: localhost
7
- database: rails_blog
6
+ database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>
8
7
 
9
- # Shared properties for postgres. This won't work with our schema but
10
- # Does work with agent tests
11
8
  sqlite3: &sqlite3
12
9
  <% if defined?(JRuby) %>
13
10
  adapter: jdbcsqlite3
@@ -18,9 +15,7 @@ sqlite3: &sqlite3
18
15
  pool: 5
19
16
  timeout: 5000
20
17
  host: localhost
21
-
22
- # SQLite version 3.x
23
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
18
+
24
19
  development:
25
20
  <<: *sqlite3
26
21
 
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'test-unit'
4
- gem 'rails', '~>3.0.0'
4
+ gem 'rails', '~>3.0.20'
5
5
  gem 'newrelic_rpm', :path => '../../..'
6
6
  gem "mocha"
7
7
  gem 'rack'
@@ -12,8 +12,6 @@ if (RUBY_PLATFORM == 'java')
12
12
  gem "activerecord-jdbcsqlite3-adapter", '1.2.5'
13
13
  gem "jruby-openssl"
14
14
  else
15
- gem "mysql"
15
+ gem "mysql", "~>2.9.1"
16
16
  gem "sqlite3-ruby"
17
17
  end
18
-
19
- gem 'sequel', '~> 3.46.0'
@@ -4,6 +4,8 @@
4
4
  require File.expand_path('../config/application', __FILE__)
5
5
  require 'rake'
6
6
 
7
+ RpmTestApp::Application.load_tasks
7
8
  require 'tasks/all'
8
9
 
10
+ Rake::Task["default"].clear
9
11
  task :default => [:'test:newrelic']
@@ -1,13 +1,10 @@
1
- # Shared properties for mysql db
2
1
  mysql: &mysql
3
2
  adapter: mysql
4
3
  socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
4
  username: root
6
5
  host: localhost
7
- database: rails_blog
6
+ database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>
8
7
 
9
- # Shared properties for postgres. This won't work with our schema but
10
- # Does work with agent tests
11
8
  sqlite3: &sqlite3
12
9
  <% if defined?(JRuby) %>
13
10
  adapter: jdbcsqlite3
@@ -18,9 +15,7 @@ sqlite3: &sqlite3
18
15
  pool: 5
19
16
  timeout: 5000
20
17
  host: localhost
21
-
22
- # SQLite version 3.x
23
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
18
+
24
19
  development:
25
20
  <<: *sqlite3
26
21
 
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'test-unit'
4
- gem 'rails', '~>3.1.0'
4
+ gem 'rails', '~>3.1.12'
5
5
  gem 'newrelic_rpm', :path => '../../..'
6
6
  gem "mocha"
7
7
  gem 'rack'
@@ -12,8 +12,6 @@ if (RUBY_PLATFORM == 'java')
12
12
  gem "activerecord-jdbcsqlite3-adapter", "~>1.2.9"
13
13
  gem "jruby-openssl"
14
14
  else
15
- gem "mysql"
15
+ gem "mysql", "~>2.9.1"
16
16
  gem "sqlite3-ruby"
17
17
  end
18
-
19
- gem 'sequel', '~> 3.46.0'
@@ -4,6 +4,8 @@
4
4
  require File.expand_path('../config/application', __FILE__)
5
5
  require 'rake'
6
6
 
7
+ RpmTestApp::Application.load_tasks
7
8
  require 'tasks/all'
8
9
 
10
+ Rake::Task["default"].clear
9
11
  task :default => [:'test:newrelic']
@@ -1,13 +1,10 @@
1
- # Shared properties for mysql db
2
1
  mysql: &mysql
3
2
  adapter: mysql
4
3
  socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
4
  username: root
6
5
  host: localhost
7
- database: rails_blog
6
+ database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>
8
7
 
9
- # Shared properties for postgres. This won't work with our schema but
10
- # Does work with agent tests
11
8
  sqlite3: &sqlite3
12
9
  <% if defined?(JRuby) %>
13
10
  adapter: jdbcsqlite3
@@ -18,9 +15,7 @@ sqlite3: &sqlite3
18
15
  pool: 5
19
16
  timeout: 5000
20
17
  host: localhost
21
-
22
- # SQLite version 3.x
23
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
18
+
24
19
  development:
25
20
  <<: *sqlite3
26
21
 
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
 
5
- gem 'rails', '~>3.2.0'
5
+ gem 'rails', '~>3.2.15'
6
6
 
7
7
  gem "mocha", '~>0.13.0', :require => false
8
8
  gem 'rack'
@@ -15,11 +15,8 @@ platforms :jruby do
15
15
  end
16
16
 
17
17
  platforms :ruby, :rbx do
18
- gem "mysql"
19
- gem "sqlite3-ruby"
18
+ gem "mysql", "~>2.9.1"
20
19
  gem "sqlite3"
21
20
  end
22
21
 
23
- gem 'sequel', '~> 3.46.0'
24
-
25
22
  gem "newrelic_rpm", :path => "../../.."
@@ -4,6 +4,8 @@
4
4
  require File.expand_path('../config/application', __FILE__)
5
5
  require 'rake'
6
6
 
7
+ RpmTestApp::Application.load_tasks
7
8
  require 'tasks/all'
8
9
 
10
+ Rake::Task["default"].clear
9
11
  task :default => [:'test:newrelic']
@@ -4,7 +4,7 @@ mysql: &mysql
4
4
  socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
5
  username: root
6
6
  host: localhost
7
- database: rails_blog
7
+ database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>
8
8
 
9
9
  # Shared properties for postgres. This won't work with our schema but
10
10
  # Does work with agent tests
@@ -2,15 +2,15 @@ source 'http://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
 
5
- gem 'rails', '~>4.0.0.rc2'
5
+ gem 'rails', '~>4.0.0'
6
6
 
7
7
  gem "mocha", '~>0.13.0', :require => false
8
8
  gem 'rack'
9
9
  gem 'rack-test'
10
10
 
11
11
  platforms :jruby do
12
- gem "activerecord-jdbcmysql-adapter"
13
- gem "activerecord-jdbcsqlite3-adapter"
12
+ gem "activerecord-jdbcmysql-adapter", "~>1.3.0"
13
+ gem "activerecord-jdbcsqlite3-adapter", "~>1.3.0"
14
14
  gem "jruby-openssl"
15
15
  end
16
16
 
@@ -20,6 +20,9 @@ platforms :mri_19, :mri_20, :rbx do
20
20
  gem "sqlite3"
21
21
  end
22
22
 
23
- gem 'sequel', '~> 3.46.0'
23
+ platforms :rbx do
24
+ gem "rubysl"
25
+ gem "racc" # https://github.com/rubinius/rubinius/issues/2632
26
+ end
24
27
 
25
28
  gem "newrelic_rpm", :path => "../../.."
@@ -4,6 +4,8 @@
4
4
  require File.expand_path('../config/application', __FILE__)
5
5
  require 'rake'
6
6
 
7
+ RpmTestApp::Application.load_tasks
7
8
  require 'tasks/all'
8
9
 
10
+ Rake::Task["default"].clear
9
11
  task :default => [:'test:newrelic']
@@ -1,13 +1,10 @@
1
- # Shared properties for mysql db
2
1
  mysql: &mysql
3
2
  adapter: mysql
4
3
  socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
5
4
  username: root
6
5
  host: localhost
7
- database: rails_blog
6
+ database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>
8
7
 
9
- # Shared properties for postgres. This won't work with our schema but
10
- # Does work with agent tests
11
8
  sqlite3: &sqlite3
12
9
  <% if defined?(JRuby) %>
13
10
  adapter: jdbcsqlite3
@@ -18,9 +15,7 @@ sqlite3: &sqlite3
18
15
  pool: 5
19
16
  timeout: 5000
20
17
  host: localhost
21
-
22
- # SQLite version 3.x
23
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
18
+
24
19
  development:
25
20
  <<: *sqlite3
26
21
 
@@ -0,0 +1,17 @@
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
+ module NewRelic
6
+ module TestHelpers
7
+ module RuntimeDetection
8
+ def rubinius?
9
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
10
+ end
11
+
12
+ def jruby?
13
+ defined?(JRuby)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -73,6 +73,8 @@ module Multiverse
73
73
  f.puts jruby_openssl_line unless gemfile_text =~ /^\s*gem .jruby-openssl./
74
74
  f.puts minitest_line unless gemfile_text =~ /^\s*gem .minitest[^_]./
75
75
 
76
+ rbx_gemfile_lines(f, gemfile_text)
77
+
76
78
  # We currently pin usage of mocha at the 0.9.x line for compatibility
77
79
  # 0.10.x had issues with the integration handlers and MiniTest on old Rubies
78
80
  # 0.11.x introduced syntax that breaks 1.8.6 entirely :(
@@ -81,10 +83,13 @@ module Multiverse
81
83
  # resolved in some fashion at that point
82
84
  f.puts " gem 'mocha', '~> 0.9.8', :require => false" unless environments.omit_mocha
83
85
 
84
- if RUBY_VERSION > '1.8.7'
85
- f.puts " gem 'debugger'" if include_debugger
86
- else
87
- f.puts " gem 'ruby-debug'" if include_debugger
86
+ # Need to get Rubinius' debugger wired in, but MRI's doesn't work
87
+ if include_debugger
88
+ if RUBY_VERSION > '1.8.7'
89
+ f.puts " gem 'debugger', :platforms => [:mri]"
90
+ else
91
+ f.puts " gem 'ruby-debug', :platforms => [:mri]"
92
+ end
88
93
  end
89
94
  end
90
95
  puts yellow("Gemfile.#{env_index} set to:") if verbose?
@@ -98,6 +103,17 @@ module Multiverse
98
103
  line
99
104
  end
100
105
 
106
+ def rbx_gemfile_lines(f, gemfile_text)
107
+ return unless is_rbx?
108
+
109
+ f.puts "gem 'rubysl', :platforms => [:rbx]" unless gemfile_text =~ /^\s*gem .rubysl./
110
+ f.puts "gem 'racc', :platforms => [:rbx]" unless gemfile_text =~ /^\s*gem .racc./
111
+ end
112
+
113
+ def is_rbx?
114
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
115
+ end
116
+
101
117
  def jruby_openssl_line
102
118
  "gem 'jruby-openssl', :require => false, :platforms => [:jruby]"
103
119
  end
@@ -62,7 +62,7 @@ class KeyTransactionsTest < MiniTest::Unit::TestCase
62
62
  TestWidget.new.key_txn
63
63
  TestWidget.new.other_txn
64
64
 
65
- NewRelic::Agent.instance.send(:harvest_and_send_slowest_sample)
65
+ NewRelic::Agent.instance.send(:harvest_and_send_transaction_traces)
66
66
 
67
67
  traces = $collector.calls_for('transaction_sample_data')
68
68
  assert_equal 1, traces.size
@@ -31,7 +31,7 @@ class MarshalingTest < MiniTest::Unit::TestCase
31
31
  expected_sample = sampler.last_sample
32
32
 
33
33
  agent.service.connect
34
- agent.send(:harvest_and_send_slowest_sample)
34
+ agent.send(:harvest_and_send_transaction_traces)
35
35
 
36
36
  if NewRelic::Agent::NewRelicService::JsonMarshaller.is_supported?
37
37
  marshaller = NewRelic::Agent::NewRelicService::JsonMarshaller.new
@@ -77,11 +77,33 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
77
77
  assert_saw_traces(profile_data, "BACKGROUND")
78
78
  end
79
79
 
80
+ def test_thread_profiling_with_pruby_marshaller
81
+ with_config(:marshaller => 'pruby') do
82
+ issue_command(START_COMMAND)
83
+
84
+ run_thread { NewRelic::Agent::Transaction.start(:controller, :request => stub) }
85
+ run_thread { NewRelic::Agent::Transaction.start(:task) }
86
+
87
+ let_it_finish
88
+ end
89
+
90
+ profile_data = $collector.calls_for('profile_data')[0]
91
+ assert_equal('666', profile_data.run_id, "Missing run_id, profile_data was #{profile_data.inspect}")
92
+ assert(profile_data.sample_count > 10, "Expected sample_count > 10, but was #{profile_data.sample_count}")
93
+
94
+ assert_saw_traces(profile_data, "OTHER")
95
+ assert_saw_traces(profile_data, "AGENT")
96
+ assert_saw_traces(profile_data, "REQUEST")
97
+ assert_saw_traces(profile_data, "BACKGROUND")
98
+ end
99
+
80
100
  def test_thread_profiling_can_stop
81
101
  issue_command(START_COMMAND)
82
102
  issue_command(STOP_COMMAND)
83
103
 
84
- let_it_finish
104
+ # No wait needed, should be immediately ready to harvest
105
+ assert @thread_profiler_session.ready_to_harvest?
106
+ harvest
85
107
 
86
108
  profile_data = $collector.calls_for('profile_data')[0]
87
109
  assert_equal('666', profile_data.run_id, "Missing run_id, profile_data was #{profile_data.inspect}")
@@ -102,17 +124,20 @@ class ThreadProfilingTest < MiniTest::Unit::TestCase
102
124
  end
103
125
 
104
126
  def let_it_finish
105
- Timeout.timeout(5) do
106
- until @thread_profiler_session.ready_to_harvest?
107
- sleep(0.1)
108
- end
109
- end
127
+ wait_for_backtrace_service_poll(:timeout => 10.0, :iterations => 10)
128
+ harvest
129
+ end
110
130
 
131
+ def harvest
111
132
  agent.send(:transmit_data, true)
112
133
  end
113
134
 
114
135
  def assert_saw_traces(profile_data, type)
115
- assert !profile_data.traces[type].empty?, "Missing #{type} traces"
136
+ assert_kind_of Hash, profile_data.traces
137
+ traces_for_type = profile_data.traces[type]
138
+ assert traces_for_type, "Missing key for type #{type} in profile_data"
139
+ assert_kind_of Array, traces_for_type
140
+ assert !profile_data.traces[type].empty?, "Zero #{type} traces seen"
116
141
  end
117
142
 
118
143
  end
@@ -89,6 +89,7 @@ class XraySessionsTest < MiniTest::Unit::TestCase
89
89
  def test_gathers_thread_profiles
90
90
  session = build_xray_session('key_transaction_name' => 'Controller/Rack/A')
91
91
  with_xray_sessions(session) do
92
+ wait_for_backtrace_service_poll
92
93
  get '/?transaction_name=A&sleep=1'
93
94
  trigger_harvest
94
95
  end
@@ -33,13 +33,14 @@ class ConfigFileLoadingTest < MiniTest::Unit::TestCase
33
33
 
34
34
  # Figure out where multiverse is in the real file system.
35
35
  @cwd = Dir.pwd
36
+
37
+ # require the agent before we're in FakeFS so require doesn't hit the fake
38
+ require 'newrelic_rpm'
39
+
36
40
  # Use a fake file system so we don't damage the real one.
37
41
  FakeFS.activate!
38
42
  FakeFS::FileSystem.clear
39
43
 
40
- # require the agent after we're in FakeFS
41
- require 'newrelic_rpm'
42
-
43
44
  FileUtils.mkdir_p(@cwd)
44
45
  end
45
46