diff --git a/lib/new_relic/agent/agent.rb b/lib/new_relic/agent/agent.rb index 0c746b1869..ebcfa384c0 100644 --- a/lib/new_relic/agent/agent.rb +++ b/lib/new_relic/agent/agent.rb @@ -1048,7 +1048,7 @@ def harvest_and_send_slowest_sql # FIXME add the code to try to resend if our connection is down sql_traces = @sql_sampler.harvest unless sql_traces.empty? - log.debug "Sending (#{sql_traces.count}) sql traces" + log.debug "Sending (#{sql_traces.size}) sql traces" begin response = invoke_remote :sql_trace_data, sql_traces # log.debug "Sql trace response: #{response}" diff --git a/lib/new_relic/agent/sql_sampler.rb b/lib/new_relic/agent/sql_sampler.rb index d54baac6ec..629916f277 100644 --- a/lib/new_relic/agent/sql_sampler.rb +++ b/lib/new_relic/agent/sql_sampler.rb @@ -95,9 +95,9 @@ def notice_scope_empty(time=Time.now) data = transaction_data clear_transaction_data - if data.sql_data.count > 0 + if data.sql_data.size > 0 @samples_lock.synchronize do - NewRelic::Agent.instance.log.debug "Harvesting #{data.sql_data.count} slow transaction sql statement(s)" + NewRelic::Agent.instance.log.debug "Harvesting #{data.sql_data.size} slow transaction sql statement(s)" #FIXME get tx name and uri harvest_slow_sql data end diff --git a/lib/new_relic/data_serialization.rb b/lib/new_relic/data_serialization.rb index f0a1c25ba6..f02c36ecf1 100644 --- a/lib/new_relic/data_serialization.rb +++ b/lib/new_relic/data_serialization.rb @@ -14,7 +14,8 @@ module ClassMethods # (handled elsewhere) def should_send_data? NewRelic::Control.instance.disable_serialization? || store_too_large? || - store_too_old? || pid_too_old? + store_too_old? || pid_too_old? || + NewRelic::LanguageSupport.using_version?('1.8.6') rescue Exception => e NewRelic::Control.instance.disable_serialization = true NewRelic::Control.instance.log.warn("Disabling serialization: #{e.message}") diff --git a/test/new_relic/agent/instrumentation/queue_time_test.rb b/test/new_relic/agent/instrumentation/queue_time_test.rb index 423846ace2..fd52d0c9b2 100644 --- a/test/new_relic/agent/instrumentation/queue_time_test.rb +++ b/test/new_relic/agent/instrumentation/queue_time_test.rb @@ -270,20 +270,15 @@ def test_record_rollup_queue_stat_no_data check_metric_time('WebFrontend/QueueTime', 0.0, 0.001) end - - # check all the combinations to make sure that ordering doesn't - # affect the return value def test_find_oldest_time - test_arrays = [ + test_array = [ + ['c', Time.at(1002)], ['a', Time.at(1000)], ['b', Time.at(1001)], - ['c', Time.at(1002)], ['d', Time.at(1000)], ] - test_arrays = test_arrays.permutation - test_arrays.each do |test_array| - assert_equal find_oldest_time(test_array), Time.at(1000), "Should be the oldest time in the array" - end + assert_equal(find_oldest_time(test_array), Time.at(1000), + "Should be the oldest time in the array") end # trivial test but the method doesn't do much diff --git a/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb b/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb index 6bddc5c897..d1595073df 100644 --- a/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +++ b/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb @@ -104,7 +104,7 @@ def test_check_for_illegal_keys_positive end def test_check_for_illegal_keys_negative - test_keys = Hash[ALLOWED_KEYS.map {|x| [x, nil]}] + test_keys = Hash[*ALLOWED_KEYS.map {|x| [x, nil]}.flatten] check_for_illegal_keys!(test_keys) end diff --git a/test/new_relic/agent/rpm_agent_test.rb b/test/new_relic/agent/rpm_agent_test.rb index d7e2f28958..a9cc2c9b11 100644 --- a/test/new_relic/agent/rpm_agent_test.rb +++ b/test/new_relic/agent/rpm_agent_test.rb @@ -82,7 +82,7 @@ class NewRelic::Agent::RpmAgentTest < Test::Unit::TestCase # ActiveSupport::Test should "send_timeslice_data" do # this test fails due to a rubinius bug - return if (RUBY_DESCRIPTION =~ /rubinius/i) + return if NewRelic::LanguageSupport.using_engine?('rbx') @agent.expects(:invoke_remote).returns({NewRelic::MetricSpec.new("/A/b/c") => 1, NewRelic::MetricSpec.new("/A/b/c", "/X") => 2, NewRelic::MetricSpec.new("/A/b/d") => 3 }.to_a) @agent.send :harvest_and_send_timeslice_data assert_equal 3, @agent.metric_ids.size diff --git a/test/new_relic/agent/sql_sampler_test.rb b/test/new_relic/agent/sql_sampler_test.rb index 8b7b320643..b2c44235bd 100644 --- a/test/new_relic/agent/sql_sampler_test.rb +++ b/test/new_relic/agent/sql_sampler_test.rb @@ -31,7 +31,7 @@ def test_notice_sql # this sql will not be captured @sampler.notice_sql "select * from test", "Database/test/select", nil, 0 assert_not_nil @sampler.transaction_data - assert_equal 2, @sampler.transaction_data.sql_data.count + assert_equal 2, @sampler.transaction_data.sql_data.size end def test_harvest_slow_sql @@ -45,7 +45,7 @@ def test_harvest_slow_sql ] @sampler.harvest_slow_sql data - assert_equal 2, @sampler.sql_traces.count + assert_equal 2, @sampler.sql_traces.size end def test_sql_aggregation @@ -73,7 +73,7 @@ def test_harvest @sampler.harvest_slow_sql data sql_traces = @sampler.harvest - assert_equal 2, sql_traces.count + assert_equal 2, sql_traces.size end def test_harvest_should_not_take_more_than_10 @@ -104,7 +104,7 @@ def test_harvest_should_aggregate_similar_queries @sampler.harvest_slow_sql data sql_traces = @sampler.harvest - assert_equal 2, sql_traces.count + assert_equal 2, sql_traces.size end def test_harvest_should_collect_explain_plans diff --git a/test/new_relic/data_serialization_test.rb b/test/new_relic/data_serialization_test.rb index a996e8e12c..c75fe40e89 100644 --- a/test/new_relic/data_serialization_test.rb +++ b/test/new_relic/data_serialization_test.rb @@ -151,6 +151,7 @@ def test_pid_age_creates_pid_file_if_none_exists end def test_loading_does_not_seg_fault_if_gc_triggers + return if NewRelic::LanguageSupport.using_version?('1.8.6') require 'timeout' Thread.abort_on_exception = true