Class: Raven::Configuration
- Inherits:
-
Object
- Object
- Raven::Configuration
- Defined in:
- lib/raven/configuration.rb
Constant Summary collapse
- IGNORE_DEFAULT =
['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', 'ActionController::InvalidAuthenticityToken', 'CGI::Session::CookieStore::TamperedWithCookie', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound', 'Mongoid::Errors::DocumentNotFound']
Instance Attribute Summary collapse
-
#app_dirs_pattern ⇒ Object
Exceptions from these directories to be ignored.
-
#async ⇒ Object
(also: #async?)
Optional Proc to be used to send events asynchronously.
-
#catch_debugged_exceptions ⇒ Object
Catch exceptions before they’re been processed by ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions.
-
#context_lines ⇒ Object
Number of lines of code context to capture, or nil for none.
-
#current_environment ⇒ Object
Returns the value of attribute current_environment.
-
#encoding ⇒ Object
Encoding type for event bodies.
-
#environments ⇒ Object
Whitelist of environments that will send notifications to Sentry.
-
#excluded_exceptions ⇒ Object
Which exceptions should never be sent.
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_adapter ⇒ Object
The Faraday adapter to be used.
-
#json_adapter ⇒ Object
DEPRECATED: This option is now ignored as we use our own adapter.
-
#logger ⇒ Object
Logger to use internally.
-
#open_timeout ⇒ Object
Timeout waiting for the connection to open in seconds.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#processors ⇒ Object
Processors to run on data before sending upstream.
-
#project_id ⇒ Object
Project ID number to send to the Sentry server.
-
#project_root ⇒ Object
Project directory root.
-
#public_key ⇒ Object
Public key for authentication with the Sentry server.
-
#sanitize_fields ⇒ Object
additional fields to sanitize.
-
#scheme ⇒ Object
Accessors for the component parts of the DSN.
-
#secret_key ⇒ Object
Secret key for authentication with the Sentry server.
-
#send_modules ⇒ Object
Include module versions in reports?.
-
#server ⇒ Object
Simple server string (setter provided below).
-
#server_name ⇒ Object
Returns the value of attribute server_name.
-
#should_send ⇒ Object
Provide a configurable callback to block or send events.
-
#ssl ⇒ Object
Ssl settings passed direactly to faraday’s ssl option.
-
#ssl_verification ⇒ Object
Should the SSL certificate of the server be verified?.
-
#tags ⇒ Object
Default tags for events.
-
#timeout ⇒ Object
Timeout when waiting for the server to return data in seconds.
Instance Method Summary collapse
-
#[](option) ⇒ Object
Allows config options to be read like a hash.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #log_excluded_environment_message ⇒ Object
- #send_in_current_environment? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/raven/configuration.rb', line 98 def initialize self.server = ENV['SENTRY_DSN'] if ENV['SENTRY_DSN'] @context_lines = 3 self.current_environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'default' self.send_modules = true self.excluded_exceptions = IGNORE_DEFAULT self.processors = [Raven::Processor::RemoveCircularReferences, Raven::Processor::UTF8Conversion, Raven::Processor::SanitizeData] self.ssl_verification = false self.encoding = 'gzip' self.timeout = 1 self.open_timeout = 1 self. = {} self.async = false self.catch_debugged_exceptions = true self.sanitize_fields = [] end |
Instance Attribute Details
#app_dirs_pattern ⇒ Object
Exceptions from these directories to be ignored
78 79 80 |
# File 'lib/raven/configuration.rb', line 78 def app_dirs_pattern @app_dirs_pattern end |
#async ⇒ Object Also known as: async?
Optional Proc to be used to send events asynchronously.
75 76 77 |
# File 'lib/raven/configuration.rb', line 75 def async @async end |
#catch_debugged_exceptions ⇒ Object
Catch exceptions before they’re been processed by ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions
82 83 84 |
# File 'lib/raven/configuration.rb', line 82 def catch_debugged_exceptions @catch_debugged_exceptions end |
#context_lines ⇒ Object
Number of lines of code context to capture, or nil for none
35 36 37 |
# File 'lib/raven/configuration.rb', line 35 def context_lines @context_lines end |
#current_environment ⇒ Object
Returns the value of attribute current_environment.
61 62 63 |
# File 'lib/raven/configuration.rb', line 61 def current_environment @current_environment end |
#encoding ⇒ Object
Encoding type for event bodies
29 30 31 |
# File 'lib/raven/configuration.rb', line 29 def encoding @encoding end |
#environments ⇒ Object
Whitelist of environments that will send notifications to Sentry
38 39 40 |
# File 'lib/raven/configuration.rb', line 38 def environments @environments end |
#excluded_exceptions ⇒ Object
Which exceptions should never be sent
44 45 46 |
# File 'lib/raven/configuration.rb', line 44 def excluded_exceptions @excluded_exceptions end |
#host ⇒ Object
Returns the value of attribute host.
18 19 20 |
# File 'lib/raven/configuration.rb', line 18 def host @host end |
#http_adapter ⇒ Object
The Faraday adapter to be used. Will default to Net::HTTP when not set.
64 65 66 |
# File 'lib/raven/configuration.rb', line 64 def http_adapter @http_adapter end |
#json_adapter ⇒ Object
DEPRECATED: This option is now ignored as we use our own adapter.
69 70 71 |
# File 'lib/raven/configuration.rb', line 69 def json_adapter @json_adapter end |
#logger ⇒ Object
Logger to use internally
32 33 34 |
# File 'lib/raven/configuration.rb', line 32 def logger @logger end |
#open_timeout ⇒ Object
Timeout waiting for the connection to open in seconds
53 54 55 |
# File 'lib/raven/configuration.rb', line 53 def open_timeout @open_timeout end |
#path ⇒ Object
Returns the value of attribute path.
20 21 22 |
# File 'lib/raven/configuration.rb', line 20 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
19 20 21 |
# File 'lib/raven/configuration.rb', line 19 def port @port end |
#processors ⇒ Object
Processors to run on data before sending upstream
47 48 49 |
# File 'lib/raven/configuration.rb', line 47 def processors @processors end |
#project_id ⇒ Object
Project ID number to send to the Sentry server
23 24 25 |
# File 'lib/raven/configuration.rb', line 23 def project_id @project_id end |
#project_root ⇒ Object
Project directory root
26 27 28 |
# File 'lib/raven/configuration.rb', line 26 def project_root @project_root end |
#public_key ⇒ Object
Public key for authentication with the Sentry server
11 12 13 |
# File 'lib/raven/configuration.rb', line 11 def public_key @public_key end |
#sanitize_fields ⇒ Object
additional fields to sanitize
88 89 90 |
# File 'lib/raven/configuration.rb', line 88 def sanitize_fields @sanitize_fields end |
#scheme ⇒ Object
Accessors for the component parts of the DSN
17 18 19 |
# File 'lib/raven/configuration.rb', line 17 def scheme @scheme end |
#secret_key ⇒ Object
Secret key for authentication with the Sentry server
14 15 16 |
# File 'lib/raven/configuration.rb', line 14 def secret_key @secret_key end |
#send_modules ⇒ Object
Include module versions in reports?
41 42 43 |
# File 'lib/raven/configuration.rb', line 41 def send_modules @send_modules end |
#server ⇒ Object
Simple server string (setter provided below)
8 9 10 |
# File 'lib/raven/configuration.rb', line 8 def server @server end |
#server_name ⇒ Object
Returns the value of attribute server_name.
66 67 68 |
# File 'lib/raven/configuration.rb', line 66 def server_name @server_name end |
#should_send ⇒ Object
Provide a configurable callback to block or send events
85 86 87 |
# File 'lib/raven/configuration.rb', line 85 def should_send @should_send end |
#ssl ⇒ Object
Ssl settings passed direactly to faraday’s ssl option
59 60 61 |
# File 'lib/raven/configuration.rb', line 59 def ssl @ssl end |
#ssl_verification ⇒ Object
Should the SSL certificate of the server be verified?
56 57 58 |
# File 'lib/raven/configuration.rb', line 56 def ssl_verification @ssl_verification end |
#tags ⇒ Object
Default tags for events
72 73 74 |
# File 'lib/raven/configuration.rb', line 72 def @tags end |
#timeout ⇒ Object
Timeout when waiting for the server to return data in seconds
50 51 52 |
# File 'lib/raven/configuration.rb', line 50 def timeout @timeout end |
Instance Method Details
#[](option) ⇒ Object
Allows config options to be read like a hash
154 155 156 |
# File 'lib/raven/configuration.rb', line 154 def [](option) send(option) end |
#log_excluded_environment_message ⇒ Object
170 171 172 |
# File 'lib/raven/configuration.rb', line 170 def Raven.logger.debug "Event not sent due to excluded environment: #{current_environment}" end |
#send_in_current_environment? ⇒ Boolean
162 163 164 165 166 167 168 |
# File 'lib/raven/configuration.rb', line 162 def send_in_current_environment? if environments environments.include?(current_environment) else true end end |