lib/elastic_apm/config.rb in elastic-apm-1.0.1 vs lib/elastic_apm/config.rb in elastic-apm-1.0.2

- old
+ new

@@ -40,11 +40,14 @@ source_lines_error_library_frames: 0, source_lines_span_library_frames: 0, span_frames_min_duration: 5, disabled_spies: %w[json], + instrumented_rake_tasks: [], + default_tags: {}, + current_user_id_method: :id, current_user_email_method: :email, current_user_username_method: :username, custom_key_filters: [], @@ -93,11 +96,15 @@ [:float, 'transaction_sample_rate'], 'ELASTIC_APM_VERIFY_SERVER_CERT' => [:bool, 'verify_server_cert'], 'ELASTIC_APM_TRANSACTION_MAX_SPANS' => [:int, 'transaction_max_spans'], 'ELASTIC_APM_DISABLE_SEND' => [:bool, 'disable_send'], - 'ELASTIC_APM_DISABLED_SPIES' => [:list, 'disabled_spies'] + 'ELASTIC_APM_DISABLED_SPIES' => [:list, 'disabled_spies'], + 'ELASTIC_APM_INSTRUMENTED_RAKE_TASKS' => + [:list, 'instrumented_rake_tasks'], + + 'ELASTIC_APM_DEFAULT_TAGS' => [:dict, 'default_tags'] }.freeze def initialize(options = {}) set_defaults @@ -151,25 +158,28 @@ attr_accessor :source_lines_error_library_frames attr_accessor :source_lines_span_library_frames attr_accessor :span_frames_min_duration attr_accessor :disabled_spies + attr_accessor :instrumented_rake_tasks attr_accessor :view_paths attr_accessor :root_path attr_accessor :current_user_method attr_accessor :current_user_id_method attr_accessor :current_user_email_method attr_accessor :current_user_username_method + attr_accessor :default_tags + attr_reader :custom_key_filters attr_reader :ignore_url_patterns alias :disable_environment_warning? :disable_environment_warning - alias :verify_server_cert? :verify_server_cert alias :disable_send? :disable_send + alias :verify_server_cert? :verify_server_cert def app=(app) case app_type?(app) when :sinatra set_sinatra(app) @@ -180,11 +190,11 @@ self.service_name = 'ruby' end end def app_type?(app) - if defined?(::Rails) && app.is_a?(Rails::Application) + if defined?(Rails::Application) && app.is_a?(Rails::Application) return :rails end if app.is_a?(Class) && app.superclass.to_s == 'Sinatra::Base' return :sinatra @@ -217,10 +227,11 @@ redis sequel sidekiq sinatra tilt + rake ] end # rubocop:enable Metrics/MethodLength def enabled_spies @@ -250,9 +261,10 @@ case type when :int then value.to_i when :float then value.to_f when :bool then !%w[0 false].include?(value.strip.downcase) when :list then value.split(/[ ,]/) + when :dict then Hash[value.split('&').map { |kv| kv.split('=') }] else value end send("#{key}=", value) end