newrelic_rpm 3.6.4.113.beta → 3.6.4.122

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -13,6 +13,14 @@
13
13
 
14
14
  More details: https://newrelic.com/docs/ruby/ruby-agent-configuration
15
15
 
16
+ * Fix a race condition affecting some Rails applications at startup
17
+
18
+ Some Rails applications using newrelic_rpm were affected by a race condition
19
+ at startup that manifested as an error when model classes with associations
20
+ were first loaded. The cause of these errors has been addressed by moving the
21
+ generation of the agent's EnvironmentReport on startup from a background
22
+ thread to the main thread.
23
+
16
24
  ## 3.6.3 ##
17
25
 
18
26
  * Better Sinatra Support
@@ -148,7 +148,7 @@ module NewRelic
148
148
 
149
149
  :marshaller => Proc.new { NewRelic::Agent::NewRelicService::JsonMarshaller.is_supported? ? 'json' : 'pruby' },
150
150
 
151
- :'request_sampler.enabled' => true,
151
+ :'request_sampler.enabled' => false,
152
152
  :'request_sampler.sample_rate_ms' => 50
153
153
  ].freeze
154
154
  end
@@ -7,7 +7,7 @@ require 'new_relic/helper'
7
7
  # This class encapsulates an error that was noticed by New Relic in a managed app.
8
8
  class NewRelic::NoticedError
9
9
  extend NewRelic::CollectionHelper
10
- attr_accessor :path, :timestamp, :params, :exception_class, :message
10
+ attr_accessor :path, :timestamp, :params, :exception_class_name, :exception_class_constant, :message
11
11
  attr_reader :exception_id
12
12
 
13
13
  STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE = "Message removed by New Relic 'strip_exception_messages' setting"
@@ -17,7 +17,8 @@ class NewRelic::NoticedError
17
17
  @path = path
18
18
  @params = NewRelic::NoticedError.normalize_params(data)
19
19
 
20
- @exception_class = exception.class
20
+ @exception_class_name = exception.is_a?(Exception) ? exception.class.name : 'Error'
21
+ @exception_class_constant = exception.class
21
22
 
22
23
  if exception.respond_to?('original_exception')
23
24
  @message = exception.original_exception.message.to_s
@@ -45,9 +46,16 @@ class NewRelic::NoticedError
45
46
  @timestamp = timestamp
46
47
  end
47
48
 
49
+ # @exception_class has been deprecated in favor of the more descriptive
50
+ # @exception_class_name.
51
+ # @deprecated
52
+ def exception_class
53
+ exception_class_name
54
+ end
55
+
48
56
  def whitelisted?
49
57
  NewRelic::Agent.config.stripped_exceptions_whitelist.find do |klass|
50
- exception_class <= klass
58
+ exception_class_constant <= klass
51
59
  end
52
60
  end
53
61
 
@@ -61,19 +69,11 @@ class NewRelic::NoticedError
61
69
 
62
70
  include NewRelic::Coerce
63
71
 
64
- def exception_name_for_collector
65
- if exception_class < Exception
66
- exception_class.name
67
- else
68
- 'Error'
69
- end
70
- end
71
-
72
72
  def to_collector_array(encoder=nil)
73
73
  [ NewRelic::Helper.time_to_millis(timestamp),
74
74
  string(path),
75
75
  string(message),
76
- string(exception_name_for_collector),
76
+ string(exception_class_name),
77
77
  params ]
78
78
  end
79
79
  end
@@ -7,7 +7,7 @@ module Multiverse
7
7
  # bundler
8
8
  class Envfile
9
9
  attr_accessor :file_path, :condition, :newrelic_gemfile_options
10
- attr_reader :before, :after, :mode, :skip_message
10
+ attr_reader :before, :after, :mode, :skip_message, :omit_mocha
11
11
 
12
12
  def initialize(file_path)
13
13
  self.file_path = file_path
@@ -32,11 +32,14 @@ module Multiverse
32
32
  @newrelic_gemfile_options = options_string
33
33
  end
34
34
 
35
-
36
35
  def gemfile(content)
37
36
  @gemfiles.push content
38
37
  end
39
38
 
39
+ def omit_mocha!
40
+ @omit_mocha = true
41
+ end
42
+
40
43
  def before_suite(&block)
41
44
  @before = block
42
45
  end
@@ -56,6 +56,16 @@ module Multiverse
56
56
  raise "bundle command failed with (#{$?})" unless $? == 0
57
57
  puts bundler_out if verbose?
58
58
  Bundler.require
59
+
60
+ # Ensure mocha is loaded after the test framework by deferring until here
61
+ # see: http://gofreerange.com/mocha/docs/
62
+ unless environments.omit_mocha
63
+ if RUBY_VERSION > '1.8.7'
64
+ require 'mocha/setup'
65
+ else
66
+ require 'mocha'
67
+ end
68
+ end
59
69
  end
60
70
 
61
71
  def generate_gemfile(gemfile_text, local = true)
@@ -67,8 +77,10 @@ module Multiverse
67
77
  if RUBY_VERSION > '1.8.7'
68
78
  f.puts " gem 'test-unit', :require => 'test/unit'"
69
79
  f.puts " gem 'debugger'" if include_debugger
80
+ f.puts " gem 'mocha', '~> 0.13.0', :require => false" unless environments.omit_mocha
70
81
  else
71
82
  f.puts " gem 'ruby-debug'" if include_debugger
83
+ f.puts " gem 'mocha', '~> 0.9.8', :require => false" unless environments.omit_mocha
72
84
  end
73
85
  end
74
86
  puts yellow("Gemfile set to:") if verbose?
@@ -1,9 +1,4 @@
1
1
  gemfile <<-RB
2
2
  gem 'rack'
3
3
  gem 'rack-test'
4
- if RUBY_VERSION >= '1.9.0'
5
- gem 'mocha', '~> 0.13.0'
6
- else
7
- gem 'mocha', '< 0.13'
8
- end
9
4
  RB
@@ -6,7 +6,6 @@
6
6
 
7
7
  require 'newrelic_rpm'
8
8
  require 'fake_collector'
9
- require 'mocha'
10
9
 
11
10
  class AuditLogTest < Test::Unit::TestCase
12
11
  # Initialization
@@ -9,7 +9,6 @@
9
9
  require 'logger'
10
10
  require 'newrelic_rpm'
11
11
  require 'fake_collector'
12
- require 'mocha'
13
12
 
14
13
  class LoggingTest < Test::Unit::TestCase
15
14
 
@@ -5,11 +5,5 @@ end
5
5
  gemfile <<-RB
6
6
  gem 'datamapper'
7
7
  gem 'dm-sqlite-adapter'
8
-
9
- if RUBY_VERSION >= '1.9.0'
10
- gem 'mocha', '~> 0.13.0', :require => 'mocha/setup'
11
- else
12
- gem 'mocha', '< 0.13'
13
- end
14
8
  RB
15
9
 
@@ -9,6 +9,8 @@ if RUBY_VERSION >= '1.9.3'
9
9
  RB
10
10
  end
11
11
 
12
+ omit_mocha!
13
+
12
14
  gemfile <<-RB
13
15
  gem 'rails', '~>3.2.0'
14
16
  gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
@@ -44,14 +44,6 @@ class RequestStatsTest < ActionController::TestCase
44
44
  # Tests
45
45
  #
46
46
 
47
- def test_is_enabled_by_default
48
- 200.times { get :stats_action }
49
-
50
- NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
51
-
52
- assert_equal 1, $collector.calls_for('analytic_event_data').length
53
- end
54
-
55
47
  def test_doesnt_send_when_disabled
56
48
  with_config( :'request_sampler.enabled' => false ) do
57
49
  200.times { get :stats_action }
@@ -5,17 +5,14 @@ end
5
5
  gemfile <<-RB
6
6
  gem 'sinatra', '~> 1.4.0'
7
7
  gem 'rack-test', :require => 'rack/test'
8
- gem 'mocha'
9
8
  RB
10
9
 
11
10
  gemfile <<-RB
12
11
  gem 'sinatra', '~> 1.3.0'
13
12
  gem 'rack-test', :require => 'rack/test'
14
- gem 'mocha'
15
13
  RB
16
14
 
17
15
  gemfile <<-RB
18
16
  gem 'sinatra', '~> 1.2.0'
19
17
  gem 'rack-test', :require => 'rack/test'
20
- gem 'mocha'
21
18
  RB
@@ -2,7 +2,6 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
- require 'mocha'
6
5
  require 'sinatra'
7
6
  require File.expand_path(File.join(File.dirname(__FILE__), 'sinatra_test_cases'))
8
7
  require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper'))
@@ -2,7 +2,6 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
- require 'mocha'
6
5
  require File.expand_path(File.join(File.dirname(__FILE__), 'sinatra_test_cases'))
7
6
  require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper'))
8
7
 
@@ -36,8 +36,8 @@ class NewRelic::Agent::ErrorCollectorTest < Test::Unit::TestCase
36
36
  assert_equal '', err.params[:request_uri]
37
37
  assert_equal '', err.params[:request_referer]
38
38
  assert_equal 'path', err.path
39
- assert_equal 'Error', err.exception_name_for_collector
40
- assert_equal String, err.exception_class
39
+ assert_equal 'Error', err.exception_class_name
40
+ assert_equal String, err.exception_class_constant
41
41
  end
42
42
 
43
43
  def test_simple
@@ -54,8 +54,8 @@ class NewRelic::Agent::ErrorCollectorTest < Test::Unit::TestCase
54
54
  assert_equal '/myurl/', err.params[:request_uri]
55
55
  assert_equal 'test_referer', err.params[:request_referer]
56
56
  assert_equal 'path', err.path
57
- assert_equal StandardError, err.exception_class
58
- assert_equal 'StandardError', err.exception_name_for_collector
57
+ assert_equal StandardError, err.exception_class_constant
58
+ assert_equal 'StandardError', err.exception_class_name
59
59
 
60
60
  # the collector should now return an empty array since nothing
61
61
  # has been added since its last harvest
@@ -102,17 +102,4 @@ class NewRelic::Agent::NoticedErrorTest < Test::Unit::TestCase
102
102
  assert_truthy error.whitelisted?
103
103
  end
104
104
  end
105
-
106
- def test_exception_name_for_collector_returns_error_for_non_exceptions
107
- error = NewRelic::NoticedError.new(@path, @params, nil, @time)
108
-
109
- assert_equal 'Error', error.exception_name_for_collector
110
- end
111
-
112
- def test_exception_name_for_collector_returns_class_name_for_exceptions
113
- e = NoticedErrorTestException.new('test exception')
114
- error = NewRelic::NoticedError.new(@path, @params, e, @time)
115
-
116
- assert_equal 'NoticedErrorTestException', error.exception_name_for_collector
117
- end
118
105
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.4.113.beta
5
- prerelease: 10
4
+ version: 3.6.4.122
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jason Clark
@@ -41,7 +41,7 @@ cert_chain:
41
41
  cHUySWFQWE92bTNUOEc0TzZxWnZobkxoL1VpZW4rK0RqOGVGQmVjVFBvTThw
42
42
  VmpLM3BoNQpuL0V3dVpDY0U2Z2h0Q0NNCi0tLS0tRU5EIENFUlRJRklDQVRF
43
43
  LS0tLS0K
44
- date: 2013-06-12 00:00:00.000000000 Z
44
+ date: 2013-06-14 00:00:00.000000000 Z
45
45
  dependencies: []
46
46
  description: ! 'New Relic is a performance management system, developed by New Relic,
47
47
 
@@ -536,7 +536,12 @@ post_install_message: ! "# New Relic Ruby Agent Release Notes #\n\n## v3.6.4 ##\
536
536
  running in\n high security mode. Enabling 'high_security' now removes exception
537
537
  messages\n entirely rather than simply obfuscating any SQL.\n\n By default this
538
538
  feature affects all exceptions, though you can configure a\n whitelist of exceptions
539
- whose messages should be left intact.\n\n More details: https://newrelic.com/docs/ruby/ruby-agent-configuration\n\n##
539
+ whose messages should be left intact.\n\n More details: https://newrelic.com/docs/ruby/ruby-agent-configuration\n\n*
540
+ Fix a race condition affecting some Rails applications at startup\n\n Some Rails
541
+ applications using newrelic_rpm were affected by a race condition\n at startup
542
+ that manifested as an error when model classes with associations\n were first loaded.
543
+ The cause of these errors has been addressed by moving the\n generation of the
544
+ agent's EnvironmentReport on startup from a background\n thread to the main thread.\n\n##
540
545
  3.6.3 ##\n\n* Better Sinatra Support\n\n A number of improvements have been made
541
546
  to our Sinatra instrumentation.\n More details: https://newrelic.com/docs/ruby/sinatra-support-in-the-ruby-agent\n\n
542
547
  \ Sinatra instrumentation has been updated to more accurately reflect the final\n
metadata.gz.sig CHANGED
Binary file