newrelic_rpm 3.18.1.330 → 4.0.0.332
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -74
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTING.md +14 -6
- data/LICENSE +1 -88
- data/lib/new_relic/agent.rb +2 -103
- data/lib/new_relic/agent/agent.rb +3 -32
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +2 -6
- data/lib/new_relic/agent/configuration/default_source.rb +1 -8
- data/lib/new_relic/agent/configuration/yaml_source.rb +1 -12
- data/lib/new_relic/agent/cross_app_monitor.rb +2 -1
- data/lib/new_relic/agent/cross_app_tracing.rb +4 -2
- data/lib/new_relic/agent/datastores/mongo.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -20
- data/lib/new_relic/agent/error_collector.rb +8 -21
- data/lib/new_relic/agent/inbound_request_monitor.rb +4 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +14 -30
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -5
- data/lib/new_relic/agent/instrumentation/curb.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +3 -3
- data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -2
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +2 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +3 -7
- data/lib/new_relic/agent/instrumentation/queue_time.rb +13 -15
- data/lib/new_relic/agent/instrumentation/rack.rb +4 -50
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +1 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +0 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +3 -2
- data/lib/new_relic/agent/method_tracer.rb +1 -60
- data/lib/new_relic/agent/new_relic_service.rb +3 -2
- data/lib/new_relic/agent/new_relic_service/encoders.rb +5 -6
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +7 -16
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -3
- data/lib/new_relic/agent/pipe_service.rb +1 -3
- data/lib/new_relic/agent/rules_engine.rb +2 -17
- data/lib/new_relic/agent/stats_engine.rb +0 -2
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +0 -48
- data/lib/new_relic/agent/supported_versions.rb +12 -19
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +0 -3
- data/lib/new_relic/agent/transaction/attributes.rb +1 -10
- data/lib/new_relic/agent/vm.rb +1 -4
- data/lib/new_relic/agent/vm/jruby_vm.rb +1 -3
- data/lib/new_relic/agent/vm/mri_vm.rb +2 -10
- data/lib/new_relic/control.rb +1 -2
- data/lib/new_relic/control/frameworks/rails.rb +1 -1
- data/lib/new_relic/control/frameworks/rails3.rb +1 -2
- data/lib/new_relic/control/frameworks/rails4.rb +1 -1
- data/lib/new_relic/control/frameworks/rails5.rb +1 -1
- data/lib/new_relic/control/instance_methods.rb +1 -1
- data/{vendor/gems/dependency_detection-0.0.1.build/lib → lib/new_relic}/dependency_detection.rb +0 -1
- data/lib/new_relic/helper.rb +6 -13
- data/lib/new_relic/language_support.rb +44 -139
- data/lib/new_relic/metric_spec.rb +0 -17
- data/lib/new_relic/noticed_error.rb +18 -27
- data/lib/new_relic/version.rb +3 -48
- data/lib/tasks/versions.rake +7 -5
- data/newrelic_rpm.gemspec +1 -16
- data/test/agent_helper.rb +4 -2
- data/test/environments/lib/environments/runner.rb +5 -14
- data/test/environments/norails/Gemfile +0 -8
- data/test/environments/rails21/Gemfile +0 -8
- data/test/environments/rails21/config/database.yml +1 -1
- data/test/environments/rails22/Gemfile +0 -8
- data/test/environments/rails22/config/database.yml +1 -1
- data/test/environments/rails23/Gemfile +1 -7
- data/test/environments/rails23/config/database.yml +1 -1
- data/test/environments/rails30/Gemfile +0 -1
- data/test/environments/rails30/config/database.yml +1 -1
- data/test/environments/rails31/Gemfile +0 -3
- data/test/environments/rails31/config/database.yml +1 -1
- data/test/environments/rails32/Gemfile +0 -3
- data/test/environments/rails32/config/database.yml +1 -1
- data/test/environments/rails40/Gemfile +0 -26
- data/test/environments/rails40/config/database.yml +1 -1
- data/test/environments/rails41/Gemfile +0 -18
- data/test/environments/rails41/config/database.yml +1 -1
- data/test/environments/rails42/Gemfile +0 -22
- data/test/environments/rails42/config/database.yml +1 -1
- data/test/environments/rails50/Gemfile +0 -13
- data/test/environments/rails50/config/database.yml +1 -1
- data/test/helpers/logging.rb +37 -0
- data/test/helpers/minitest.rb +50 -0
- data/test/helpers/misc.rb +87 -0
- data/test/helpers/transaction_sample.rb +44 -0
- data/test/multiverse/lib/multiverse/suite.rb +6 -91
- data/test/multiverse/script/runner +1 -1
- data/test/multiverse/suites/active_record/Envfile +1 -28
- data/test/multiverse/suites/active_record/active_record_test.rb +6 -6
- data/test/multiverse/suites/active_record/config/database.rb +2 -3
- data/test/multiverse/suites/active_record/config/database.yml +0 -2
- data/test/multiverse/suites/activemerchant/Envfile +4 -18
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +7 -15
- data/test/multiverse/suites/agent_only/error_events_test.rb +1 -7
- data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +4 -20
- data/test/multiverse/suites/agent_only/labels_test.rb +1 -1
- data/test/multiverse/suites/agent_only/marshaling_test.rb +5 -10
- data/test/multiverse/suites/agent_only/script/public_api_when_disabled.rb +0 -11
- data/test/multiverse/suites/agent_only/start_up_test.rb +3 -3
- data/test/multiverse/suites/agent_only/synthetics_test.rb +1 -1
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +0 -3
- data/test/multiverse/suites/agent_only/xray_sessions_test.rb +0 -3
- data/test/multiverse/suites/capistrano/Envfile +2 -4
- data/test/multiverse/suites/capistrano2/Envfile +0 -4
- data/test/multiverse/suites/curb/Envfile +3 -7
- data/test/multiverse/suites/datamapper/Envfile +2 -2
- data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -2
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +0 -1
- data/test/multiverse/suites/delayed_job/Envfile +28 -41
- data/test/multiverse/suites/excon/Envfile +0 -3
- data/test/multiverse/suites/grape/Envfile +0 -4
- data/test/multiverse/suites/grape/grape_versioning_test.rb +2 -2
- data/test/multiverse/suites/grape/grape_versioning_test_api.rb +2 -2
- data/test/multiverse/suites/json/Envfile +1 -9
- data/test/multiverse/suites/marshalling/Envfile +0 -9
- data/test/multiverse/suites/memcached/Envfile +5 -23
- data/test/multiverse/suites/mongo/Envfile +9 -11
- data/test/multiverse/suites/padrino/Envfile +0 -6
- data/test/multiverse/suites/rack/http_response_code_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +5 -10
- data/test/multiverse/suites/rack/rack_cascade_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_env_mutation_test.rb +0 -1
- data/test/multiverse/suites/rack/response_content_type_test.rb +0 -1
- data/test/multiverse/suites/rails/Envfile +1 -19
- data/test/multiverse/suites/rails/activejob_test.rb +1 -2
- data/test/multiverse/suites/rails/error_tracing_test.rb +0 -13
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +12 -32
- data/test/multiverse/suites/rake/Envfile +15 -22
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sequel/database.rb +1 -4
- data/test/multiverse/suites/sidekiq/Envfile +13 -23
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +3 -3
- data/test/multiverse/suites/typhoeus/Envfile +0 -19
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +3 -3
- data/test/multiverse/suites/yajl/Envfile +5 -0
- data/test/multiverse/suites/yajl/yajl_test.rb +1 -3
- data/test/new_relic/agent/agent/start_test.rb +3 -3
- data/test/new_relic/agent/agent_logger_test.rb +2 -2
- data/test/new_relic/agent/agent_test.rb +2 -2
- data/test/new_relic/agent/attribute_processing_test.rb +3 -4
- data/test/new_relic/agent/audit_logger_test.rb +4 -6
- data/test/new_relic/agent/aws_info_test.rb +17 -1
- data/test/new_relic/agent/busy_calculator_test.rb +14 -16
- data/test/new_relic/agent/configuration/manager_test.rb +1 -7
- data/test/new_relic/agent/cross_app_monitor_test.rb +1 -1
- data/test/new_relic/agent/database_test.rb +2 -10
- data/test/new_relic/agent/datastores/mongo/event_formatter_test.rb +90 -93
- data/test/new_relic/agent/datastores/redis_test.rb +14 -16
- data/test/new_relic/agent/encoding_normalizer_test.rb +38 -40
- data/test/new_relic/agent/error_collector_test.rb +16 -49
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +0 -6
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +101 -103
- data/test/new_relic/agent/instrumentation/rack_test.rb +11 -14
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +0 -10
- data/test/new_relic/agent/javascript_instrumentor_test.rb +2 -2
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +0 -10
- data/test/new_relic/agent/method_tracer_test.rb +35 -76
- data/test/new_relic/agent/new_relic_service_test.rb +86 -102
- data/test/new_relic/agent/pipe_channel_manager_test.rb +4 -9
- data/test/new_relic/agent/pipe_service_test.rb +2 -3
- data/test/new_relic/agent/rpm_agent_test.rb +0 -4
- data/test/new_relic/agent/sampled_buffer_test.rb +2 -2
- data/test/new_relic/agent/samplers/cpu_sampler_test.rb +28 -0
- data/test/new_relic/agent/samplers/memory_sampler_test.rb +66 -0
- data/test/new_relic/agent/sized_buffer_test.rb +1 -1
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +2 -14
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +44 -66
- data/test/new_relic/agent/stats_test.rb +6 -8
- data/test/new_relic/agent/synthetics_event_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction/attributes_test.rb +4 -12
- data/test/new_relic/agent/transaction_test.rb +2 -10
- data/test/new_relic/agent/utilization_data_test.rb +17 -1
- data/test/new_relic/agent/vm/mri_vm_test.rb +5 -7
- data/test/new_relic/agent_test.rb +0 -43
- data/test/new_relic/coerce_test.rb +1 -3
- data/test/new_relic/fake_collector.rb +3 -3
- data/test/new_relic/fake_external_server.rb +1 -1
- data/test/new_relic/fake_server.rb +1 -1
- data/test/new_relic/http_client_test_cases.rb +3 -3
- data/test/new_relic/language_support_test.rb +6 -12
- data/test/new_relic/latest_changes_test.rb +0 -11
- data/test/new_relic/license_test.rb +3 -8
- data/test/new_relic/multiverse_helpers.rb +1 -1
- data/test/new_relic/noticed_error_test.rb +11 -7
- data/test/new_relic/rack/browser_monitoring_test.rb +1 -3
- data/test/nullverse/nullverse_helper.rb +1 -1
- data/test/performance/lib/performance.rb +1 -1
- data/test/performance/lib/performance/instrumentation/gc_stats.rb +4 -6
- data/test/performance/lib/performance/instrumentation/perf_tools.rb +1 -1
- data/test/performance/lib/performance/instrumentation/stackprof.rb +1 -1
- data/test/performance/lib/performance/platform.rb +1 -8
- data/test/performance/script/runner +1 -3
- data/test/performance/suites/active_record.rb +3 -24
- data/test/test_helper.rb +9 -216
- metadata +9 -45
- data/lib/conditional_vendored_dependency_detection.rb +0 -7
- data/lib/new_relic/agent/hash_extensions.rb +0 -41
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +0 -39
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +0 -51
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +0 -47
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +0 -46
- data/lib/new_relic/agent/stats_engine/samplers.rb +0 -22
- data/lib/new_relic/agent/vm/rubinius_vm.rb +0 -140
- data/lib/new_relic/json_wrapper.rb +0 -78
- data/lib/new_relic/okjson.rb +0 -602
- data/lib/new_relic/rack/error_collector.rb +0 -27
- data/lib/new_relic/timer_lib.rb +0 -31
- data/test/helpers/runtime_detection.rb +0 -17
- data/test/multiverse/suites/no_json/Envfile +0 -12
- data/test/multiverse/suites/no_json/config/newrelic.yml +0 -27
- data/test/multiverse/suites/no_json/marshal_config_test.rb +0 -22
- data/test/new_relic/agent/hash_extensions_test.rb +0 -59
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +0 -22
- data/test/new_relic/agent/stats_engine/samplers_test.rb +0 -98
- data/test/new_relic/agent/vm/rubinius_vm_test.rb +0 -69
- data/test/new_relic/json_wrapper_test.rb +0 -32
- data/test/new_relic/rack/deferred_instrumentation_test.rb +0 -33
- data/test/new_relic/rack/error_collector_test.rb +0 -83
- data/test/new_relic/version_number_test.rb +0 -101
- data/test/script/before_install/revert_rubygems.sh +0 -15
- data/test/script/before_install/update_bundler.sh +0 -12
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +0 -7
@@ -1,11 +1,8 @@
|
|
1
1
|
boilerplate_gems = <<-BOILERPLATE
|
2
2
|
gem 'rack'
|
3
|
-
gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3' # i18n >= 0.7.0 only works on Ruby 1.9.3 and newer
|
4
3
|
|
5
4
|
if RUBY_PLATFORM == 'java'
|
6
5
|
gem "activerecord-jdbcmysql-adapter"
|
7
|
-
elsif RUBY_VERSION <= '1.9.3'
|
8
|
-
gem 'mysql'
|
9
6
|
else
|
10
7
|
gem 'mysql2', '~> 0.3.20'
|
11
8
|
end
|
@@ -19,7 +16,7 @@ if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
|
|
19
16
|
RB
|
20
17
|
end
|
21
18
|
|
22
|
-
if RUBY_VERSION
|
19
|
+
if RUBY_VERSION < '2.4.0'
|
23
20
|
gemfile <<-RB
|
24
21
|
gem 'activerecord', '~> 4.2.0'
|
25
22
|
gem 'minitest', '~> 5.2.3'
|
@@ -60,28 +57,4 @@ if RUBY_VERSION < '2.2.0'
|
|
60
57
|
RB
|
61
58
|
end
|
62
59
|
|
63
|
-
# We pull in Rails on the older verions because ActiveRecord didn't have all
|
64
|
-
# the tasks we need for setup, and there are some TestUnit vs Minitest oddities
|
65
|
-
#
|
66
|
-
# JRuby testing with 1.7 on Rails 2.x has issues and was already excluded in
|
67
|
-
# test:env
|
68
|
-
if RUBY_VERSION <= '1.9.3' && (!defined?(RUBY_ENGINE) || RUBY_ENGINE != 'jruby')
|
69
|
-
gemfile <<-RB
|
70
|
-
gem 'rails', '~> 2.3.18'
|
71
|
-
#{boilerplate_gems}
|
72
|
-
RB
|
73
|
-
|
74
|
-
gemfile <<-RB
|
75
|
-
gem "rails", "~> 2.2.3"
|
76
|
-
#{boilerplate_gems}
|
77
|
-
RB
|
78
|
-
end
|
79
|
-
|
80
|
-
if RUBY_VERSION < '1.9.2'
|
81
|
-
gemfile <<-RB
|
82
|
-
gem "rails", "~> 2.1.2"
|
83
|
-
#{boilerplate_gems}
|
84
|
-
RB
|
85
|
-
end
|
86
|
-
|
87
60
|
# vim: ft=ruby
|
@@ -28,9 +28,9 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
28
28
|
|
29
29
|
def active_record_version
|
30
30
|
if defined?(::ActiveRecord::VERSION::MINOR)
|
31
|
-
|
31
|
+
Gem::Version.new(::ActiveRecord::VERSION::STRING)
|
32
32
|
else
|
33
|
-
|
33
|
+
Gem::Version.new("2.1.0") # Can't tell between 2.1 and 2.2. Meh.
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -59,7 +59,7 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
if active_record_version >=
|
62
|
+
if active_record_version >= Gem::Version.new('3.2.0')
|
63
63
|
def test_metrics_for_pluck
|
64
64
|
in_web_transaction do
|
65
65
|
Order.pluck(:id)
|
@@ -69,7 +69,7 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
if active_record_version >=
|
72
|
+
if active_record_version >= Gem::Version.new('4.0.0')
|
73
73
|
def test_metrics_for_ids
|
74
74
|
in_web_transaction do
|
75
75
|
Order.ids
|
@@ -222,7 +222,7 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
222
222
|
end
|
223
223
|
|
224
224
|
# delete and touch did not exist in AR 2.2
|
225
|
-
if active_record_version >=
|
225
|
+
if active_record_version >= Gem::Version.new('3.0.0')
|
226
226
|
def test_metrics_for_delete
|
227
227
|
in_web_transaction do
|
228
228
|
order = Order.create("name" => "burt")
|
@@ -321,7 +321,7 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
321
321
|
end
|
322
322
|
|
323
323
|
# update & update! didn't become public until 4.0
|
324
|
-
if active_record_version >=
|
324
|
+
if active_record_version >= Gem::Version.new('4.0.0')
|
325
325
|
def test_metrics_for_update
|
326
326
|
in_web_transaction do
|
327
327
|
order = Order.create(:name => "wendy")
|
@@ -10,12 +10,11 @@ DependencyDetection.detect!
|
|
10
10
|
|
11
11
|
db_dir = File.expand_path('../../db', __FILE__)
|
12
12
|
config_dir = File.expand_path(File.dirname(__FILE__))
|
13
|
-
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' # MRI 1.8.7 doesn't define RUBY_ENGINE
|
14
13
|
|
15
14
|
if defined?(ActiveRecord::VERSION)
|
16
|
-
ENV['DATABASE_NAME'] = "multiverse_activerecord_#{ActiveRecord::VERSION::STRING}_#{RUBY_VERSION}_#{
|
15
|
+
ENV['DATABASE_NAME'] = "multiverse_activerecord_#{ActiveRecord::VERSION::STRING}_#{RUBY_VERSION}_#{RUBY_ENGINE}".gsub(".", "_")
|
17
16
|
else
|
18
|
-
ENV['DATABASE_NAME'] = "multiverse_activerecord_2_x_#{ENV["MULTIVERSE_ENV"]}_#{RUBY_VERSION}_#{
|
17
|
+
ENV['DATABASE_NAME'] = "multiverse_activerecord_2_x_#{ENV["MULTIVERSE_ENV"]}_#{RUBY_VERSION}_#{RUBY_ENGINE}".gsub(".", "_")
|
19
18
|
end
|
20
19
|
|
21
20
|
config_raw = File.read(File.join(config_dir, 'database.yml'))
|
@@ -4,15 +4,8 @@ gemfile <<-RB
|
|
4
4
|
gem 'activemerchant', '~>1.43.1'
|
5
5
|
gem 'rack'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'activesupport', '~>2.3.14', :require => 'active_support'
|
10
|
-
gem 'nokogiri', '~>1.4.7'
|
11
|
-
gem 'i18n', '~>0.6.11'
|
12
|
-
else
|
13
|
-
gem 'activesupport', '~>4.0.4'
|
14
|
-
gem 'nokogiri', '~>1.6.1'
|
15
|
-
end
|
7
|
+
gem 'activesupport', '~>4.0.4'
|
8
|
+
gem 'nokogiri', '~>1.6.1'
|
16
9
|
|
17
10
|
# Need to load newrelic_rpm after ActiveMerchant Gateways are required
|
18
11
|
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
@@ -23,15 +16,8 @@ gemfile <<-RB
|
|
23
16
|
gem 'active_utils', '2.2.3'
|
24
17
|
gem 'rack'
|
25
18
|
|
26
|
-
|
27
|
-
|
28
|
-
gem 'activesupport', '~>2.3.14', :require => 'active_support'
|
29
|
-
gem 'nokogiri', '~>1.4.7'
|
30
|
-
gem 'i18n', '~>0.6.11'
|
31
|
-
else
|
32
|
-
gem 'activesupport', '~>4.0.4'
|
33
|
-
gem 'nokogiri', '~>1.5.11'
|
34
|
-
end
|
19
|
+
gem 'activesupport', '~>4.0.4'
|
20
|
+
gem 'nokogiri', '~>1.5.11'
|
35
21
|
|
36
22
|
# Need to load newrelic_rpm after ActiveMerchant Gateways are required
|
37
23
|
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
@@ -2,25 +2,19 @@
|
|
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
|
-
if RUBY_VERSION >= '1.9'
|
6
|
-
|
7
5
|
class EncodingHandlingTest < Minitest::Test
|
8
6
|
include MultiverseHelpers
|
9
7
|
|
10
8
|
setup_and_teardown_agent
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
in_transaction do
|
19
|
-
state = NewRelic::Agent::TransactionState.tl_get
|
20
|
-
agent.transaction_sampler.notice_sql(bad_string, nil, 42, state)
|
21
|
-
end
|
22
|
-
assert_endpoint_received_string('transaction_sample_data', normalized_bad_string)
|
10
|
+
def test_handles_mis_encoded_database_queries
|
11
|
+
with_config(:'transaction_tracer.transaction_threshold' => 0.0,
|
12
|
+
:'transaction_tracer.record_sql' => :raw) do
|
13
|
+
in_transaction do
|
14
|
+
state = NewRelic::Agent::TransactionState.tl_get
|
15
|
+
agent.transaction_sampler.notice_sql(bad_string, nil, 42, state)
|
23
16
|
end
|
17
|
+
assert_endpoint_received_string('transaction_sample_data', normalized_bad_string)
|
24
18
|
end
|
25
19
|
end
|
26
20
|
|
@@ -126,5 +120,3 @@ class EncodingHandlingTest < Minitest::Test
|
|
126
120
|
bad_string.force_encoding('ISO-8859-1').encode('UTF-8')
|
127
121
|
end
|
128
122
|
end
|
129
|
-
|
130
|
-
end
|
@@ -20,13 +20,7 @@ class ErrorEventsTest < Minitest::Test
|
|
20
20
|
assert_equal "RuntimeError", intrinsics["error.class"]
|
21
21
|
assert_equal "Big Controller", intrinsics["error.message"]
|
22
22
|
assert_equal "TransactionError", intrinsics["type"]
|
23
|
-
|
24
|
-
# 1.8 + JSON is finicky about comparing floats.
|
25
|
-
# If the timestamps are within 0.001 seconds, it's Good Enough.
|
26
|
-
assert_in_delta(txn.payload[:duration], intrinsics["duration"], 0.001)
|
27
|
-
else
|
28
|
-
assert_equal txn.payload[:duration], intrinsics["duration"]
|
29
|
-
end
|
23
|
+
assert_equal txn.payload[:duration], intrinsics["duration"]
|
30
24
|
end
|
31
25
|
|
32
26
|
def test_records_supportability_metrics
|
@@ -23,15 +23,8 @@ class HarvestTimestampsTest < Minitest::Test
|
|
23
23
|
metric_data_post = $collector.calls_for('metric_data').first
|
24
24
|
start_ts, end_ts = metric_data_post[1..2]
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
# If the timestamps are within 0.001 seconds, it's Good Enough.
|
29
|
-
assert_in_delta(t1.to_f, start_ts, 0.001)
|
30
|
-
assert_in_delta(t2.to_f, end_ts, 0.001)
|
31
|
-
else
|
32
|
-
assert_equal(t1.to_f, start_ts)
|
33
|
-
assert_equal(t2.to_f, end_ts)
|
34
|
-
end
|
26
|
+
assert_equal(t1.to_f, start_ts)
|
27
|
+
assert_equal(t2.to_f, end_ts)
|
35
28
|
end
|
36
29
|
|
37
30
|
def test_start_timestamp_maintained_on_harvest_failure
|
@@ -50,17 +43,8 @@ class HarvestTimestampsTest < Minitest::Test
|
|
50
43
|
trigger_metric_data_post
|
51
44
|
second_post = last_metric_data_post
|
52
45
|
|
53
|
-
|
54
|
-
|
55
|
-
# If the timestamps are within 0.001 seconds, it's Good Enough.
|
56
|
-
assert_in_delta(t0, first_post[1], 0.001)
|
57
|
-
assert_in_delta(t1, first_post[2], 0.001)
|
58
|
-
assert_in_delta(t0, second_post[1], 0.001)
|
59
|
-
assert_in_delta(t2, second_post[2], 0.001)
|
60
|
-
else
|
61
|
-
assert_equal([t0, t1], first_post[1..2])
|
62
|
-
assert_equal([t0, t2], second_post[1..2])
|
63
|
-
end
|
46
|
+
assert_equal([t0, t1], first_post[1..2])
|
47
|
+
assert_equal([t0, t2], second_post[1..2])
|
64
48
|
end
|
65
49
|
|
66
50
|
def trigger_metric_data_post
|
@@ -36,20 +36,15 @@ class MarshalingTest < Minitest::Test
|
|
36
36
|
expected = expected_sample.to_collector_array(encoder)
|
37
37
|
expected = NewRelic::Agent::EncodingNormalizer.normalize_object(expected)
|
38
38
|
|
39
|
-
if RUBY_VERSION == '1.8.7'
|
40
|
-
# 1.8 + JSON is finicky about comparing floats.
|
41
|
-
# If the timestamps are within 0.001 seconds, it's Good Enough.
|
42
|
-
assert_in_delta(expected[4][0], actual[4][0], 0.001)
|
43
|
-
actual[4][0] = expected[4][0]
|
44
|
-
end
|
45
39
|
assert_equal(expected, actual)
|
46
40
|
end
|
47
41
|
|
48
42
|
def test_metric_data_marshalling
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
43
|
+
metric = 'Custom/test/method'
|
44
|
+
NewRelic::Agent.record_metric metric, 1.0
|
45
|
+
NewRelic::Agent.record_metric metric, 2.0
|
46
|
+
|
47
|
+
expected = [ 2, 3.0, 3.0, 1.0, 2.0, 5.0 ]
|
53
48
|
|
54
49
|
agent.service.connect
|
55
50
|
agent.send(:harvest_and_send_timeslice_data)
|
@@ -48,21 +48,10 @@ NewRelic::Agent.set_sql_obfuscator do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
NewRelic::Agent.browser_timing_header
|
51
|
-
NewRelic::Agent.browser_timing_footer
|
52
51
|
|
53
52
|
NewRelic::Agent.add_custom_attributes(:custom => "attributes")
|
54
|
-
NewRelic::Agent.add_custom_parameters(:custom => "parameters")
|
55
|
-
NewRelic::Agent.add_request_parameters(:request => "parameters")
|
56
|
-
NewRelic::Agent.set_user_attributes(:user => "attributes")
|
57
53
|
|
58
|
-
NewRelic::Agent.get_stats("Foo/Bar")
|
59
|
-
NewRelic::Agent.get_stats_no_scope("Foo/Bar")
|
60
|
-
NewRelic::Agent.reset_stats
|
61
54
|
NewRelic::Agent.drop_buffered_data
|
62
55
|
|
63
|
-
NewRelic::Agent.abort_transaction!
|
64
|
-
|
65
56
|
NewRelic::Agent.after_fork(options={})
|
66
57
|
NewRelic::Agent.shutdown(options={})
|
67
|
-
|
68
|
-
NewRelic::Agent::Deprecator.deprecate("SomeClass#old_method")
|
@@ -97,11 +97,11 @@ class StartUpTest < Minitest::Test
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def jruby_9000
|
100
|
-
defined?(JRUBY_VERSION) &&
|
100
|
+
defined?(JRUBY_VERSION) && Gem::Version.new(JRUBY_VERSION) >= Gem::Version.new("9.0.0")
|
101
101
|
end
|
102
102
|
|
103
103
|
def bundler_rubygem_conflicts?
|
104
|
-
|
105
|
-
|
104
|
+
Gem::Version.new(Gem::VERSION) == Gem::Version.new("2.6.6") and
|
105
|
+
Gem::Version.new(Bundler::VERSION) == Gem::Version.new("1.12.5")
|
106
106
|
end
|
107
107
|
end
|
@@ -38,7 +38,7 @@ class SyntheticsTest < Minitest::Test
|
|
38
38
|
|
39
39
|
return nil if synthetics_payload.empty?
|
40
40
|
|
41
|
-
encoded_synthetics_payload = ::
|
41
|
+
encoded_synthetics_payload = ::JSON.dump(synthetics_payload)
|
42
42
|
obfuscated_synthetics_header = ::NewRelic::Agent::Obfuscator.new(synthetics_key).obfuscate(encoded_synthetics_payload)
|
43
43
|
|
44
44
|
assert_equal(test['inputObfuscatedHeader']['X-NewRelic-Synthetics'], obfuscated_synthetics_header)
|
@@ -5,8 +5,6 @@
|
|
5
5
|
# https://newrelic.atlassian.net/wiki/display/eng/Agent+Thread+Profiling
|
6
6
|
# https://newrelic.atlassian.net/browse/RUBY-917
|
7
7
|
|
8
|
-
if RUBY_VERSION >= '1.9'
|
9
|
-
|
10
8
|
require 'thread'
|
11
9
|
|
12
10
|
class ThreadProfilingTest < Minitest::Test
|
@@ -137,4 +135,3 @@ class ThreadProfilingTest < Minitest::Test
|
|
137
135
|
end
|
138
136
|
|
139
137
|
end
|
140
|
-
end
|
@@ -5,8 +5,6 @@
|
|
5
5
|
# https://newrelic.atlassian.net/wiki/display/eng/Agent+Thread+Profiling
|
6
6
|
# https://newrelic.atlassian.net/browse/RUBY-917
|
7
7
|
|
8
|
-
if RUBY_VERSION >= '1.9'
|
9
|
-
|
10
8
|
require 'rack/test'
|
11
9
|
require './testing_app'
|
12
10
|
|
@@ -196,4 +194,3 @@ class XraySessionsTest < Minitest::Test
|
|
196
194
|
end
|
197
195
|
|
198
196
|
end
|
199
|
-
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
suite_condition("Capistrano 3
|
2
|
-
|
1
|
+
suite_condition("Capistrano 3 flaky on JRuby") do
|
2
|
+
RUBY_PLATFORM != 'java'
|
3
3
|
end
|
4
4
|
|
5
5
|
boilerplate = <<-BOILERPLATE
|
6
6
|
gem 'sshkit', '~> 1.8.1'
|
7
7
|
gem 'rack'
|
8
|
-
gem 'net-ssh', '2.9.2' if RUBY_VERSION <= '1.9.3'
|
9
|
-
gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3'
|
10
8
|
BOILERPLATE
|
11
9
|
|
12
10
|
gemfile <<-RB
|
@@ -2,21 +2,17 @@ suite_condition("Curb is not useful on JRuby") do
|
|
2
2
|
RUBY_PLATFORM != 'java'
|
3
3
|
end
|
4
4
|
|
5
|
-
# There appears to be a bug in later curbs (> 0.8.6) that manifests in hangs of
|
6
|
-
# this suite when run on Ruby 1.8.7 or REE, so don't run against that version
|
7
|
-
# on those Rubies.
|
8
|
-
curb_version_spec = RUBY_VERSION == "1.8.7" ? '0.8.5' : '~>0.8.8'
|
9
5
|
gemfile <<-RB
|
10
|
-
gem 'curb', '
|
6
|
+
gem 'curb', '~> 0.8.8'
|
11
7
|
gem 'rack'
|
12
8
|
gem 'json', :platforms => [:rbx, :mri_18]
|
13
9
|
|
14
10
|
# We try translating URIs through Addressable if it's there, so test with it.
|
15
|
-
gem 'addressable',
|
11
|
+
gem 'addressable', :require => 'addressable/uri'
|
16
12
|
RB
|
17
13
|
|
18
14
|
gemfile <<-RB
|
19
|
-
gem 'curb', '
|
15
|
+
gem 'curb', '~> 0.8.8'
|
20
16
|
gem 'rack'
|
21
17
|
gem 'json', :platforms => [:rbx, :mri_18]
|
22
18
|
RB
|
@@ -13,7 +13,7 @@ RB
|
|
13
13
|
gemfile <<-RB
|
14
14
|
gem 'datamapper', '~> 1.2.0', :require => 'data_mapper'
|
15
15
|
gem 'dm-ar-finders', '~> 1.2.0'
|
16
|
-
gem 'addressable',
|
16
|
+
gem 'addressable', :require => 'addressable/uri'
|
17
17
|
#{adapter_gems}
|
18
18
|
RB
|
19
19
|
|
@@ -28,7 +28,7 @@ RB
|
|
28
28
|
gemfile <<-RB
|
29
29
|
gem 'datamapper', '~> 1.0.2'
|
30
30
|
gem 'dm-ar-finders', '~> 1.0.2'
|
31
|
-
gem 'addressable',
|
31
|
+
gem 'addressable', :require => 'addressable/uri'
|
32
32
|
#{adapter_gems}
|
33
33
|
RB
|
34
34
|
end
|
@@ -367,13 +367,13 @@ class DataMapperTest < Minitest::Test
|
|
367
367
|
def test_should_not_bomb_out_if_a_query_is_in_an_invalid_encoding
|
368
368
|
db = DummyConnection.new
|
369
369
|
q = "select ICS95095010000000000083320000BS01030000004100+\xFF00000000000000000"
|
370
|
-
q.force_encoding 'UTF-8'
|
370
|
+
q.force_encoding 'UTF-8'
|
371
371
|
|
372
372
|
msg = mock
|
373
373
|
msg.stubs(:duration).returns(1)
|
374
374
|
msg.stubs(:query).returns(q)
|
375
375
|
|
376
|
-
assert_equal false, msg.query.valid_encoding?
|
376
|
+
assert_equal false, msg.query.valid_encoding?
|
377
377
|
db.send(:log, msg)
|
378
378
|
end
|
379
379
|
|