Merge pull request #3624 from consul/add_errbit_support
Add support for Errbit self-hosted exception management
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -5,6 +5,7 @@ gem "rails", "5.1.7"
|
|||||||
gem "acts-as-taggable-on", "~> 6.5.0"
|
gem "acts-as-taggable-on", "~> 6.5.0"
|
||||||
gem "acts_as_votable", "~> 0.11.1"
|
gem "acts_as_votable", "~> 0.11.1"
|
||||||
gem "ahoy_matey", "~> 1.6.0"
|
gem "ahoy_matey", "~> 1.6.0"
|
||||||
|
gem "airbrake", "~> 5.0"
|
||||||
gem "ancestry", "~> 3.0.7"
|
gem "ancestry", "~> 3.0.7"
|
||||||
gem "audited", "~> 4.9.0"
|
gem "audited", "~> 4.9.0"
|
||||||
gem "autoprefixer-rails", "~> 8.2.0"
|
gem "autoprefixer-rails", "~> 8.2.0"
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ GEM
|
|||||||
safely_block (>= 0.1.1)
|
safely_block (>= 0.1.1)
|
||||||
user_agent_parser
|
user_agent_parser
|
||||||
uuidtools
|
uuidtools
|
||||||
|
airbrake (5.8.1)
|
||||||
|
airbrake-ruby (~> 1.8)
|
||||||
|
airbrake-ruby (1.8.0)
|
||||||
airbrussh (1.4.0)
|
airbrussh (1.4.0)
|
||||||
sshkit (>= 1.6.1, != 1.7.0)
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
akami (1.3.1)
|
akami (1.3.1)
|
||||||
@@ -621,6 +624,7 @@ DEPENDENCIES
|
|||||||
acts-as-taggable-on (~> 6.5.0)
|
acts-as-taggable-on (~> 6.5.0)
|
||||||
acts_as_votable (~> 0.11.1)
|
acts_as_votable (~> 0.11.1)
|
||||||
ahoy_matey (~> 1.6.0)
|
ahoy_matey (~> 1.6.0)
|
||||||
|
airbrake (~> 5.0)
|
||||||
ancestry (~> 3.0.7)
|
ancestry (~> 3.0.7)
|
||||||
audited (~> 4.9.0)
|
audited (~> 4.9.0)
|
||||||
autoprefixer-rails (~> 8.2.0)
|
autoprefixer-rails (~> 8.2.0)
|
||||||
|
|||||||
31
config/initializers/errbit.rb
Normal file
31
config/initializers/errbit.rb
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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]
|
||||||
|
config.ignore_environments += [Rails.env] if Rails.application.secrets.errbit_project_id.blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
Airbrake.add_filter do |notice|
|
||||||
|
ignorables = %w[ActiveRecord::RecordNotFound]
|
||||||
|
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
|
||||||
@@ -7,7 +7,7 @@ Rollbar.configure do |config|
|
|||||||
|
|
||||||
# Here we'll disable all environments except 'staging', 'preproduction' and 'production':
|
# Here we'll disable all environments except 'staging', 'preproduction' and 'production':
|
||||||
if Rails.env.staging? || Rails.env.preproduction? || Rails.env.production?
|
if Rails.env.staging? || Rails.env.preproduction? || Rails.env.production?
|
||||||
config.enabled = true
|
config.enabled = Rails.application.secrets.rollbar_server_token.present?
|
||||||
else
|
else
|
||||||
config.enabled = false
|
config.enabled = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ staging:
|
|||||||
# :enable_starttls_auto: true
|
# :enable_starttls_auto: true
|
||||||
force_ssl: true
|
force_ssl: true
|
||||||
delay_jobs: true
|
delay_jobs: true
|
||||||
|
errbit_host: ""
|
||||||
|
errbit_project_key: ""
|
||||||
|
errbit_project_id: 1
|
||||||
|
errbit_self_hosted_ssl: false
|
||||||
rollbar_server_token: ""
|
rollbar_server_token: ""
|
||||||
http_basic_username: ""
|
http_basic_username: ""
|
||||||
http_basic_password: ""
|
http_basic_password: ""
|
||||||
@@ -66,6 +70,10 @@ preproduction:
|
|||||||
# :enable_starttls_auto: true
|
# :enable_starttls_auto: true
|
||||||
force_ssl: true
|
force_ssl: true
|
||||||
delay_jobs: true
|
delay_jobs: true
|
||||||
|
errbit_host: ""
|
||||||
|
errbit_project_key: ""
|
||||||
|
errbit_project_id: 1
|
||||||
|
errbit_self_hosted_ssl: false
|
||||||
rollbar_server_token: ""
|
rollbar_server_token: ""
|
||||||
http_basic_username: ""
|
http_basic_username: ""
|
||||||
http_basic_password: ""
|
http_basic_password: ""
|
||||||
@@ -94,6 +102,10 @@ production:
|
|||||||
# :enable_starttls_auto: true
|
# :enable_starttls_auto: true
|
||||||
force_ssl: true
|
force_ssl: true
|
||||||
delay_jobs: true
|
delay_jobs: true
|
||||||
|
errbit_host: ""
|
||||||
|
errbit_project_key: ""
|
||||||
|
errbit_project_id: 1
|
||||||
|
errbit_self_hosted_ssl: false
|
||||||
rollbar_server_token: ""
|
rollbar_server_token: ""
|
||||||
http_basic_username: ""
|
http_basic_username: ""
|
||||||
http_basic_password: ""
|
http_basic_password: ""
|
||||||
|
|||||||
Reference in New Issue
Block a user