Files
grecia/config/initializers/errbit.rb
Senén Rodero Rodríguez 1e46746d6a Filter airbrake parameters
As Rails does with the application log and other tools. We
are going to use the same filtering rules we use in Consul Democracy.

We are renaming the initializer file name `filter_parameter_logging.rb` so
it's loaded before the errbit initializer.
2023-11-23 18:21:29 +01:00

44 lines
1.3 KiB
Ruby

require "airbrake/delayed_job" if defined?(Delayed)
Airbrake.configure do |config|
config.host = Rails.application.secrets.errbit_host
config.project_id = Rails.application.secrets.errbit_project_id
config.project_key = Rails.application.secrets.errbit_project_key
config.environment = Rails.env
config.ignore_environments = %w[development test]
if config.host.blank? || config.project_id.blank? || config.project_key.blank?
config.ignore_environments += [Rails.env]
end
config.performance_stats = false
config.job_stats = false
config.query_stats = false
config.remote_config = false
config.blocklist_keys = Rails.application.config.filter_parameters
end
Airbrake.add_filter do |notice|
ignorables = %w[ActiveRecord::RecordNotFound Apartment::TenantNotFound]
notice.ignore! if ignorables.include? notice[:errors].first[:type]
end
if Rails.application.secrets.errbit_self_hosted_ssl.present?
# Patch from: https://mensfeld.pl/2016/05/setting-up-errbit-reporter-airbrake-v5-gem-to-work-with-self-signed-https-certificate/
module Patches
module Airbrake
module SyncSender
def build_https(uri)
super.tap do |req|
req.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
end
end
end
end
Airbrake::SyncSender.prepend(::Patches::Airbrake::SyncSender)
end