Class: Errplane::Configuration

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

Constant Summary collapse

DEFAULTS =
{
  :app_host => "app.errplane.com",
  :api_udp_host => "udp.apiv3.errplane.com",
  :api_udp_port => 8126,
  :api_http_read_host => "r.apiv3.errplane.com",
  :api_http_write_host => "w.apiv3.errplane.com",
  :ignored_exceptions => %w{ActiveRecord::RecordNotFound
                            ActionController::RoutingError},
  :ignored_exception_messages => [],
  :ignored_reports => [],
  :ignored_environments => %w{test cucumber selenium},
  :ignored_user_agents => %w{GoogleBot},
  :environment_variable_filters => [
    /password/i,
    /key/i,
    /secret/i,
    /ps1/i,
    /rvm_.*_clr/i,
    /color/i
  ],
  :backtrace_filters => [
    lambda { |line| line.gsub(/^\.\//, "") },
    lambda { |line|
      return line if Errplane.configuration.application_root.to_s.empty?
      line.gsub(/#{Errplane.configuration.application_root}/, "[APP_ROOT]")
    },
    lambda { |line|
      if defined?(Gem) && !Gem.path.nil? && !Gem.path.empty?
        Gem.path.each { |path| line = line.gsub(/#{path}/, "[GEM_ROOT]") }
      end
      line
    }
  ]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/errplane/configuration.rb', line 73

def initialize
  @api_udp_host = DEFAULTS[:api_udp_host]
  @api_udp_port = DEFAULTS[:api_udp_port]
  @api_http_read_host = DEFAULTS[:api_http_read_host]
  @api_http_write_host = DEFAULTS[:api_http_write_host]
  @app_host = DEFAULTS[:app_host]
  @ignored_exceptions = DEFAULTS[:ignored_exceptions].dup
  @ignored_exception_messages = DEFAULTS[:ignored_exception_messages].dup
  @ignored_reports = DEFAULTS[:ignored_reports].dup
  @ignored_environments = DEFAULTS[:ignored_environments].dup
  @ignored_user_agents = DEFAULTS[:ignored_user_agents].dup
  @backtrace_filters = DEFAULTS[:backtrace_filters].dup
  @environment_variable_filters = DEFAULTS[:environment_variable_filters]
  @aggregated_exception_classes = []
  @debug = false
  @rescue_global_exceptions = false
  @instrumentation_enabled = true
  @queue_worker_threads = 3
  @queue_worker_polling_interval = 5
  @queue_maximum_depth = 10_000
  @queue_maximum_post = 500
end

Instance Attribute Details

#aggregated_exception_classesObject

Returns the value of attribute aggregated_exception_classes.



25
26
27
# File 'lib/errplane/configuration.rb', line 25

def aggregated_exception_classes
  @aggregated_exception_classes
end

#api_http_read_hostObject

Returns the value of attribute api_http_read_host.



6
7
8
# File 'lib/errplane/configuration.rb', line 6

def api_http_read_host
  @api_http_read_host
end

#api_http_write_hostObject

Returns the value of attribute api_http_write_host.



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

def api_http_write_host
  @api_http_write_host
end

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/errplane/configuration.rb', line 3

def api_key
  @api_key
end

#api_udp_hostObject

Returns the value of attribute api_udp_host.



4
5
6
# File 'lib/errplane/configuration.rb', line 4

def api_udp_host
  @api_udp_host
end

#api_udp_portObject

Returns the value of attribute api_udp_port.



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

def api_udp_port
  @api_udp_port
end

#app_hostObject

Returns the value of attribute app_host.



8
9
10
# File 'lib/errplane/configuration.rb', line 8

def app_host
  @app_host
end

#application_idObject

Returns the value of attribute application_id.



9
10
11
# File 'lib/errplane/configuration.rb', line 9

def application_id
  @application_id
end

#application_nameObject

Returns the value of attribute application_name.



10
11
12
# File 'lib/errplane/configuration.rb', line 10

def application_name
  @application_name
end

#application_rootObject

Returns the value of attribute application_root.



11
12
13
# File 'lib/errplane/configuration.rb', line 11

def application_root
  @application_root
end

#backtrace_filtersObject

Returns the value of attribute backtrace_filters.



24
25
26
# File 'lib/errplane/configuration.rb', line 24

def backtrace_filters
  @backtrace_filters
end

#debugObject

Returns the value of attribute debug.



30
31
32
# File 'lib/errplane/configuration.rb', line 30

def debug
  @debug
end

#environmentObject

Returns the value of attribute environment.



14
15
16
# File 'lib/errplane/configuration.rb', line 14

def environment
  @environment
end

#environment_variable_filtersObject

Returns the value of attribute environment_variable_filters.



27
28
29
# File 'lib/errplane/configuration.rb', line 27

def environment_variable_filters
  @environment_variable_filters
end

#environment_variablesObject

Returns the value of attribute environment_variables.



26
27
28
# File 'lib/errplane/configuration.rb', line 26

def environment_variables
  @environment_variables
end

#frameworkObject

Returns the value of attribute framework.



15
16
17
# File 'lib/errplane/configuration.rb', line 15

def framework
  @framework
end

#framework_versionObject

Returns the value of attribute framework_version.



16
17
18
# File 'lib/errplane/configuration.rb', line 16

def framework_version
  @framework_version
end

#ignored_environmentsObject

Returns the value of attribute ignored_environments.



22
23
24
# File 'lib/errplane/configuration.rb', line 22

def ignored_environments
  @ignored_environments
end

#ignored_exception_messagesObject

Returns the value of attribute ignored_exception_messages.



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

def ignored_exception_messages
  @ignored_exception_messages
end

#ignored_exceptionsObject

Returns the value of attribute ignored_exceptions.



19
20
21
# File 'lib/errplane/configuration.rb', line 19

def ignored_exceptions
  @ignored_exceptions
end

#ignored_reportsObject

Returns the value of attribute ignored_reports.



21
22
23
# File 'lib/errplane/configuration.rb', line 21

def ignored_reports
  @ignored_reports
end

#ignored_user_agentsObject

Returns the value of attribute ignored_user_agents.



23
24
25
# File 'lib/errplane/configuration.rb', line 23

def ignored_user_agents
  @ignored_user_agents
end

#instrumentation_enabledObject

Returns the value of attribute instrumentation_enabled.



29
30
31
# File 'lib/errplane/configuration.rb', line 29

def instrumentation_enabled
  @instrumentation_enabled
end

#languageObject

Returns the value of attribute language.



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

def language
  @language
end

#language_versionObject

Returns the value of attribute language_version.



18
19
20
# File 'lib/errplane/configuration.rb', line 18

def language_version
  @language_version
end

#loggerObject

Returns the value of attribute logger.



13
14
15
# File 'lib/errplane/configuration.rb', line 13

def logger
  @logger
end

#queue_maximum_depthObject

Returns the value of attribute queue_maximum_depth.



35
36
37
# File 'lib/errplane/configuration.rb', line 35

def queue_maximum_depth
  @queue_maximum_depth
end

#queue_maximum_postObject

Returns the value of attribute queue_maximum_post.



36
37
38
# File 'lib/errplane/configuration.rb', line 36

def queue_maximum_post
  @queue_maximum_post
end

#queue_worker_polling_intervalObject

Returns the value of attribute queue_worker_polling_interval.



34
35
36
# File 'lib/errplane/configuration.rb', line 34

def queue_worker_polling_interval
  @queue_worker_polling_interval
end

#queue_worker_threadsObject

Returns the value of attribute queue_worker_threads.



33
34
35
# File 'lib/errplane/configuration.rb', line 33

def queue_worker_threads
  @queue_worker_threads
end

#reraise_global_exceptionsObject

Returns the value of attribute reraise_global_exceptions.



31
32
33
# File 'lib/errplane/configuration.rb', line 31

def reraise_global_exceptions
  @reraise_global_exceptions
end

Instance Method Details

#add_custom_exception_data(exception_presenter) ⇒ Object



121
122
123
# File 'lib/errplane/configuration.rb', line 121

def add_custom_exception_data(exception_presenter)
  @custom_exception_data_handler.call(exception_presenter) if @custom_exception_data_handler
end

#database_nameObject



125
126
127
# File 'lib/errplane/configuration.rb', line 125

def database_name
  @application_id.to_s + @environment.to_s
end

#debug?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/errplane/configuration.rb', line 96

def debug?
  !!@debug
end

#define_custom_exception_data(&block) ⇒ Object



117
118
119
# File 'lib/errplane/configuration.rb', line 117

def define_custom_exception_data(&block)
  @custom_exception_data_handler = block
end

#ignore_current_environment?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/errplane/configuration.rb', line 113

def ignore_current_environment?
  self.ignored_environments.include?(self.environment)
end

#ignore_user_agent?(incoming_user_agent) ⇒ Boolean

Returns:

  • (Boolean)


108
109
110
111
# File 'lib/errplane/configuration.rb', line 108

def ignore_user_agent?(incoming_user_agent)
  return false if self.ignored_user_agents.nil?
  self.ignored_user_agents.any? {|agent| incoming_user_agent =~ /#{agent}/}
end

#instrumentation_enabled?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/errplane/configuration.rb', line 100

def instrumentation_enabled?
  !!@instrumentation_enabled
end

#reraise_global_exceptions?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/errplane/configuration.rb', line 104

def reraise_global_exceptions?
  !!@reraise_global_exceptions
end