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

- old
+ new

@@ -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 @sql_sampler.config.fetch('enabled', true) && ['raw', 'obfuscated'].include?(@sql_sampler.config.fetch('record_sql', 'obfuscated').to_s) + if @sql_sampler.config.fetch('enabled', true) && ['raw', 'obfuscated'].include?(@sql_sampler.config.fetch('record_sql', 'obfuscated').to_s) && @transaction_sampler.config.fetch('enabled', true) @sql_sampler.enable else @sql_sampler.disable end end @@ -756,26 +756,29 @@ # 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) + @should_send_samples = @config_should_send_samples = @transaction_sampler.config.fetch('enabled', true) + @should_send_random_samples = @transaction_sampler.config.fetch('random_sample', false) 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 + @slowest_transaction_threshold = @transaction_sampler.config.fetch('transaction_threshold', 2.0).to_f @slowest_transaction_threshold = apdex_f if apdex_f_threshold? end # Enables or disables the transaction tracer and sets its # options based on the options provided to the # method. def configure_transaction_tracer!(server_enabled, sample_rate) # Ask the server for permission to send transaction samples. # determined by subscription license. + @transaction_sampler.config['enabled'] = server_enabled + @sql_sampler.disable unless @transaction_sampler.config['enabled'] + @should_send_samples = @config_should_send_samples && server_enabled if @should_send_samples # I don't think this is ever true, but... enable_random_samples!(sample_rate) if @should_send_random_samples @@ -793,19 +796,19 @@ # If the transaction threshold is set to the string # 'apdex_f', we use 4 times the apdex_t value to record # transactions. This gears well with using apdex since you # will attempt to send any transactions that register as 'failing' def apdex_f_threshold? - sampler_config.fetch('transaction_threshold', '') =~ /apdex_f/i + @transaction_sampler.config.fetch('transaction_threshold', '') =~ /apdex_f/i end # Sets the sql recording configuration by trying to detect # any attempt to disable the sql collection - 'off', # 'false', 'none', and friends. Otherwise, we accept 'raw', # and unrecognized values default to 'obfuscated' def set_sql_recording! - record_sql_config = sampler_config.fetch('record_sql', :obfuscated) + record_sql_config = @transaction_sampler.config.fetch('record_sql', :obfuscated) case record_sql_config.to_s when 'off' @record_sql = :off when 'none' @record_sql = :off @@ -822,14 +825,9 @@ # Warn the user when we are sending raw sql across the wire # - they should probably be using ssl when this is true def log_sql_transmission_warning? 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 - 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