Replaced hoptoad gem with airbrake gem

This commit is contained in:
Naman Gupta 2017-12-14 03:00:59 +05:30 committed by Christian Bruckmayer
parent 0c6d1fa233
commit 7d2afc623d
4 changed files with 27 additions and 34 deletions

View file

@ -0,0 +1,22 @@
Airbrake.configure do |config|
# Change this to some sensible data for your errbit instance
config.project_id = ENV['OSEM_ERRBIT_APIKEY'] || Rails.application.secrets.errbit_key || ''
config.project_key = ENV['OSEM_ERRBIT_APIKEY'] || Rails.application.secrets.errbit_key || ''
config.host = ENV['OSEM_ERRBIT_HOST']
config.environment = Rails.env
if config.project_key.blank? || config.host.blank?
config.ignore_environments = [:production, :development, :test]
else
config.ignore_environments = [:development, :test]
end
end
Airbrake.add_filter do |notice|
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActiveRecord::RecordNotFound' }
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::InvalidAuthenticityToken' }
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::UnknownAction' }
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'AbstractController::ActionNotFound' }
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionView::MissingTemplate' }
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::UnknownFormat' }
notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::RoutingError' && error[:message] =~ %r{\[GET\]} }
end

View file

@ -1,29 +0,0 @@
HoptoadNotifier.configure do |config|
# Change this to some sensible data for your errbit instance
config.api_key = ENV['OSEM_ERRBIT_APIKEY'] || Rails.application.secrets.errbit_key || ''
config.host = ENV['OSEM_ERRBIT_HOST']
if config.api_key.blank? || config.host.blank?
config.development_environments = 'production development test'
else
config.development_environments = 'development test'
end
config.ignore_only = %w{
ActiveRecord::RecordNotFound
ActionController::InvalidAuthenticityToken
ActionController::UnknownAction
AbstractController::ActionNotFound
ActionView::MissingTemplate
ActionController::UnknownFormat
}
config.ignore_by_filter do |exception_data|
ret=false
if exception_data[:error_class] == 'ActionController::RoutingError'
message = exception_data[:error_message]
ret=true if message =~ %r{\[GET\]}
end
ret
end
end