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
@@ -8,8 +8,7 @@ require 'logger'
|
|
8
8
|
require 'stringio'
|
9
9
|
|
10
10
|
# ActiveJob is in Rails 4.2+, so make sure we're on an allowed version before
|
11
|
-
# we try to load.
|
12
|
-
# on Rubinius.
|
11
|
+
# we try to load.
|
13
12
|
if Rails::VERSION::STRING >= "4.2.0"
|
14
13
|
|
15
14
|
require 'active_job'
|
@@ -56,11 +56,6 @@ class ErrorController < ApplicationController
|
|
56
56
|
render :text => "Shoulda noticed an error"
|
57
57
|
end
|
58
58
|
|
59
|
-
def deprecated_noticed_error
|
60
|
-
newrelic_notice_error(RuntimeError.new('this error should be noticed'))
|
61
|
-
render :text => "Shoulda noticed an error"
|
62
|
-
end
|
63
|
-
|
64
59
|
def middleware_error
|
65
60
|
render :text => 'everything went great'
|
66
61
|
end
|
@@ -155,14 +150,6 @@ class ErrorsWithoutSSCTest < RailsMultiverseTest
|
|
155
150
|
'Controller/error/model_error')
|
156
151
|
end
|
157
152
|
|
158
|
-
if Rails::VERSION::MAJOR < 5
|
159
|
-
def test_should_capture_deprecated_noticed_error_in_controller
|
160
|
-
get '/error/deprecated_noticed_error'
|
161
|
-
assert_error_reported_once('this error should be noticed',
|
162
|
-
'Controller/error/deprecated_noticed_error')
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
153
|
def test_should_capture_noticed_error_in_controller
|
167
154
|
get '/error/noticed_error'
|
168
155
|
assert_error_reported_once('this error should be noticed',
|
@@ -4,20 +4,17 @@
|
|
4
4
|
|
5
5
|
require './app'
|
6
6
|
|
7
|
-
# These tests only return consistent results
|
8
|
-
if NewRelic::LanguageSupport.
|
9
|
-
(RUBY_VERSION >= '1.9.2' &&
|
10
|
-
!NewRelic::LanguageSupport.jruby? &&
|
11
|
-
!NewRelic::LanguageSupport.rubinius?)
|
7
|
+
# These tests only return consistent results MRI >= 1.9.2
|
8
|
+
if !NewRelic::LanguageSupport.jruby?
|
12
9
|
|
13
10
|
class GcController < ApplicationController
|
14
11
|
def gc_action
|
15
12
|
begin
|
16
13
|
NewRelic::Agent::StatsEngine::GCProfiler.init
|
17
|
-
initial_gc_count =
|
14
|
+
initial_gc_count = ::GC.count
|
18
15
|
|
19
16
|
Timeout.timeout(5) do
|
20
|
-
until
|
17
|
+
until ::GC.count > initial_gc_count
|
21
18
|
long_string = "01234567" * 100_000
|
22
19
|
long_string = nil
|
23
20
|
another_long_string = "01234567" * 100_000
|
@@ -30,14 +27,6 @@ class GcController < ApplicationController
|
|
30
27
|
|
31
28
|
render :text => 'ha'
|
32
29
|
end
|
33
|
-
|
34
|
-
def current_gc_count
|
35
|
-
if NewRelic::LanguageSupport.ree?
|
36
|
-
::GC.collections
|
37
|
-
elsif RUBY_VERSION >= '1.9.2'
|
38
|
-
::GC.count
|
39
|
-
end
|
40
|
-
end
|
41
30
|
end
|
42
31
|
|
43
32
|
class GCRailsInstrumentationTest < ActionController::TestCase
|
@@ -48,7 +37,7 @@ class GCRailsInstrumentationTest < ActionController::TestCase
|
|
48
37
|
setup_and_teardown_agent do
|
49
38
|
NewRelic::Agent.drop_buffered_data
|
50
39
|
NewRelic::Agent::StatsEngine::GCProfiler.reset
|
51
|
-
|
40
|
+
GC::Profiler.enable
|
52
41
|
@controller = GcController.new
|
53
42
|
end
|
54
43
|
|
@@ -57,8 +46,13 @@ class GCRailsInstrumentationTest < ActionController::TestCase
|
|
57
46
|
get :gc_action
|
58
47
|
elapsed = Time.now.to_f - start.to_f
|
59
48
|
|
60
|
-
|
61
|
-
|
49
|
+
stats_hash = NewRelic::Agent.instance.stats_engine.reset!
|
50
|
+
|
51
|
+
gc_metric_unscoped = stats_hash[NewRelic::MetricSpec.new('GC/Transaction/allWeb')]
|
52
|
+
gc_metric_scoped = stats_hash[NewRelic::MetricSpec.new('GC/Transaction/allWeb', 'Controller/gc/gc_action')]
|
53
|
+
|
54
|
+
assert_in_range(elapsed, gc_metric_unscoped.total_call_time)
|
55
|
+
assert_in_range(elapsed, gc_metric_scoped.total_call_time)
|
62
56
|
end
|
63
57
|
|
64
58
|
def test_records_transaction_param_for_gc_activity
|
@@ -74,20 +68,6 @@ class GCRailsInstrumentationTest < ActionController::TestCase
|
|
74
68
|
assert gc_time > 0.0, "GC Time wasn't recorded!"
|
75
69
|
assert gc_time < duration, "GC Time #{gc_time} can't be more than elapsed #{duration}!"
|
76
70
|
end
|
77
|
-
|
78
|
-
def get_call_time(name, scope=nil)
|
79
|
-
NewRelic::Agent.agent.stats_engine.
|
80
|
-
get_stats(name, true, false, scope).
|
81
|
-
total_call_time
|
82
|
-
end
|
83
|
-
|
84
|
-
def enable_gc_stats
|
85
|
-
if NewRelic::LanguageSupport.ree?
|
86
|
-
GC.enable_stats
|
87
|
-
elsif RUBY_VERSION >= '1.9.2'
|
88
|
-
GC::Profiler.enable
|
89
|
-
end
|
90
|
-
end
|
91
71
|
end
|
92
72
|
|
93
73
|
end
|
@@ -1,34 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
RB
|
6
|
-
end
|
1
|
+
gemfile <<-RB
|
2
|
+
gem 'rack'
|
3
|
+
gem 'rake', '~> 12.0'
|
4
|
+
RB
|
7
5
|
|
8
6
|
gemfile <<-RB
|
9
7
|
gem 'rack'
|
10
|
-
gem 'rake', '~>
|
8
|
+
gem 'rake', '~> 11.1'
|
11
9
|
RB
|
12
10
|
|
13
|
-
# No single Rails version works everywhere, so split it up
|
14
|
-
if RUBY_VERSION >= "1.9.3"
|
15
|
-
if RUBY_VERSION < '2.4.0'
|
16
|
-
gemfile <<-RB
|
17
|
-
gem 'rack'
|
18
|
-
gem 'rake', '~> 10.4'
|
19
|
-
gem 'rails', '~> 4.2.1'
|
20
|
-
gem 'minitest', '5.2.3'
|
21
|
-
gem 'nokogiri', '< 1.7' if RUBY_VERSION < '2.1.0' # nokogiri 1.7.0 only supports >= 2.1.0
|
22
|
-
RB
|
23
|
-
end
|
24
|
-
else
|
25
11
|
gemfile <<-RB
|
26
12
|
gem 'rack'
|
27
|
-
gem 'rack-cache', '1.2' # rack-cache >= 1.3.0 only works on Ruby 1.9.3 and newer
|
28
13
|
gem 'rake', '~> 10.4'
|
29
|
-
gem 'rails', '~> 3.2.21'
|
30
|
-
gem 'i18n', '~>0.6.11'
|
31
14
|
RB
|
15
|
+
|
16
|
+
# No single Rails version works everywhere, so split it up
|
17
|
+
if RUBY_VERSION < '2.4.0'
|
18
|
+
gemfile <<-RB
|
19
|
+
gem 'rack'
|
20
|
+
gem 'rake', '~> 10.4'
|
21
|
+
gem 'rails', '~> 4.2.1'
|
22
|
+
gem 'minitest', '5.2.3'
|
23
|
+
gem 'nokogiri', '< 1.7' if RUBY_VERSION < '2.1.0' # nokogiri 1.7.0 only supports >= 2.1.0
|
24
|
+
RB
|
32
25
|
end
|
33
26
|
|
34
27
|
gemfile <<-RB
|
@@ -321,7 +321,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
321
321
|
end
|
322
322
|
|
323
323
|
def client
|
324
|
-
if
|
324
|
+
if Gem::Version.new(Redis::VERSION).segments[0] < 4
|
325
325
|
:client
|
326
326
|
else
|
327
327
|
:_client
|
@@ -10,9 +10,6 @@ require 'sequel'
|
|
10
10
|
# DO NOT require newrelic_rpm here. Some of the tests rely on the timing of
|
11
11
|
# when New Relic gets pulled in.
|
12
12
|
if !defined?(DB)
|
13
|
-
def jruby?
|
14
|
-
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
15
|
-
end
|
16
13
|
|
17
14
|
def create_tables(db)
|
18
15
|
db.create_table( :authors ) do
|
@@ -37,7 +34,7 @@ if !defined?(DB)
|
|
37
34
|
end
|
38
35
|
|
39
36
|
# Use an in-memory SQLite database
|
40
|
-
if (jruby
|
37
|
+
if (RUBY_ENGINE == 'jruby')
|
41
38
|
DB = Sequel.connect('jdbc:sqlite::memory:')
|
42
39
|
else
|
43
40
|
DB = Sequel.sqlite
|
@@ -1,28 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# Sidekiq 3.x does not support MRI 1.9.x
|
6
|
-
if (RUBY_VERSION >= '2.0.0' && RUBY_VERSION < '2.4.0') || (RUBY_PLATFORM == 'java')
|
7
|
-
gemfile <<-RB
|
8
|
-
gem 'json'
|
9
|
-
gem 'sidekiq', '~> 3.4.2'
|
10
|
-
gem 'rack'
|
1
|
+
gemfile <<-RB
|
2
|
+
gem 'json'
|
3
|
+
gem 'sidekiq', '~> 3.4.2'
|
4
|
+
gem 'rack'
|
11
5
|
|
12
|
-
|
13
|
-
|
14
|
-
end
|
6
|
+
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
7
|
+
RB
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
RB
|
23
|
-
end
|
9
|
+
gemfile <<-RB
|
10
|
+
gem 'json'
|
11
|
+
gem 'sidekiq', '~> 4.0.0'
|
12
|
+
gem 'rack'
|
13
|
+
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
14
|
+
RB
|
24
15
|
|
25
|
-
if RUBY_VERSION
|
16
|
+
if RUBY_VERSION < '2.4.0' && RUBY_PLATFORM != 'java'
|
26
17
|
# We skip testing Sidekiq 3.5.3 on JRuby due to an error in Sidekiq's shutdown:
|
27
18
|
# https://github.com/mperham/sidekiq/issues/2703
|
28
19
|
gemfile <<-RB
|
@@ -42,7 +33,6 @@ RB
|
|
42
33
|
|
43
34
|
gemfile <<-RB
|
44
35
|
# Almost oldest supported version
|
45
|
-
# Having rbx issues on 2.8.0, 2.9.0 seems fine.
|
46
36
|
gem 'json'
|
47
37
|
gem 'sidekiq', '~> 2.9.0'
|
48
38
|
gem 'timers', '~> 1.1.0'
|
@@ -21,7 +21,7 @@ module SinatraTestCases
|
|
21
21
|
'GET /route/no_match'
|
22
22
|
end
|
23
23
|
|
24
|
-
if
|
24
|
+
if Gem::Version.new(Sinatra::VERSION).segments[0] < 2
|
25
25
|
# get /\/regex.*/
|
26
26
|
def regex_segment
|
27
27
|
'GET (?-mix:\/regex.*)'
|
@@ -188,7 +188,7 @@ module SinatraTestCases
|
|
188
188
|
|
189
189
|
get '/pass'
|
190
190
|
|
191
|
-
expected_status =
|
191
|
+
expected_status = Gem::Version.new(Sinatra::VERSION).segments[0] < 2 ? 200 : 400
|
192
192
|
|
193
193
|
assert_equal expected_status, last_response.status
|
194
194
|
end
|
@@ -203,7 +203,7 @@ module SinatraTestCases
|
|
203
203
|
end
|
204
204
|
|
205
205
|
|
206
|
-
if
|
206
|
+
if Gem::Version.new(Sinatra::VERSION).segments[0] < 2
|
207
207
|
def trigger_error_on_params
|
208
208
|
Sinatra::Request.any_instance.
|
209
209
|
stubs(:params).returns({}).
|
@@ -1,35 +1,19 @@
|
|
1
|
-
suite_condition("Typhoeus excluded on 1.8.7") do
|
2
|
-
# Under Ruby 1.8.7 there are periodic segfaults with Typhoeus
|
3
|
-
# and the Ruby agent. This predated our Typhoeus instrumentation, but given
|
4
|
-
# usage levels and obscurity of the issue, it isn't worth deeper digging.
|
5
|
-
# Just use >= 1.9
|
6
|
-
RUBY_VERSION > '1.8.7'
|
7
|
-
end
|
8
|
-
|
9
1
|
gemfile <<-RB
|
10
2
|
gem 'typhoeus', '~> 0.7.1'
|
11
3
|
gem 'rack'
|
12
|
-
gem 'json', :platforms => [:rbx, :mri_18]
|
13
4
|
|
14
5
|
# We try translating URIs through Addressable if it's there, so test with it.
|
15
6
|
gem 'addressable', :require => 'addressable/uri'
|
16
|
-
if RUBY_VERSION < '1.9.3'
|
17
|
-
gem 'public_suffix', '< 1.4'
|
18
|
-
elsif RUBY_VERSION < '2.0'
|
19
|
-
gem 'public_suffix', '< 1.5'
|
20
|
-
end
|
21
7
|
RB
|
22
8
|
|
23
9
|
gemfile <<-RB
|
24
10
|
gem 'typhoeus', '~> 0.7.1'
|
25
11
|
gem 'rack'
|
26
|
-
gem 'json', :platforms => [:rbx, :mri_18]
|
27
12
|
RB
|
28
13
|
|
29
14
|
gemfile <<-RB
|
30
15
|
gem 'typhoeus', '~> 0.6.9'
|
31
16
|
gem 'rack'
|
32
|
-
gem 'json', :platforms => [:rbx, :mri_18]
|
33
17
|
RB
|
34
18
|
|
35
19
|
if RUBY_VERSION < '2.4.0'
|
@@ -46,7 +30,6 @@ if RUBY_VERSION < '2.4.0'
|
|
46
30
|
|
47
31
|
gem 'typhoeus', '~> 0.5.4'
|
48
32
|
gem 'rack'
|
49
|
-
gem 'json', :platforms => [:rbx, :mri_18]
|
50
33
|
RB
|
51
34
|
|
52
35
|
# Earliest supported version
|
@@ -63,7 +46,6 @@ if RUBY_VERSION < '2.4.0'
|
|
63
46
|
|
64
47
|
gem 'typhoeus', '0.5.3'
|
65
48
|
gem 'rack'
|
66
|
-
gem 'json', :platforms => [:rbx, :mri_18]
|
67
49
|
RB
|
68
50
|
end
|
69
51
|
|
@@ -81,7 +63,6 @@ gemfile <<-RB
|
|
81
63
|
|
82
64
|
gem 'typhoeus', '0.5.2'
|
83
65
|
gem 'rack'
|
84
|
-
gem 'json', :platforms => [:rbx, :mri_18]
|
85
66
|
RB
|
86
67
|
|
87
68
|
# vim: ft=ruby
|
@@ -11,13 +11,13 @@ if NewRelic::Agent::Instrumentation::TyphoeusTracing.is_supported_version?
|
|
11
11
|
class TyphoeusTest < Minitest::Test
|
12
12
|
include HttpClientTestCases
|
13
13
|
|
14
|
-
USE_SSL_VERIFYPEER_VERSION =
|
14
|
+
USE_SSL_VERIFYPEER_VERSION = Gem::Version.new("0.5.0")
|
15
15
|
|
16
16
|
# Starting in version 0.6.4, Typhoeus supports passing URI instances instead
|
17
17
|
# of String URLs. Make sure we don't break that.
|
18
|
-
SUPPORTS_URI_OBJECT_VERSION =
|
18
|
+
SUPPORTS_URI_OBJECT_VERSION = Gem::Version.new("0.6.4")
|
19
19
|
|
20
|
-
CURRENT_TYPHOEUS_VERSION =
|
20
|
+
CURRENT_TYPHOEUS_VERSION = Gem::Version.new(Typhoeus::VERSION)
|
21
21
|
|
22
22
|
def ssl_option
|
23
23
|
if CURRENT_TYPHOEUS_VERSION >= USE_SSL_VERIFYPEER_VERSION
|
@@ -2,6 +2,11 @@ suite_condition("Yajl not supported for JRuby or 2.4") do
|
|
2
2
|
RUBY_PLATFORM != 'java' && RUBY_VERSION < '2.4.0'
|
3
3
|
end
|
4
4
|
|
5
|
+
gemfile <<-RB
|
6
|
+
gem 'rack'
|
7
|
+
gem 'yajl-ruby', '~> 1.3.0', require: ['yajl', 'yajl/json_gem']
|
8
|
+
RB
|
9
|
+
|
5
10
|
gemfile <<-RB
|
6
11
|
gem 'rack'
|
7
12
|
gem 'yajl-ruby', '~> 1.2.1'
|
@@ -89,7 +89,7 @@ class NewRelic::Agent::Agent::StartTest < Minitest::Test
|
|
89
89
|
private :at_exit
|
90
90
|
|
91
91
|
def test_install_exit_handler_positive
|
92
|
-
NewRelic::LanguageSupport.expects(:
|
92
|
+
NewRelic::LanguageSupport.expects(:jruby?).returns(false)
|
93
93
|
self.expects(:sinatra_classic_app?).returns(false)
|
94
94
|
# we are overriding at_exit above, to immediately return, so we can
|
95
95
|
# test the shutdown logic. It's somewhat unfortunate, but we can't
|
@@ -109,10 +109,10 @@ class NewRelic::Agent::Agent::StartTest < Minitest::Test
|
|
109
109
|
|
110
110
|
def test_install_exit_handler_weird_ruby
|
111
111
|
with_config(:send_data_one_exit => true) do
|
112
|
-
NewRelic::LanguageSupport.expects(:
|
112
|
+
NewRelic::LanguageSupport.expects(:jruby?).returns(false)
|
113
113
|
self.expects(:sinatra_classic_app?).returns(true)
|
114
114
|
install_exit_handler
|
115
|
-
NewRelic::LanguageSupport.expects(:
|
115
|
+
NewRelic::LanguageSupport.expects(:jruby?).returns(true)
|
116
116
|
install_exit_handler
|
117
117
|
end
|
118
118
|
end
|
@@ -248,8 +248,8 @@ class AgentLoggerTest < Minitest::Test
|
|
248
248
|
|
249
249
|
def test_log_exception_gets_backtrace_for_system_stack_error
|
250
250
|
# This facility compensates for poor SystemStackError traces on MRI.
|
251
|
-
# JRuby
|
252
|
-
return if jruby?
|
251
|
+
# JRuby raises errors with good backtraces, so skip this test.
|
252
|
+
return if NewRelic::LanguageSupport.jruby?
|
253
253
|
|
254
254
|
logger = create_basic_logger
|
255
255
|
|
@@ -205,7 +205,7 @@ module NewRelic
|
|
205
205
|
nthreads.times do |tid|
|
206
206
|
t = Thread.new do
|
207
207
|
nmetrics.times do |mid|
|
208
|
-
@agent.stats_engine.
|
208
|
+
@agent.stats_engine.tl_record_unscoped_metrics("m#{mid}", 1)
|
209
209
|
end
|
210
210
|
end
|
211
211
|
t.abort_on_exception = true
|
@@ -265,7 +265,7 @@ module NewRelic
|
|
265
265
|
|
266
266
|
# This method should NOT increment error counts, since that has already
|
267
267
|
# been counted in the child
|
268
|
-
|
268
|
+
assert_metrics_not_recorded "Errors/all"
|
269
269
|
end
|
270
270
|
|
271
271
|
def test_harvest_and_send_analytic_event_data_merges_in_samples_on_failure
|
@@ -131,10 +131,9 @@ class AttributeProcessingTest < Minitest::Test
|
|
131
131
|
},
|
132
132
|
NewRelic::Agent::AttributeProcessing.flatten_and_coerce(
|
133
133
|
{
|
134
|
-
|
135
|
-
'
|
136
|
-
'
|
137
|
-
'ninf' => -1.0 / 0.0
|
134
|
+
'nan' => Float::NAN,
|
135
|
+
'inf' => Float::INFINITY,
|
136
|
+
'ninf' => -Float::INFINITY
|
138
137
|
}
|
139
138
|
)
|
140
139
|
)
|
@@ -130,12 +130,10 @@ class AuditLoggerTest < Minitest::Test
|
|
130
130
|
|
131
131
|
def test_logs_json_with_json_marshaller
|
132
132
|
marshaller_cls = NewRelic::Agent::NewRelicService::JsonMarshaller
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
assert_audit_log_contains_object(read_log_body, @dummy_data, :json)
|
138
|
-
end
|
133
|
+
setup_fake_logger
|
134
|
+
json_marshaller = marshaller_cls.new
|
135
|
+
@logger.log_request(@uri, @dummy_data, json_marshaller)
|
136
|
+
assert_audit_log_contains_object(read_log_body, @dummy_data, :json)
|
139
137
|
end
|
140
138
|
|
141
139
|
def test_allows_through_endpoints
|