newrelic_rpm 3.7.2.190.beta → 3.7.2.192

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +48 -0
  3. data/LICENSE +1 -1
  4. data/lib/new_relic/agent/configuration/default_source.rb +0 -6
  5. data/lib/new_relic/agent/cross_app_monitor.rb +7 -6
  6. data/lib/new_relic/agent/datastores/mongo/metric_generator.rb +8 -0
  7. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +27 -36
  8. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +21 -11
  9. data/lib/new_relic/agent/instrumentation/mongo.rb +56 -40
  10. data/lib/new_relic/agent/method_tracer.rb +10 -3
  11. data/lib/new_relic/agent/transaction_sampler.rb +0 -3
  12. data/lib/sequel/extensions/newrelic_instrumentation.rb +12 -5
  13. data/test/helpers/mongo_metric_builder.rb +1 -1
  14. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +2 -2
  15. data/test/multiverse/suites/mongo/Envfile +19 -28
  16. data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +437 -0
  17. data/test/multiverse/suites/mongo/helpers/mongo_replica_set.rb +97 -0
  18. data/test/multiverse/suites/mongo/helpers/mongo_replica_set_test.rb +82 -0
  19. data/test/multiverse/suites/mongo/helpers/mongo_server.rb +239 -0
  20. data/test/multiverse/suites/mongo/helpers/mongo_server_test.rb +176 -0
  21. data/test/multiverse/suites/mongo/mongo_connection_test.rb +40 -0
  22. data/test/multiverse/suites/mongo/mongo_instrumentation_test.rb +8 -393
  23. data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +6 -4
  24. data/test/multiverse/suites/rails/ignore_test.rb +7 -2
  25. data/test/multiverse/suites/sequel/database.rb +24 -20
  26. data/test/multiverse/suites/sequel/sequel_instrumentation_test.rb +16 -0
  27. data/test/new_relic/agent/cross_app_monitor_test.rb +4 -2
  28. data/test/new_relic/agent/datastores/mongo/metric_generator_test.rb +27 -1
  29. data/test/new_relic/agent/datastores/mongo/metric_translator_test.rb +19 -9
  30. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +497 -493
  31. data/test/new_relic/agent/method_tracer_test.rb +23 -0
  32. data/test/new_relic/agent/transaction_sampler_test.rb +5 -16
  33. data/test/new_relic/json_wrapper_test.rb +5 -6
  34. data/test/performance/suites/trace_execution_scoped.rb +32 -0
  35. metadata +34 -26
  36. metadata.gz.sig +0 -0
@@ -110,6 +110,29 @@ class NewRelic::Agent::MethodTracerTest < MiniTest::Unit::TestCase
110
110
  assert_equal 1, stats.call_count
111
111
  end
112
112
 
113
+ def test_trace_execution_scoped_with_no_metrics_skips_out
114
+ self.class.trace_execution_scoped([]) do
115
+ advance_time 0.05
116
+ end
117
+
118
+ assert_empty @stats_engine.metrics
119
+ end
120
+
121
+ def test_trace_execution_scoped_records_metric_data_from_callback
122
+ metric = "hello"
123
+ callback_metric = "goodbye"
124
+ callback = Proc.new { callback_metric }
125
+ options = { :additional_metrics_callback => callback }
126
+
127
+ self.class.trace_execution_scoped(metric, options) do
128
+ advance_time 0.05
129
+ end
130
+
131
+ stats = @stats_engine.get_stats(callback_metric)
132
+ check_time 0.05, stats.total_call_time
133
+ assert_equal 1, stats.call_count
134
+ end
135
+
113
136
  def test_trace_execution_scoped_pushes_transaction_scope
114
137
  self.class.trace_execution_scoped('yeap') do
115
138
  'ptoo'
@@ -788,22 +788,11 @@ class NewRelic::Agent::TransactionSamplerTest < MiniTest::Unit::TestCase
788
788
  end
789
789
  end
790
790
 
791
- def test_build_database_statement_uses_override_obfuscation_adapter_if_connection_config_is_nil
792
- with_config(:override_sql_obfuscation_adapter => 'GumbyDB') do
793
- config = nil
794
- sql = "SELECT * FROM \"horses\" WHERE \"name\" = 'pokey'"
795
- statement = @sampler.build_database_statement(sql, config, Proc.new {})
796
- assert_equal 'GumbyDB', statement.adapter
797
- end
798
- end
799
-
800
- def test_build_database_statement_uses_override_obfuscation_adapter_if_connection_config_adapter_is_mysql
801
- with_config(:override_sql_obfuscation_adapter => 'GumbyDB') do
802
- config = {:adapter => 'mysql'}
803
- sql = "SELECT * FROM \"horses\" WHERE \"name\" = 'pokey'"
804
- statement = @sampler.build_database_statement(sql, config, nil)
805
- assert_equal 'GumbyDB', statement.adapter
806
- end
791
+ def test_build_database_statement_uses_adapter_from_connection_config
792
+ config = { :adapter => 'GumbyDB' }
793
+ sql = "SELECT * FROM \"horses\" WHERE \"name\" = 'pokey'"
794
+ statement = @sampler.build_database_statement(sql, config, Proc.new {})
795
+ assert_equal 'GumbyDB', statement.adapter
807
796
  end
808
797
 
809
798
  def test_harvest_prepare_samples
@@ -3,10 +3,9 @@
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'..','test_helper'))
6
- require 'test/unit'
7
6
  require 'newrelic_rpm'
8
7
 
9
- class JSONWrapperTest < Test::Unit::TestCase
8
+ class JSONWrapperTest < MiniTest::Unit::TestCase
10
9
  def test_json_roundtrip
11
10
  obj = [
12
11
  99, 'luftballons',
@@ -32,7 +31,7 @@ class JSONWrapperTest < Test::Unit::TestCase
32
31
  def test_normalize_string_returns_munged_copy_if_ascii_8bit
33
32
  string = (0..255).to_a.pack("C*")
34
33
  result = NewRelic::JSONWrapper.normalize_string(string)
35
- assert_not_same(string, result)
34
+ refute_same(string, result)
36
35
  assert_equal(Encoding.find('ISO-8859-1'), result.encoding)
37
36
  assert_equal(string, result.dup.force_encoding('ASCII-8BIT'))
38
37
  end
@@ -40,7 +39,7 @@ class JSONWrapperTest < Test::Unit::TestCase
40
39
  def test_normalize_string_returns_munged_copy_if_invalid_utf8
41
40
  string = (0..255).to_a.pack("C*").force_encoding('UTF-8')
42
41
  result = NewRelic::JSONWrapper.normalize_string(string)
43
- assert_not_same(result, string)
42
+ refute_same(result, string)
44
43
  assert_equal(Encoding.find('ISO-8859-1'), result.encoding)
45
44
  assert_equal(string, result.dup.force_encoding('UTF-8'))
46
45
  end
@@ -48,7 +47,7 @@ class JSONWrapperTest < Test::Unit::TestCase
48
47
  def test_normalize_string_returns_munged_copy_if_other_convertible_encoding
49
48
  string = "i want a pony".encode('UTF-16LE')
50
49
  result = NewRelic::JSONWrapper.normalize_string(string)
51
- assert_not_same(result, string)
50
+ refute_same(result, string)
52
51
  assert_equal(Encoding.find('UTF-8'), result.encoding)
53
52
  assert_equal(string, result.encode('UTF-16LE'))
54
53
  end
@@ -61,7 +60,7 @@ class JSONWrapperTest < Test::Unit::TestCase
61
60
  string = "Jyv+AOQ-skyl+AOQ-".force_encoding("UTF-7")
62
61
  assert string.valid_encoding?
63
62
  result = NewRelic::JSONWrapper.normalize_string(string)
64
- assert_not_same(result, string)
63
+ refute_same(result, string)
65
64
  assert_equal(Encoding.find('ISO-8859-1'), result.encoding)
66
65
  assert_equal('Jyv+AOQ-skyl+AOQ-'.force_encoding('ISO-8859-1'), result)
67
66
  end
@@ -0,0 +1,32 @@
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
+ class TestClass
6
+ def method_1
7
+ trace_execution_scoped(['a', 'b']) do
8
+ end
9
+ end
10
+
11
+ def method_2
12
+ callback = Proc.new { ['c', 'd'] }
13
+ trace_execution_scoped(['a', 'b'], { :additional_metrics_callback => callback }) do
14
+ end
15
+ end
16
+ end
17
+
18
+ class TraceExecutionScopedTests < Performance::TestCase
19
+ def setup
20
+ @test_class = TestClass.new
21
+ TestClass.instance_eval('include NewRelic::Agent::MethodTracer')
22
+ require 'new_relic/agent/method_tracer'
23
+ end
24
+
25
+ def test_without_callback
26
+ iterations.times { @test_class.method_1 }
27
+ end
28
+
29
+ def test_with_callback
30
+ iterations.times { @test_class.method_2 }
31
+ end
32
+ 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.7.2.190.beta
5
- prerelease: 10
4
+ version: 3.7.2.192
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jason Clark
@@ -40,7 +40,7 @@ cert_chain:
40
40
  cHUySWFQWE92bTNUOEc0TzZxWnZobkxoL1VpZW4rK0RqOGVGQmVjVFBvTThw
41
41
  VmpLM3BoNQpuL0V3dVpDY0U2Z2h0Q0NNCi0tLS0tRU5EIENFUlRJRklDQVRF
42
42
  LS0tLS0K
43
- date: 2014-01-24 00:00:00.000000000 Z
43
+ date: 2014-02-03 00:00:00.000000000 Z
44
44
  dependencies:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: rake
@@ -626,6 +626,12 @@ files:
626
626
  - test/multiverse/suites/httpclient/httpclient_test.rb
627
627
  - test/multiverse/suites/mongo/Envfile
628
628
  - test/multiverse/suites/mongo/config/newrelic.yml
629
+ - test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb
630
+ - test/multiverse/suites/mongo/helpers/mongo_replica_set.rb
631
+ - test/multiverse/suites/mongo/helpers/mongo_replica_set_test.rb
632
+ - test/multiverse/suites/mongo/helpers/mongo_server.rb
633
+ - test/multiverse/suites/mongo/helpers/mongo_server_test.rb
634
+ - test/multiverse/suites/mongo/mongo_connection_test.rb
629
635
  - test/multiverse/suites/mongo/mongo_instrumentation_test.rb
630
636
  - test/multiverse/suites/mongo/mongo_unsupported_version_test.rb
631
637
  - test/multiverse/suites/net_http/Envfile
@@ -851,6 +857,7 @@ files:
851
857
  - test/performance/suites/rum_autoinsertion.rb
852
858
  - test/performance/suites/startup.rb
853
859
  - test/performance/suites/thread_profiling.rb
860
+ - test/performance/suites/trace_execution_scoped.rb
854
861
  - test/performance/suites/transaction_tracing.rb
855
862
  - test/rum/basic.result.html
856
863
  - test/rum/basic.source.html
@@ -979,29 +986,30 @@ files:
979
986
  - lib/new_relic/build.rb
980
987
  homepage: http://www.github.com/newrelic/rpm
981
988
  licenses: []
982
- post_install_message: ! "# New Relic Ruby Agent Release Notes #\n\n## v3.7.1 ##\n\n*
983
- MongoDB support\n\n The Ruby agent provides support for the mongo gem, versions
984
- 1.8 and 1.9!\n Mongo calls are captured for transaction traces along with their
985
- parameters,\n and time spent in Mongo shows up on the Database tab.\n\n Support
986
- for more Mongo gems and more UI goodness will be coming, so watch\n http://docs.newrelic.com/docs/ruby/mongo
987
- for up-to-date status.\n\n* Harvest thread restarts for forked and daemonized processes\n\n
988
- \ Historically framework specific code was necessary for the Ruby agent to\n successfully
989
- report data after an app forked or daemonized. Gems or scripts\n with daemonizing
990
- modes had to wait for agent support or find workarounds.\n\n With 3.7.1 setting
991
- `restart_thread_in_children: true` in your newrelic.yml\n automatically restarts
992
- the agent in child processes without requiring custom\n code. For now the feature
993
- is opt-in, but future releases may default it on.\n\n* Fix for missing HTTP time\n\n
994
- \ The agent previously did not include connection establishment time for\n outgoing
995
- Net::HTTP requests. This has been corrected, and reported HTTP\n timings should
996
- now be more accurate.\n\n* Fix for Mongo ensure_index instrumentation (3.7.1.182)\n\n
997
- \ The Mongo instrumentation for ensure_index in 3.7.1.180 was not properly\n calling
998
- through to the uninstrumented version of this method. This has been\n fixed in
999
- 3.7.1.182. Thanks to Yuki Miyauchi for the fix!\n\n* Correct first reported metric
1000
- timespan for forking dispatchers (3.7.1.188)\n\n The first time a newly-forked
1001
- process (in some configurations) reported metric\n data, it would use the startup
1002
- time of the parent process as the start time\n for that metric data instead of
1003
- its own start time. This has been fixed.\n\nSee https://github.com/newrelic/rpm/blob/master/CHANGELOG
1004
- for a full list of\nchanges.\n"
989
+ post_install_message: ! "# New Relic Ruby Agent Release Notes #\n\n## v3.7.2 ##\n\n*
990
+ Mongo instrumentation improvements\n\n Users of the 'mongo' MongoDB client gem
991
+ will get more detailed instrumentation\n including support for some operations
992
+ that were not previously captured, and\n separation of aggregate metrics for web
993
+ transactions from background jobs.\n\n An issue with ensure_index when passed a
994
+ symbol or string was also fixed.\n Thanks Maxime RETY for the report!\n\n* More
995
+ accurate error tracing in Rails 4\n\n Traced errors in Rails 4 applications will
996
+ now be correctly associated with\n the transaction they occurred in, and custom
997
+ attributes attached to the\n transaction will be correctly attached to the traced
998
+ error as well.\n\n* More accurate partial-rendering metrics for Rails 4\n\n View
999
+ partials are now correctly treated as sub-components of the containing\n template
1000
+ render in Rails 4 applications, meaning that the app server breakdown\n graphs
1001
+ for Rails 4 transactions should be more accurate and useful.\n\n* Improved Unicorn
1002
+ 4.8.0 compatibility\n\n A rare issue that could lead to spurrious traced errors
1003
+ on app startup for\n applications using Unicorn 4.8.0 has been fixed.\n\n* meta_request
1004
+ gem compatibility\n\n An incompatibility with the meta_request gem has been fixed.\n\n*
1005
+ Typhoeus 0.6.4+ compatibility\n\n A potential crash with Typhoeus 0.6.4+ when passing
1006
+ a URI object instead of a\n String instance to one of Typhoeus's HTTP request methods
1007
+ has been fixed.\n\n* Sequel single threaded mode fix\n\n The agent will no longer
1008
+ attempt to run EXPLAIN queries for slow SQL\n statements issued using the Sequel
1009
+ gem in single-threaded mode, since\n doing so could potentially cause crashes.\n\n*
1010
+ Additional functionality for add_custom_parameters\n\n Calling add_custom_parameters
1011
+ adds parameters to the system codenamed\n Rubicon. For more information, see http://newrelic.com/software-analytics\n\nSee
1012
+ https://github.com/newrelic/rpm/blob/master/CHANGELOG for a full list of\nchanges.\n"
1005
1013
  rdoc_options:
1006
1014
  - --line-numbers
1007
1015
  - --inline-source
metadata.gz.sig CHANGED
Binary file