Class: AppPerfRpm::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/app_perf_rpm/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



20
21
22
# File 'lib/app_perf_rpm/configuration.rb', line 20

def initialize
  reload
end

Instance Attribute Details

#agent_disabledObject

Returns the value of attribute agent_disabled.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def agent_disabled
  @agent_disabled
end

#app_rootObject

Returns the value of attribute app_root.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def app_root
  @app_root
end

#application_nameObject

Returns the value of attribute application_name.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def application_name
  @application_name
end

#flush_intervalObject

Returns the value of attribute flush_interval.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def flush_interval
  @flush_interval
end

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def host
  @host
end

#ignore_pathsObject

Returns the value of attribute ignore_paths.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def ignore_paths
  @ignore_paths
end

#instrumentationObject

Returns the value of attribute instrumentation.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def instrumentation
  @instrumentation
end

#license_keyObject

Returns the value of attribute license_key.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def license_key
  @license_key
end

#portObject

Returns the value of attribute port.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def port
  @port
end

#sample_rateObject

Returns the value of attribute sample_rate.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def sample_rate
  @sample_rate
end

#sample_thresholdObject

Returns the value of attribute sample_threshold.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def sample_threshold
  @sample_threshold
end

#sslObject

Returns the value of attribute ssl.



7
8
9
# File 'lib/app_perf_rpm/configuration.rb', line 7

def ssl
  @ssl
end

Instance Method Details

#reloadObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/app_perf_rpm/configuration.rb', line 24

def reload
  ::AppPerfRpm.mutex.synchronize do
    self.app_root = app_root ? Pathname.new(app_root.to_s) : nil
    self.host ||= default_if_blank(ENV["APP_PERF_HOST"], "http://localhost:5000")
    self.ssl ||= false
    self.license_key ||= default_if_blank(ENV["APP_PERF_LICENSE_KEY"], nil)
    self.application_name ||= "Default"
    self.sample_rate ||= 10 # Percentage of request to sample
    self.sample_threshold ||= 0 # Minimum amount of duration to sample
    self.flush_interval ||= 60 # In seconds
    self.agent_disabled ||= default_if_blank(ENV["APP_PERF_AGENT_DISABLED"], false)
    self.ignore_paths ||= /\/assets/
    self.instrumentation = {
      :rack                    => { :enabled => true, :backtrace => :app, :source => true, :trace_middleware => false },
      :roda                    => { :enabled => true, :backtrace => :app, :source => true },
      :grape                   => { :enabled => true, :backtrace => :app, :source => true },
      :active_record           => { :enabled => true, :backtrace => :app, :source => true },
      :active_record_import    => { :enabled => true, :backtrace => :app, :source => true },
      :active_model_serializer => { :enabled => true, :backtrace => :app, :source => true },
      :action_view             => { :enabled => true, :backtrace => :app, :source => true },
      :action_controller       => { :enabled => true, :backtrace => :app, :source => true },
      :emque_consuming         => { :enabled => true, :backtrace => :app, :source => true },
      :redis                   => { :enabled => true, :backtrace => :app, :source => true },
      :sequel                  => { :enabled => true, :backtrace => :app, :source => true },
      :sidekiq                 => { :enabled => true, :backtrace => :app, :source => true },
      :sinatra                 => { :enabled => true, :backtrace => :app, :source => true },
      :net_http                => { :enabled => true, :backtrace => :app, :source => true },
      :typhoeus                => { :enabled => true, :backtrace => :app, :source => true },
      :faraday                 => { :enabled => true, :backtrace => :app, :source => true }
    }
  end
end