lib/new_relic/agent/agent.rb in newrelic_rpm-3.2.0.beta1 vs lib/new_relic/agent/agent.rb in newrelic_rpm-3.2.0.beta2

- old
+ new

@@ -327,12 +327,12 @@ end # we should not set an at_exit block if people are using # these as they don't do standard at_exit behavior per MRI/YARV def weird_ruby? - NewRelic::LanguageSupport.using_rubinius? || - NewRelic::LanguageSupport.using_jruby? || + NewRelic::LanguageSupport.using_engine?('rbx') || + NewRelic::LanguageSupport.using_engine?('jruby') || using_sinatra? end # Installs our exit handler, which exploits the weird # behavior of at_exit blocks to make sure it runs last, by @@ -467,11 +467,11 @@ end def check_sql_sampler_status # disable sql sampling if disabled by the server # and we're not in dev mode - if control.developer_mode? || @should_send_samples + if @sql_sampler.config.fetch('enabled', true) && ['raw', 'obfuscated'].include?(@sql_sampler.config.fetch('record_sql', 'obfuscated').to_s) @sql_sampler.enable else @sql_sampler.disable end end @@ -755,14 +755,13 @@ # sampler object, rather than here. We should pass in the # sampler config. def config_transaction_tracer # Reconfigure the transaction tracer @transaction_sampler.configure! + @sql_sampler.configure! @should_send_samples = @config_should_send_samples = sampler_config.fetch('enabled', true) @should_send_random_samples = sampler_config.fetch('random_sample', false) - @explain_threshold = sampler_config.fetch('explain_threshold', 0.5).to_f - @explain_enabled = sampler_config.fetch('explain_enabled', true) set_sql_recording! # default to 2.0, string 'apdex_f' will turn into your # apdex * 4 @slowest_transaction_threshold = sampler_config.fetch('transaction_threshold', 2.0).to_f @@ -827,11 +826,11 @@ log.warn("Agent is configured to send raw SQL to the service") if @record_sql == :raw end # gets the sampler configuration from the control object's settings def sampler_config - control.fetch('transaction_tracer', {}) + NewRelic::Control.instance.fetch('transaction_tracer', {}) end # Asks the collector to tell us which sub-collector we # should be reporting to, and then does the name resolution # on that host so we don't block on DNS during the normal @@ -1067,10 +1066,12 @@ now = Time.now log.debug "Sending (#{@traces.length}) transaction traces" begin options = { :keep_backtraces => true } options[:record_sql] = @record_sql unless @record_sql == :off - options[:explain_sql] = @explain_threshold if @explain_enabled + if @transaction_sampler.explain_enabled + options[:explain_sql] = @transaction_sampler.explain_threshold + end traces = @traces.collect {|trace| trace.prepare_to_send(options)} invoke_remote :transaction_sample_data, @agent_id, traces rescue PostTooBigException # we tried to send too much data, drop the first trace and # try again