Class: Honeybadger::Config Private
- Inherits:
-
Object
- Object
- Honeybadger::Config
- Extended by:
- Forwardable
- Includes:
- Logging::Helper
- Defined in:
- lib/honeybadger/config.rb,
lib/honeybadger/config/env.rb,
lib/honeybadger/config/ruby.rb,
lib/honeybadger/config/yaml.rb,
lib/honeybadger/config/defaults.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The Config class is used to manage Honeybadger’s initialization and configuration.
Defined Under Namespace
Modules: Env, Yaml Classes: Boolean, ConfigError, Mash, Ruby
Constant Summary collapse
- KEY_REPLACEMENT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Regexp.new('[^a-z\d_]', Regexp::IGNORECASE).freeze
- DOTTED_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Regexp.new('\A([^\.]+)\.(.+)\z').freeze
- NOT_BLANK =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Regexp.new('\S').freeze
- IVARS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[:@ruby, :@env, :@yaml, :@framework].freeze
- IGNORE_DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
['ActionController::RoutingError', 'AbstractController::ActionNotFound', 'ActionController::MethodNotAllowed', 'ActionController::UnknownHttpMethod', 'ActionController::NotImplemented', 'ActionController::UnknownFormat', 'ActionController::InvalidAuthenticityToken', 'ActionController::InvalidCrossOriginRequest', # ActionDispatch::ParamsParser::ParseError was removed in Rails 6.0 # and may be removed here once support for Rails 5.2 is dropped. # https://github.com/rails/rails/commit/e16c765ac6dcff068ff2e5554d69ff345c003de1 # https://github.com/honeybadger-io/honeybadger-ruby/pull/358 'ActionDispatch::ParamsParser::ParseError', 'ActionDispatch::Http::Parameters::ParseError', 'ActionController::BadRequest', 'ActionController::ParameterMissing', 'ActiveRecord::RecordNotFound', 'ActionController::UnknownAction', 'ActionDispatch::Http::MimeNegotiation::InvalidType', 'Rack::QueryParser::ParameterTypeError', 'Rack::QueryParser::InvalidParameterError', 'CGI::Session::CookieStore::TamperedWithCookie', 'Mongoid::Errors::DocumentNotFound', 'Sinatra::NotFound', 'Sidekiq::JobRetry::Skip'].map(&:freeze).freeze
- IGNORE_EVENTS_DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[ { event_type: 'metric.hb', metric_name: 'duration.sql.active_record', query: /^(begin|commit)( transaction)?$/i }, { event_type: 'sql.active_record', query: /^(begin|commit)( transaction)?$/i }, { event_type: 'sql.active_record', query: /(solid_queue|good_job)/i }, { event_type: 'sql.active_record', name: /^GoodJob/ }, { event_type: 'process_action.action_controller', controller: 'Rails::HealthController' } ].freeze
- DEVELOPMENT_ENVIRONMENTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
['development', 'test', 'cucumber'].map(&:freeze).freeze
- DEFAULT_PATHS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
['honeybadger.yml', 'config/honeybadger.yml', "#{ENV['HOME']}/honeybadger.yml"].map(&:freeze).freeze
- OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ api_key: { description: 'The API key for your Honeybadger project.', default: nil, type: String }, env: { description: 'The current application\'s environment name.', default: nil, type: String }, report_data: { description: 'Enable/disable reporting of data. Defaults to true for non-development environments.', default: nil, type: Boolean }, root: { description: 'The project\'s absolute root path.', default: Dir.pwd, type: String }, revision: { description: 'The git revision of the project.', default: nil, type: String }, hostname: { description: 'The hostname of the current box.', default: Socket.gethostname, type: String }, backend: { description: 'An alternate backend to use for reporting data.', default: nil, type: String }, debug: { description: 'Enables debug logging.', default: false, type: Boolean }, development_environments: { description: 'Environments which will not report data by default (use report_data to enable/disable explicitly).', default: DEVELOPMENT_ENVIRONMENTS, type: Array }, :'send_data_at_exit' => { description: 'Send remaining data when Ruby exits.', default: true, type: Boolean }, max_queue_size: { description: 'Maximum number of items for each worker queue.', default: 100, type: Integer }, :'events.max_queue_size' => { description: 'Maximum number of event for the event worker queue.', default: 100000, type: Integer }, :'events.batch_size' => { description: 'Send events batch if n events have accumulated', default: 1000, type: Integer }, :'events.timeout' => { description: 'Timeout after which the events batch will be sent regardless (in milliseconds)', default: 30_000, type: Integer }, :'events.attach_hostname' => { description: 'Add the hostname to all event paylaods.', default: true, type: Boolean }, :'events.ignore' => { description: 'A list of additional events to ignore. Use a hash to query nested payloads, match using a string or regex. Non-hash will match on the event_type.', default: IGNORE_EVENTS_DEFAULT, type: Array }, :'events.ignore_only' => { description: 'A list of events to ignore (overrides the default ignored events).', default: nil, type: Array }, plugins: { description: 'An optional list of plugins to load. Default is to load all plugins.', default: nil, type: Array }, sync: { description: 'Enable all notices to be sent synchronously. Default is false.', default: false, type: Boolean }, :'skipped_plugins' => { description: 'An optional list of plugins to skip.', default: nil, type: Array }, :'config.path' => { description: 'The path (absolute, or relative from config.root) to the project\'s YAML configuration file.', default: DEFAULT_PATHS, type: String }, :'logging.path' => { description: 'The path (absolute, or relative from config.root) to the log file.', default: nil, type: String }, :'logging.level' => { description: 'The log level.', default: 'INFO', type: String }, :'logging.debug' => { description: 'Override debug logging.', default: nil, type: Boolean }, :'logging.tty_level' => { description: 'Level to log when attached to a terminal (anything < logging.level will always be ignored).', default: 'DEBUG', type: String }, :'connection.secure' => { description: 'Use SSL when sending data.', default: true, type: Boolean }, :'connection.host' => { description: 'The host to use when sending data.', default: 'api.honeybadger.io'.freeze, type: String }, :'connection.ui_host' => { description: 'The host to use when viewing data.', default: 'app.honeybadger.io'.freeze, type: String }, :'connection.port' => { description: 'The port to use when sending data.', default: nil, type: Integer }, :'connection.system_ssl_cert_chain' => { description: 'Use the system\'s SSL certificate chain (if available).', default: false, type: Boolean }, :'connection.ssl_ca_bundle_path' => { description: 'Use this ca bundle when establishing secure connections.', default: nil, type: String }, :'connection.http_open_timeout' => { description: 'The HTTP open timeout when connecting to the server.', default: 2, type: Integer }, :'connection.http_read_timeout' => { description: 'The HTTP read timeout when connecting to the server.', default: 5, type: Integer }, :'connection.proxy_host' => { description: 'The proxy host to use when sending data.', default: nil, type: String }, :'connection.proxy_port' => { description: 'The proxy port to use when sending data.', default: nil, type: Integer }, :'connection.proxy_user' => { description: 'The proxy user to use when sending data.', default: nil, type: String }, :'connection.proxy_pass' => { description: 'The proxy password to use when sending data.', default: nil, type: String }, :'request.filter_keys' => { description: 'A list of keys to filter when sending request data.', default: ['password'.freeze, 'password_confirmation'.freeze, 'HTTP_AUTHORIZATION'.freeze].freeze, type: Array }, :'request.disable_session' => { description: 'Prevent session from being sent with request data.', default: false, type: Boolean }, :'request.disable_params' => { description: 'Prevent params from being sent with request data.', default: false, type: Boolean }, :'request.disable_environment' => { description: 'Prevent Rack environment from being sent with request data.', default: false, type: Boolean }, :'request.disable_url' => { description: 'Prevent url from being sent with request data (Rack environment may still contain it in some cases).', default: false, type: Boolean }, :'user_informer.enabled' => { description: 'Enable the UserInformer middleware.', default: true, type: Boolean }, :'user_informer.info' => { description: 'Replacement string for HTML comment in templates.', default: 'Honeybadger Error {{error_id}}'.freeze, type: String }, :'feedback.enabled' => { description: 'Enable the UserFeedback middleware.', default: true, type: Boolean }, :'exceptions.enabled' => { description: 'Enable automatic reporting of exceptions.', default: true, type: Boolean }, :'exceptions.ignore' => { description: 'A list of additional exceptions to ignore (includes default ignored exceptions).', default: IGNORE_DEFAULT, type: Array }, :'exceptions.ignore_only' => { description: 'A list of exceptions to ignore (overrides the default ignored exceptions).', default: nil, type: Array }, :'exceptions.ignored_user_agents' => { description: 'A list of user agents to ignore.', default: [].freeze, type: Array }, :'exceptions.rescue_rake' => { description: 'Enable reporting exceptions in rake tasks.', default: !STDOUT.tty?, type: Boolean }, :'exceptions.notify_at_exit' => { description: 'Report unhandled exception when Ruby crashes (at_exit).', default: true, type: Boolean }, :'exceptions.source_radius' => { description: 'The number of lines before and after the source when reporting snippets.', default: 2, type: Integer }, :'exceptions.local_variables' => { description: 'Enable sending local variables. Requires binding_of_caller to be loaded.', default: false, type: Boolean }, :'exceptions.unwrap' => { description: 'Reports #original_exception or #cause one level up from rescued exception when available.', default: false, type: Boolean }, :'active_job.attempt_threshold' => { description: 'The number of attempts before notifications will be sent.', default: 0, type: Integer }, :'delayed_job.attempt_threshold' => { description: 'The number of attempts before notifications will be sent.', default: 0, type: Integer }, :'sidekiq.attempt_threshold' => { description: 'The number of attempts before notifications will be sent.', default: 0, type: Integer }, :'shoryuken.attempt_threshold' => { description: 'The number of attempts before notifications will be sent.', default: 0, type: Integer }, :'faktory.attempt_threshold' => { description: 'The number of attempts before notifications will be sent.', default: 0, type: Integer }, :'sidekiq.use_component' => { description: 'Automatically set the component to the class of the job. Helps with grouping.', default: true, type: Boolean }, :'sidekiq.insights.enabled' => { description: 'Enable automatic data collection for Sidekiq.', default: true, type: Boolean }, :'sidekiq.insights.events' => { description: 'Enable automatic event capturing for Sidekiq.', default: true, type: Boolean }, :'sidekiq.insights.metrics' => { description: 'Enable automatic metric data collection for Sidekiq.', default: false, type: Boolean }, :'sidekiq.insights.cluster_collection' => { description: 'Collect cluster based metrics for Sidekiq.', default: true, type: Boolean }, :'sidekiq.insights.collection_interval' => { description: 'The frequency in which Sidekiq cluster metrics are sampled.', default: 5, type: Integer }, :'solid_queue.insights.enabled' => { description: 'Enable automatic data collection for SolidQueue.', default: true, type: Boolean }, :'solid_queue.insights.events' => { description: 'Enable automatic event capturing for SolidQueue.', default: true, type: Boolean }, :'solid_queue.insights.metrics' => { description: 'Enable automatic metric data collection for SolidQueue.', default: false, type: Boolean }, :'solid_queue.insights.cluster_collection' => { description: 'Collect cluster based metrics for SolidQueue.', default: true, type: Boolean }, :'solid_queue.insights.collection_interval' => { description: 'The frequency in which SolidQueue cluster metrics are sampled.', default: 5, type: Integer }, :'rails.insights.enabled' => { description: 'Enable automatic data collection for Ruby on Rails.', default: true, type: Boolean }, :'rails.insights.events' => { description: 'Enable automatic event capturing for Ruby on Rails.', default: true, type: Boolean }, :'rails.insights.metrics' => { description: 'Enable automatic metric data collection for Ruby on Rails.', default: false, type: Boolean }, :'karafka.insights.enabled' => { description: 'Enable automatic data collection for Karafka.', default: true, type: Boolean }, :'karafka.insights.events' => { description: 'Enable automatic event capturing for Karafka.', default: true, type: Boolean }, :'karafka.insights.metrics' => { description: 'Enable automatic metric data collection for Karafka.', default: false, type: Boolean }, :'net_http.insights.enabled' => { description: 'Allow automatic instrumentation of Net::HTTP requests.', default: true, type: Boolean }, :'net_http.insights.events' => { description: 'Enable automatic event capturing for Net::HTTP requests.', default: true, type: Boolean }, :'net_http.insights.metrics' => { description: 'Enable automatic metric data collection for Net::HTTP requests.', default: false, type: Boolean }, :'net_http.insights.full_url' => { description: 'Record the full request url during instrumentation.', default: false, type: Boolean }, :'sinatra.enabled' => { description: 'Enable Sinatra auto-initialization.', default: true, type: Boolean }, :'rails.subscriber_ignore_sources' => { description: "Sources (strings or regexes) that should be ignored when using the Rails' (7+) native error reporter (handled exceptions only).", # External libraries (eg Sidekiq, Resque) may wrap their execution in Rails' executor. # But this means errors will first be reported by Rails.error, before the library's native error handler # We ignore these reports, since the native error handler provides more context (such as job details) default: ['application.active_support'], type: Array }, :'resque.resque_retry.send_exceptions_when_retrying' => { description: 'Send exceptions when retrying job.', default: true, type: Boolean }, :'breadcrumbs.enabled' => { description: 'Disable breadcrumb functionality.', default: true, type: Boolean }, :'breadcrumbs.active_support_notifications' => { description: 'Configuration for automatic Active Support Instrumentation events.', default: Breadcrumbs::ActiveSupport.default_notifications, type: Hash }, :'breadcrumbs.logging.enabled' => { description: 'Enable/Disable automatic breadcrumbs from log messages.', default: true, type: Boolean }, :'insights.enabled' => { description: "Enable/Disable Honeybadger Insights built-in instrumentation.", default: false, type: Boolean }, :'insights.console.enabled' => { description: "Enable/Disable Honeybadger Insights built-in instrumentation in a Rails console.", default: false, type: Boolean }, :'insights.registry_flush_interval' => { description: "Number of seconds between registry flushes.", default: 60, type: Integer } }.freeze
- DEFAULTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Hash[OPTIONS.map{|k,v| [k, v[:default]] }].freeze
Instance Attribute Summary collapse
- #env ⇒ Object private
- #framework ⇒ Object private
- #ruby ⇒ Object private
- #yaml ⇒ Object private
Instance Method Summary collapse
- #backend ⇒ Object private
- #backend=(backend) ⇒ Object private
- #backtrace_filter(&block) ⇒ Object private
- #before_event_hooks ⇒ Object private
- #before_notify_hooks ⇒ Object private
- #ca_bundle_path ⇒ Object private
- #cluster_collection?(name) ⇒ Boolean private
- #collection_interval(name) ⇒ Object private
- #configure {|new_ruby| ... } ⇒ Object private
- #connection_port ⇒ Object private
- #connection_protocol ⇒ Object private
- #debug? ⇒ Boolean private
- #detected_framework ⇒ Object private
- #dev? ⇒ Boolean private
- #events_batch_size ⇒ Object private
- #events_max_queue_size ⇒ Object private
- #events_timeout ⇒ Object private
- #exception_filter(&block) ⇒ Object private
- #exception_fingerprint(&block) ⇒ Object private
- #excluded_request_keys ⇒ Object private
- #framework_name ⇒ Object private
- #get(key) ⇒ Object (also: #[]) private
- #ignored_classes ⇒ Object private
- #ignored_events ⇒ Object private
-
#init!(opts = {}, env = ENV) ⇒ Object
private
Called by framework (see lib/honeybadger/init/) at the point of initialization.
-
#initialize(opts = {}) ⇒ Config
constructor
private
A new instance of Config.
- #insights_enabled? ⇒ Boolean private
- #load!(framework: {}, env: ENV) ⇒ Object private
- #load_plugin?(name) ⇒ Boolean private
- #load_plugin_insights?(name) ⇒ Boolean private
- #load_plugin_insights_events?(name) ⇒ Boolean private
- #load_plugin_insights_metrics?(name) ⇒ Boolean private
- #local_cert_path ⇒ Object private
- #log_debug? ⇒ Boolean private
- #log_level(key = :'logging.level') ⇒ Object private
- #logger ⇒ Object private
- #max_queue_size ⇒ Object private
- #params_filters ⇒ Object private
- #public? ⇒ Boolean private
- #raw_ignored_events ⇒ Object private
- #root_regexp ⇒ Object private
- #set(key, value) ⇒ Object (also: #[]=) private
- #to_hash(defaults = false) ⇒ Object (also: #to_h) private
- #warn_development? ⇒ Boolean private
Constructor Details
#initialize(opts = {}) ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Config.
40 41 42 43 44 45 |
# File 'lib/honeybadger/config.rb', line 40 def initialize(opts = {}) @ruby = opts.freeze @env = {}.freeze @yaml = {}.freeze @framework = {}.freeze end |
Instance Attribute Details
#env ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/honeybadger/config.rb', line 47 def env @env end |
#framework ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/honeybadger/config.rb', line 47 def framework @framework end |
#ruby ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/honeybadger/config.rb', line 47 def ruby @ruby end |
#yaml ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/honeybadger/config.rb', line 47 def yaml @yaml end |
Instance Method Details
#backend ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
154 155 156 157 |
# File 'lib/honeybadger/config.rb', line 154 def backend init_backend! unless @backend @backend end |
#backend=(backend) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
159 160 161 162 |
# File 'lib/honeybadger/config.rb', line 159 def backend=(backend) set(:backend, backend) @backend = nil end |
#backtrace_filter(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 85 86 87 88 89 |
# File 'lib/honeybadger/config.rb', line 82 def backtrace_filter(&block) if block_given? warn('DEPRECATED: backtrace_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#backtrace_filter') self[:backtrace_filter] = block end self[:backtrace_filter] end |
#before_event_hooks ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
95 96 97 |
# File 'lib/honeybadger/config.rb', line 95 def before_event_hooks (ruby[:before_event] || []).clone end |
#before_notify_hooks ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
91 92 93 |
# File 'lib/honeybadger/config.rb', line 91 def before_notify_hooks (ruby[:before_notify] || []).clone end |
#ca_bundle_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
213 214 215 216 217 218 219 220 221 |
# File 'lib/honeybadger/config.rb', line 213 def ca_bundle_path if self[:'connection.system_ssl_cert_chain'] && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE) OpenSSL::X509::DEFAULT_CERT_FILE elsif self[:'connection.ssl_ca_bundle_path'] self[:'connection.ssl_ca_bundle_path'] else local_cert_path end end |
#cluster_collection?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
295 296 297 298 299 |
# File 'lib/honeybadger/config.rb', line 295 def cluster_collection?(name) return false unless insights_enabled? return true if self[:"#{name}.insights.cluster_collection"].nil? !!self[:"#{name}.insights.cluster_collection"] end |
#collection_interval(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
301 302 303 304 |
# File 'lib/honeybadger/config.rb', line 301 def collection_interval(name) return nil unless insights_enabled? self[:"#{name}.insights.collection_interval"] end |
#configure {|new_ruby| ... } ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 77 78 79 80 |
# File 'lib/honeybadger/config.rb', line 74 def configure new_ruby = Ruby.new(self) yield(new_ruby) self.ruby = ruby.merge(new_ruby).freeze @logger = @backend = nil self end |
#connection_port ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
227 228 229 230 231 232 233 234 235 |
# File 'lib/honeybadger/config.rb', line 227 def connection_port if self[:'connection.port'] self[:'connection.port'] elsif self[:'connection.secure'] 443 else 80 end end |
#connection_protocol ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
237 238 239 240 241 242 243 |
# File 'lib/honeybadger/config.rb', line 237 def connection_protocol if self[:'connection.secure'] 'https' else 'http' end end |
#debug? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
178 179 180 |
# File 'lib/honeybadger/config.rb', line 178 def debug? !!self[:debug] end |
#detected_framework ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/honeybadger/config.rb', line 336 def detected_framework if self[:framework] =~ NOT_BLANK self[:framework].to_sym elsif defined?(::Rails::VERSION) && ::Rails::VERSION::STRING > '3.0' :rails elsif defined?(::Sinatra::VERSION) :sinatra elsif defined?(::Hanami::VERSION) && ::Hanami::VERSION >= '2.0' :hanami elsif defined?(::Rack.release) :rack else :ruby end end |
#dev? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
164 165 166 |
# File 'lib/honeybadger/config.rb', line 164 def dev? self[:env] && Array(self[:development_environments]).include?(self[:env]) end |
#events_batch_size ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
253 254 255 |
# File 'lib/honeybadger/config.rb', line 253 def events_batch_size self[:'events.batch_size'] end |
#events_max_queue_size ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
249 250 251 |
# File 'lib/honeybadger/config.rb', line 249 def events_max_queue_size self[:'events.max_queue_size'] end |
#events_timeout ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
257 258 259 |
# File 'lib/honeybadger/config.rb', line 257 def events_timeout self[:'events.timeout'] end |
#exception_filter(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 102 103 104 105 106 |
# File 'lib/honeybadger/config.rb', line 99 def exception_filter(&block) if block_given? warn('DEPRECATED: exception_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_filter') self[:exception_filter] = block end self[:exception_filter] end |
#exception_fingerprint(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
108 109 110 111 112 113 114 115 |
# File 'lib/honeybadger/config.rb', line 108 def exception_fingerprint(&block) if block_given? warn('DEPRECATED: exception_fingerprint is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_fingerprint') self[:exception_fingerprint] = block end self[:exception_fingerprint] end |
#excluded_request_keys ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
265 266 267 268 269 270 271 272 |
# File 'lib/honeybadger/config.rb', line 265 def excluded_request_keys [].tap do |keys| keys << :session if self[:'request.disable_session'] keys << :params if self[:'request.disable_params'] keys << :cgi_data if self[:'request.disable_environment'] keys << :url if self[:'request.disable_url'] end end |
#framework_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
352 353 354 355 356 357 358 359 360 361 |
# File 'lib/honeybadger/config.rb', line 352 def framework_name case detected_framework when :rails then "Rails #{::Rails::VERSION::STRING}" when :sinatra then "Sinatra #{::Sinatra::VERSION}" when :hanami then "Hanami #{::Hanami::VERSION}" when :rack then "Rack #{::Rack.release}" else "Ruby #{RUBY_VERSION}" end end |
#get(key) ⇒ Object Also known as: []
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/honeybadger/config.rb', line 117 def get(key) IVARS.each do |var| source = instance_variable_get(var) if source.has_key?(key) return source[key] end end DEFAULTS[key] end |
#ignored_classes ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
187 188 189 190 191 192 193 |
# File 'lib/honeybadger/config.rb', line 187 def ignored_classes ignore_only = get(:'exceptions.ignore_only') return ignore_only if ignore_only return DEFAULTS[:'exceptions.ignore'] unless ignore = get(:'exceptions.ignore') DEFAULTS[:'exceptions.ignore'] | Array(ignore) end |
#ignored_events ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
203 204 205 206 207 208 209 210 211 |
# File 'lib/honeybadger/config.rb', line 203 def ignored_events @ignored_events ||= raw_ignored_events.map do |check| if check.is_a?(String) || check.is_a?(Regexp) { [:event_type] => check } elsif check.is_a?(Hash) flat_hash(check).transform_keys! { |key_array| key_array.map(&:to_sym) } end end.compact end |
#init!(opts = {}, env = ENV) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Called by framework (see lib/honeybadger/init/) at the point of initialization. This is not required for the notifier to work (i.e. with ‘require ’honeybadger/ruby’‘).
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/honeybadger/config.rb', line 52 def init!(opts = {}, env = ENV) load!(framework: opts, env: env) init_logging! init_backend! logger.debug(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework)) logger.warn('Development mode is enabled. Data will not be reported until you deploy your app.') if warn_development? self end |
#insights_enabled? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
291 292 293 |
# File 'lib/honeybadger/config.rb', line 291 def insights_enabled? public? && !!self[:'insights.enabled'] end |
#load!(framework: {}, env: ENV) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 70 71 72 |
# File 'lib/honeybadger/config.rb', line 64 def load!(framework: {}, env: ENV) return self if @loaded self.framework = framework.freeze self.env = Env.new(env).freeze load_config_from_disk {|yaml| self.yaml = yaml.freeze } detect_revision! @loaded = true self end |
#load_plugin?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
285 286 287 288 289 |
# File 'lib/honeybadger/config.rb', line 285 def load_plugin?(name) return false if includes_token?(self[:'skipped_plugins'], name) return true unless self[:plugins].kind_of?(Array) includes_token?(self[:plugins], name) end |
#load_plugin_insights?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
306 307 308 309 310 |
# File 'lib/honeybadger/config.rb', line 306 def load_plugin_insights?(name) return false unless insights_enabled? return true if self[:"#{name}.insights.enabled"].nil? !!self[:"#{name}.insights.enabled"] end |
#load_plugin_insights_events?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
312 313 314 315 316 317 |
# File 'lib/honeybadger/config.rb', line 312 def load_plugin_insights_events?(name) return false unless insights_enabled? return false unless load_plugin_insights?(name) return true if self[:"#{name}.insights.events"].nil? !!self[:"#{name}.insights.events"] end |
#load_plugin_insights_metrics?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
319 320 321 322 323 324 |
# File 'lib/honeybadger/config.rb', line 319 def load_plugin_insights_metrics?(name) return false unless insights_enabled? return false unless load_plugin_insights?(name) return true if self[:"#{name}.insights.metrics"].nil? !!self[:"#{name}.insights.metrics"] end |
#local_cert_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
223 224 225 |
# File 'lib/honeybadger/config.rb', line 223 def local_cert_path File.(File.join('..', '..', '..', 'resources', 'ca-bundle.crt'), __FILE__) end |
#log_debug? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
182 183 184 185 |
# File 'lib/honeybadger/config.rb', line 182 def log_debug? return debug? if self[:'logging.debug'].nil? !!self[:'logging.debug'] end |
#log_level(key = :'logging.level') ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
274 275 276 277 278 279 280 281 282 283 |
# File 'lib/honeybadger/config.rb', line 274 def log_level(key = :'logging.level') case self[key].to_s when /\A(0|debug)\z/i then Logger::DEBUG when /\A(1|info)\z/i then Logger::INFO when /\A(2|warn)\z/i then Logger::WARN when /\A(3|error)\z/i then Logger::ERROR else Logger::INFO end end |
#logger ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
149 150 151 152 |
# File 'lib/honeybadger/config.rb', line 149 def logger init_logging! unless @logger @logger end |
#max_queue_size ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
245 246 247 |
# File 'lib/honeybadger/config.rb', line 245 def max_queue_size self[:max_queue_size] end |
#params_filters ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
261 262 263 |
# File 'lib/honeybadger/config.rb', line 261 def params_filters Array(self[:'request.filter_keys']) end |
#public? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
172 173 174 175 176 |
# File 'lib/honeybadger/config.rb', line 172 def public? return true if self[:report_data] return false if self[:report_data] == false !self[:env] || !dev? end |
#raw_ignored_events ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
195 196 197 198 199 200 201 |
# File 'lib/honeybadger/config.rb', line 195 def raw_ignored_events ignore_only = get(:'events.ignore_only') return ignore_only if ignore_only return DEFAULTS[:'events.ignore'] unless ignore = get(:'events.ignore') DEFAULTS[:'events.ignore'] | Array(ignore) end |
#root_regexp ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
326 327 328 329 330 331 332 333 334 |
# File 'lib/honeybadger/config.rb', line 326 def root_regexp return @root_regexp if @root_regexp return nil if @no_root root = get(:root).to_s @no_root = true and return nil unless root =~ NOT_BLANK @root_regexp = Regexp.new("^#{ Regexp.escape(root) }") end |
#set(key, value) ⇒ Object Also known as: []=
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 132 |
# File 'lib/honeybadger/config.rb', line 129 def set(key, value) self.ruby = ruby.merge(key => value).freeze @logger = @backend = nil end |
#to_hash(defaults = false) ⇒ Object Also known as: to_h
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 136 137 138 139 140 141 142 143 |
# File 'lib/honeybadger/config.rb', line 135 def to_hash(defaults = false) hash = [:@ruby, :@env, :@yaml, :@framework].reverse.reduce({}) do |a,e| a.merge!(instance_variable_get(e)) end hash = DEFAULTS.merge(hash) if defaults undotify_keys(hash.select {|k,v| DEFAULTS.has_key?(k) }) end |