Class: Rollbar::Configuration
- Inherits:
-
Object
- Object
- Rollbar::Configuration
- Defined in:
- lib/rollbar/configuration.rb
Constant Summary collapse
- SEND_EXTRA_FRAME_DATA_OPTIONS =
[:none, :app, :all].freeze
- DEFAULT_ENDPOINT =
'https://api.rollbar.com/api/1/item/'- DEFAULT_WEB_BASE =
'https://rollbar.com'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#async_handler ⇒ Object
Returns the value of attribute async_handler.
-
#before_process ⇒ Object
Returns the value of attribute before_process.
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#code_version ⇒ Object
Returns the value of attribute code_version.
-
#custom_data_method ⇒ Object
Returns the value of attribute custom_data_method.
-
#default_logger ⇒ Object
Returns the value of attribute default_logger.
-
#delayed_job_enabled ⇒ Object
Returns the value of attribute delayed_job_enabled.
-
#disable_core_monkey_patch ⇒ Object
Returns the value of attribute disable_core_monkey_patch.
-
#disable_monkey_patch ⇒ Object
Returns the value of attribute disable_monkey_patch.
-
#disable_rack_monkey_patch ⇒ Object
Returns the value of attribute disable_rack_monkey_patch.
-
#dj_threshold ⇒ Object
Returns the value of attribute dj_threshold.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#exception_level_filters ⇒ Object
Returns the value of attribute exception_level_filters.
-
#failover_handlers ⇒ Object
Returns the value of attribute failover_handlers.
-
#filepath ⇒ Object
Returns the value of attribute filepath.
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#ignored_person_ids ⇒ Object
Returns the value of attribute ignored_person_ids.
-
#js_enabled ⇒ Object
Returns the value of attribute js_enabled.
-
#js_options ⇒ Object
Returns the value of attribute js_options.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#net_retries ⇒ Object
Returns the value of attribute net_retries.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#payload_options ⇒ Object
Returns the value of attribute payload_options.
-
#person_email_method ⇒ Object
Returns the value of attribute person_email_method.
-
#person_id_method ⇒ Object
Returns the value of attribute person_id_method.
-
#person_method ⇒ Object
Returns the value of attribute person_method.
-
#person_username_method ⇒ Object
Returns the value of attribute person_username_method.
-
#populate_empty_backtraces ⇒ Object
Returns the value of attribute populate_empty_backtraces.
-
#project_gem_paths ⇒ Object
readonly
Returns the value of attribute project_gem_paths.
-
#randomize_scrub_length ⇒ Object
Returns the value of attribute randomize_scrub_length.
-
#report_dj_data ⇒ Object
Returns the value of attribute report_dj_data.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#root ⇒ Object
Returns the value of attribute root.
-
#safely ⇒ Object
(also: #safely?)
Returns the value of attribute safely.
-
#scrub_fields ⇒ Object
Returns the value of attribute scrub_fields.
-
#scrub_headers ⇒ Object
Returns the value of attribute scrub_headers.
-
#scrub_password ⇒ Object
Returns the value of attribute scrub_password.
-
#scrub_user ⇒ Object
Returns the value of attribute scrub_user.
-
#send_extra_frame_data ⇒ Object
Returns the value of attribute send_extra_frame_data.
-
#sidekiq_threshold ⇒ Object
Returns the value of attribute sidekiq_threshold.
-
#transform ⇒ Object
Returns the value of attribute transform.
-
#uncaught_exception_level ⇒ Object
Returns the value of attribute uncaught_exception_level.
-
#use_async ⇒ Object
Returns the value of attribute use_async.
-
#use_eventmachine ⇒ Object
Returns the value of attribute use_eventmachine.
-
#user_ip_obfuscator_secret ⇒ Object
Returns the value of attribute user_ip_obfuscator_secret.
-
#verify_ssl_peer ⇒ Object
Returns the value of attribute verify_ssl_peer.
-
#web_base ⇒ Object
Returns the value of attribute web_base.
-
#write_to_file ⇒ Object
Returns the value of attribute write_to_file.
Instance Method Summary collapse
-
#[](option) ⇒ Object
allow params to be read like a hash.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #initialize_copy(orig) ⇒ Object
- #merge(options) ⇒ Object
- #merge!(options) ⇒ Object
- #project_gems=(gems) ⇒ Object
- #use_delayed_job ⇒ Object
- #use_resque(options = {}) ⇒ Object
- #use_sidekiq(options = {}) ⇒ Object
- #use_sidekiq=(value) ⇒ Object
- #use_sucker_punch ⇒ Object
- #use_sucker_punch=(value) ⇒ Object
- #use_thread ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rollbar/configuration.rb', line 65 def initialize @async_handler = nil @before_process = [] @code_version = nil @custom_data_method = nil @default_logger = lambda { ::Logger.new(STDERR) } @delayed_job_enabled = true @disable_monkey_patch = false @disable_core_monkey_patch = false @disable_rack_monkey_patch = false @dj_threshold = 0 @enabled = nil # set to true when configure is called @endpoint = DEFAULT_ENDPOINT @environment = nil @exception_level_filters = { 'ActiveRecord::RecordNotFound' => 'warning', 'AbstractController::ActionNotFound' => 'warning', 'ActionController::RoutingError' => 'warning' } @failover_handlers = [] @framework = 'Plain' @ignored_person_ids = [] @payload_options = {} @person_method = 'current_user' @person_id_method = 'id' @person_username_method = 'username' @person_email_method = 'email' @project_gems = [] @populate_empty_backtraces = false @report_dj_data = true @open_timeout = 3 @request_timeout = 3 @net_retries = 3 @js_enabled = false @js_options = {} @scrub_fields = [:passwd, :password, :password_confirmation, :secret, :confirm_password, :password_confirmation, :secret_token, :api_key, :access_token ] @scrub_user = true @scrub_password = true @randomize_scrub_length = true @uncaught_exception_level = 'error' @scrub_headers = ['Authorization'] @sidekiq_threshold = 0 @safely = false @transform = [] @use_async = false @use_eventmachine = false @verify_ssl_peer = true @web_base = DEFAULT_WEB_BASE @write_to_file = false @send_extra_frame_data = :none @project_gem_paths = [] end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
7 8 9 |
# File 'lib/rollbar/configuration.rb', line 7 def access_token @access_token end |
#async_handler ⇒ Object
Returns the value of attribute async_handler.
8 9 10 |
# File 'lib/rollbar/configuration.rb', line 8 def async_handler @async_handler end |
#before_process ⇒ Object
Returns the value of attribute before_process.
10 11 12 |
# File 'lib/rollbar/configuration.rb', line 10 def before_process @before_process end |
#branch ⇒ Object
Returns the value of attribute branch.
9 10 11 |
# File 'lib/rollbar/configuration.rb', line 9 def branch @branch end |
#code_version ⇒ Object
Returns the value of attribute code_version.
11 12 13 |
# File 'lib/rollbar/configuration.rb', line 11 def code_version @code_version end |
#custom_data_method ⇒ Object
Returns the value of attribute custom_data_method.
12 13 14 |
# File 'lib/rollbar/configuration.rb', line 12 def custom_data_method @custom_data_method end |
#default_logger ⇒ Object
Returns the value of attribute default_logger.
14 15 16 |
# File 'lib/rollbar/configuration.rb', line 14 def default_logger @default_logger end |
#delayed_job_enabled ⇒ Object
Returns the value of attribute delayed_job_enabled.
13 14 15 |
# File 'lib/rollbar/configuration.rb', line 13 def delayed_job_enabled @delayed_job_enabled end |
#disable_core_monkey_patch ⇒ Object
Returns the value of attribute disable_core_monkey_patch.
17 18 19 |
# File 'lib/rollbar/configuration.rb', line 17 def disable_core_monkey_patch @disable_core_monkey_patch end |
#disable_monkey_patch ⇒ Object
Returns the value of attribute disable_monkey_patch.
15 16 17 |
# File 'lib/rollbar/configuration.rb', line 15 def disable_monkey_patch @disable_monkey_patch end |
#disable_rack_monkey_patch ⇒ Object
Returns the value of attribute disable_rack_monkey_patch.
16 17 18 |
# File 'lib/rollbar/configuration.rb', line 16 def disable_rack_monkey_patch @disable_rack_monkey_patch end |
#dj_threshold ⇒ Object
Returns the value of attribute dj_threshold.
18 19 20 |
# File 'lib/rollbar/configuration.rb', line 18 def dj_threshold @dj_threshold end |
#enabled ⇒ Object
Returns the value of attribute enabled.
19 20 21 |
# File 'lib/rollbar/configuration.rb', line 19 def enabled @enabled end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
20 21 22 |
# File 'lib/rollbar/configuration.rb', line 20 def endpoint @endpoint end |
#environment ⇒ Object
Returns the value of attribute environment.
21 22 23 |
# File 'lib/rollbar/configuration.rb', line 21 def environment @environment end |
#exception_level_filters ⇒ Object
Returns the value of attribute exception_level_filters.
22 23 24 |
# File 'lib/rollbar/configuration.rb', line 22 def exception_level_filters @exception_level_filters end |
#failover_handlers ⇒ Object
Returns the value of attribute failover_handlers.
23 24 25 |
# File 'lib/rollbar/configuration.rb', line 23 def failover_handlers @failover_handlers end |
#filepath ⇒ Object
Returns the value of attribute filepath.
24 25 26 |
# File 'lib/rollbar/configuration.rb', line 24 def filepath @filepath end |
#framework ⇒ Object
Returns the value of attribute framework.
25 26 27 |
# File 'lib/rollbar/configuration.rb', line 25 def framework @framework end |
#ignored_person_ids ⇒ Object
Returns the value of attribute ignored_person_ids.
26 27 28 |
# File 'lib/rollbar/configuration.rb', line 26 def ignored_person_ids @ignored_person_ids end |
#js_enabled ⇒ Object
Returns the value of attribute js_enabled.
40 41 42 |
# File 'lib/rollbar/configuration.rb', line 40 def js_enabled @js_enabled end |
#js_options ⇒ Object
Returns the value of attribute js_options.
39 40 41 |
# File 'lib/rollbar/configuration.rb', line 39 def @js_options end |
#logger ⇒ Object
Returns the value of attribute logger.
27 28 29 |
# File 'lib/rollbar/configuration.rb', line 27 def logger @logger end |
#net_retries ⇒ Object
Returns the value of attribute net_retries.
37 38 39 |
# File 'lib/rollbar/configuration.rb', line 37 def net_retries @net_retries end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
35 36 37 |
# File 'lib/rollbar/configuration.rb', line 35 def open_timeout @open_timeout end |
#payload_options ⇒ Object
Returns the value of attribute payload_options.
28 29 30 |
# File 'lib/rollbar/configuration.rb', line 28 def @payload_options end |
#person_email_method ⇒ Object
Returns the value of attribute person_email_method.
32 33 34 |
# File 'lib/rollbar/configuration.rb', line 32 def person_email_method @person_email_method end |
#person_id_method ⇒ Object
Returns the value of attribute person_id_method.
30 31 32 |
# File 'lib/rollbar/configuration.rb', line 30 def person_id_method @person_id_method end |
#person_method ⇒ Object
Returns the value of attribute person_method.
29 30 31 |
# File 'lib/rollbar/configuration.rb', line 29 def person_method @person_method end |
#person_username_method ⇒ Object
Returns the value of attribute person_username_method.
31 32 33 |
# File 'lib/rollbar/configuration.rb', line 31 def person_username_method @person_username_method end |
#populate_empty_backtraces ⇒ Object
Returns the value of attribute populate_empty_backtraces.
33 34 35 |
# File 'lib/rollbar/configuration.rb', line 33 def populate_empty_backtraces @populate_empty_backtraces end |
#project_gem_paths ⇒ Object (readonly)
Returns the value of attribute project_gem_paths.
58 59 60 |
# File 'lib/rollbar/configuration.rb', line 58 def project_gem_paths @project_gem_paths end |
#randomize_scrub_length ⇒ Object
Returns the value of attribute randomize_scrub_length.
46 47 48 |
# File 'lib/rollbar/configuration.rb', line 46 def randomize_scrub_length @randomize_scrub_length end |
#report_dj_data ⇒ Object
Returns the value of attribute report_dj_data.
34 35 36 |
# File 'lib/rollbar/configuration.rb', line 34 def report_dj_data @report_dj_data end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
36 37 38 |
# File 'lib/rollbar/configuration.rb', line 36 def request_timeout @request_timeout end |
#root ⇒ Object
Returns the value of attribute root.
38 39 40 |
# File 'lib/rollbar/configuration.rb', line 38 def root @root end |
#safely ⇒ Object Also known as: safely?
Returns the value of attribute safely.
41 42 43 |
# File 'lib/rollbar/configuration.rb', line 41 def safely @safely end |
#scrub_fields ⇒ Object
Returns the value of attribute scrub_fields.
42 43 44 |
# File 'lib/rollbar/configuration.rb', line 42 def scrub_fields @scrub_fields end |
#scrub_headers ⇒ Object
Returns the value of attribute scrub_headers.
48 49 50 |
# File 'lib/rollbar/configuration.rb', line 48 def scrub_headers @scrub_headers end |
#scrub_password ⇒ Object
Returns the value of attribute scrub_password.
44 45 46 |
# File 'lib/rollbar/configuration.rb', line 44 def scrub_password @scrub_password end |
#scrub_user ⇒ Object
Returns the value of attribute scrub_user.
43 44 45 |
# File 'lib/rollbar/configuration.rb', line 43 def scrub_user @scrub_user end |
#send_extra_frame_data ⇒ Object
Returns the value of attribute send_extra_frame_data.
56 57 58 |
# File 'lib/rollbar/configuration.rb', line 56 def send_extra_frame_data @send_extra_frame_data end |
#sidekiq_threshold ⇒ Object
Returns the value of attribute sidekiq_threshold.
49 50 51 |
# File 'lib/rollbar/configuration.rb', line 49 def sidekiq_threshold @sidekiq_threshold end |
#transform ⇒ Object
Returns the value of attribute transform.
50 51 52 |
# File 'lib/rollbar/configuration.rb', line 50 def transform @transform end |
#uncaught_exception_level ⇒ Object
Returns the value of attribute uncaught_exception_level.
47 48 49 |
# File 'lib/rollbar/configuration.rb', line 47 def uncaught_exception_level @uncaught_exception_level end |
#use_async ⇒ Object
Returns the value of attribute use_async.
52 53 54 |
# File 'lib/rollbar/configuration.rb', line 52 def use_async @use_async end |
#use_eventmachine ⇒ Object
Returns the value of attribute use_eventmachine.
53 54 55 |
# File 'lib/rollbar/configuration.rb', line 53 def use_eventmachine @use_eventmachine end |
#user_ip_obfuscator_secret ⇒ Object
Returns the value of attribute user_ip_obfuscator_secret.
45 46 47 |
# File 'lib/rollbar/configuration.rb', line 45 def user_ip_obfuscator_secret @user_ip_obfuscator_secret end |
#verify_ssl_peer ⇒ Object
Returns the value of attribute verify_ssl_peer.
51 52 53 |
# File 'lib/rollbar/configuration.rb', line 51 def verify_ssl_peer @verify_ssl_peer end |
#web_base ⇒ Object
Returns the value of attribute web_base.
54 55 56 |
# File 'lib/rollbar/configuration.rb', line 54 def web_base @web_base end |
#write_to_file ⇒ Object
Returns the value of attribute write_to_file.
55 56 57 |
# File 'lib/rollbar/configuration.rb', line 55 def write_to_file @write_to_file end |
Instance Method Details
#[](option) ⇒ Object
allow params to be read like a hash
228 229 230 |
# File 'lib/rollbar/configuration.rb', line 228 def [](option) send(option) end |
#initialize_copy(orig) ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/rollbar/configuration.rb', line 120 def initialize_copy(orig) super instance_variables.each do |var| instance_var = instance_variable_get(var) instance_variable_set(var, Rollbar::Util::deep_copy(instance_var)) end end |
#merge(options) ⇒ Object
129 130 131 132 133 134 |
# File 'lib/rollbar/configuration.rb', line 129 def merge() new_configuration = clone new_configuration.merge!() new_configuration end |
#merge!(options) ⇒ Object
136 137 138 139 140 141 142 143 144 145 |
# File 'lib/rollbar/configuration.rb', line 136 def merge!() .each do |name, value| variable_name = "@#{name}" next unless instance_variable_defined?(variable_name) instance_variable_set(variable_name, value) end self end |
#project_gems=(gems) ⇒ Object
199 200 201 202 203 204 205 206 207 |
# File 'lib/rollbar/configuration.rb', line 199 def project_gems=(gems) @project_gem_paths = gems.map do |name| found = Gem::Specification.each.select { |spec| name === spec.name } if found.empty? puts "[Rollbar] No gems found matching #{name.inspect}" end found end.flatten.uniq.map(&:gem_dir) end |
#use_delayed_job ⇒ Object
147 148 149 150 151 |
# File 'lib/rollbar/configuration.rb', line 147 def use_delayed_job require 'rollbar/delay/delayed_job' @use_async = true @async_handler = Rollbar::Delay::DelayedJob end |
#use_resque(options = {}) ⇒ Object
159 160 161 162 163 164 165 166 |
# File 'lib/rollbar/configuration.rb', line 159 def use_resque( = {}) require 'rollbar/delay/resque' if defined?(Resque) Rollbar::Delay::Resque::Job.queue = [:queue] if [:queue] @use_async = true @async_handler = Rollbar::Delay::Resque end |
#use_sidekiq(options = {}) ⇒ Object
153 154 155 156 157 |
# File 'lib/rollbar/configuration.rb', line 153 def use_sidekiq( = {}) require 'rollbar/delay/sidekiq' if defined?(Sidekiq) @use_async = true @async_handler = Rollbar::Delay::Sidekiq.new() end |
#use_sidekiq=(value) ⇒ Object
168 169 170 171 172 173 |
# File 'lib/rollbar/configuration.rb', line 168 def use_sidekiq=(value) = "#use_sidekiq=(value) has been deprecated in favor of #use_sidekiq(options = {}). Please update your rollbar configuration." defined?(ActiveSupport) ? ActiveSupport::Deprecation.warn() : puts() value.is_a?(Hash) ? use_sidekiq(value) : use_sidekiq end |
#use_sucker_punch ⇒ Object
181 182 183 184 185 |
# File 'lib/rollbar/configuration.rb', line 181 def use_sucker_punch require 'rollbar/delay/sucker_punch' if defined?(SuckerPunch) @use_async = true @async_handler = Rollbar::Delay::SuckerPunch end |
#use_sucker_punch=(value) ⇒ Object
187 188 189 190 191 192 |
# File 'lib/rollbar/configuration.rb', line 187 def use_sucker_punch=(value) = "#use_sucker_punch=(value) has been deprecated in favor of #use_sucker_punch. Please update your rollbar configuration." defined?(ActiveSupport) ? ActiveSupport::Deprecation.warn() : puts() use_sucker_punch end |