lib/elastic_apm/config.rb in elastic-apm-0.5.0 vs lib/elastic_apm/config.rb in elastic-apm-0.5.1

- old
+ new

@@ -40,11 +40,11 @@ source_lines_error_app_frames: 5, source_lines_span_app_frames: 5, source_lines_error_library_frames: 0, source_lines_span_library_frames: 0, - enabled_injectors: %w[net_http], + disabled_injectors: %w[], current_user_id_method: :id, current_user_email_method: :email, current_user_username_method: :username, @@ -76,11 +76,13 @@ 'ELASTIC_APM_MAX_QUEUE_SIZE' => [:int, 'max_queue_size'], 'ELASTIC_APM_FLUSH_INTERVAL' => 'flush_interval', 'ELASTIC_APM_TRANSACTION_SAMPLE_RATE' => [:float, 'transaction_sample_rate'], 'ELASTIC_APM_VERIFY_SERVER_CERT' => [:bool, 'verify_server_cert'], - 'ELASTIC_APM_TRANSACTION_MAX_SPANS' => [:int, 'transaction_max_spans'] + 'ELASTIC_APM_TRANSACTION_MAX_SPANS' => [:int, 'transaction_max_spans'], + + 'ELASTIC_APM_DISABLED_INJECTORS' => [:list, 'disabled_injectors'] }.freeze def initialize(options = {}) set_defaults @@ -123,11 +125,11 @@ attr_accessor :source_lines_error_app_frames attr_accessor :source_lines_span_app_frames attr_accessor :source_lines_error_library_frames attr_accessor :source_lines_span_library_frames - attr_accessor :enabled_injectors + attr_accessor :disabled_injectors attr_accessor :view_paths attr_accessor :root_path attr_accessor :current_user_method @@ -169,10 +171,31 @@ def logger=(logger) @logger = logger || build_logger(log_path, log_level) end + # rubocop:disable Metrics/MethodLength + def available_injectors + %w[ + action_dispatch + delayed_job + elasticsearch + json + net_http + redis + sequel + sidekiq + sinatra + tilt + ] + end + # rubocop:enable Metrics/MethodLength + + def enabled_injectors + available_injectors - disabled_injectors + end + private def assign(options) options.each do |key, value| send("#{key}=", value) @@ -215,10 +238,9 @@ def set_sinatra(app) self.service_name = format_name(service_name || app.to_s) self.framework_name = framework_name || 'Sinatra' self.framework_version = framework_version || Sinatra::VERSION - self.enabled_injectors += %w[sinatra] self.root_path = Dir.pwd end def set_rails(app) # rubocop:disable Metrics/AbcSize self.service_name ||= format_name(service_name || app.class.parent_name)