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.



17
18
19
# File 'lib/app_perf_rpm/configuration.rb', line 17

def initialize
  reload
end

Instance Attribute Details

#agent_disabledObject

Returns the value of attribute agent_disabled.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def agent_disabled
  @agent_disabled
end

#app_rootObject

Returns the value of attribute app_root.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def app_root
  @app_root
end

#application_nameObject

Returns the value of attribute application_name.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def application_name
  @application_name
end

#dispatch_intervalObject

Returns the value of attribute dispatch_interval.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def dispatch_interval
  @dispatch_interval
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def host
  @host
end

#instrumentationObject

Returns the value of attribute instrumentation.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def instrumentation
  @instrumentation
end

#license_keyObject

Returns the value of attribute license_key.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def license_key
  @license_key
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def port
  @port
end

#sample_rateObject

Returns the value of attribute sample_rate.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def sample_rate
  @sample_rate
end

#sample_thresholdObject

Returns the value of attribute sample_threshold.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def sample_threshold
  @sample_threshold
end

#sslObject

Returns the value of attribute ssl.



5
6
7
# File 'lib/app_perf_rpm/configuration.rb', line 5

def ssl
  @ssl
end

Instance Method Details

#reloadObject



21
22
23
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
# File 'lib/app_perf_rpm/configuration.rb', line 21

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.dispatch_interval ||= 60 # In seconds
    self.agent_disabled ||= default_if_blank(ENV["APP_PERF_AGENT_DISABLED"], false)
    self.instrumentation = {
      :rack                 => { :enabled => true, :backtrace => false, :trace_middleware => true },
      :active_record        => { :enabled => true, :backtrace => false },
      :active_record_import => { :enabled => true, :backtrace => false },
      :action_view          => { :enabled => true, :backtrace => false },
      :action_controller    => { :enabled => true, :backtrace => false },
      :emque_consuming      => { :enabled => true, :backtrace => false },
      :redis                => { :enabled => true, :backtrace => false },
      :sequel               => { :enabled => true, :backtrace => false },
      :sidekiq              => { :enabled => true, :backtrace => false },
      :sinatra              => { :enabled => true, :backtrace => false },
      :net_http             => { :enabled => true, :backtrace => false },
      :typhoeus             => { :enabled => true, :backtrace => false },
      :faraday              => { :enabled => true, :backtrace => false }
    }
  end
end