Skip to content

Commit

Permalink
Switch airbrake mgmt to defra-ruby-alert (#395)
Browse files Browse the repository at this point in the history
Whilst working on an issue for the [Flood Risk Activity Exemptions service](https://github.com/DEFRA/ruby-services-team/tree/master/services/frae) we came across an [issue](DEFRA/flood-risk-engine#312) with Airbrake.

We wanted to add a new Rake task, and we wanted to apply our new pattern of ensuring Airbrake is closed when the task exits to ensure any errors are reported. The problem was due to the age of the Airbrake gem being used this caused an error in FRAE we hadn't seen in WEX and WCR.

So for reasons outlined in [FRAE PR 312](DEFRA/flood-risk-engine#312) we came up with [defra-ruby-alert](https://github.com/DEFRA/defra-ruby-alert). The idea is going forward this will provide a single interface for configuring Airbrake and ensure the pattern of making sure all exceptions are reported before an app closes is applied consistently in all scenarios.

The main changes to enable this have been applied to the [waste-carriers-engine](DEFRA/waste-carriers-engine#657).

These changes finalise the implementation for the front-office, switching out requiring and configuring Airbrake directly, to passing config details through to the WCR engine for it to do it.
  • Loading branch information
Cruikshanks committed Feb 7, 2020
1 parent c88d0a8 commit b08866b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 73 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
source "https://rubygems.org"
ruby "2.4.2"

# Use Airbrake for error reporting to Errbit
# Version 6 and above cause errors with Errbit, so use 5.8.1 for now
gem "airbrake", "5.8.1"
# Use CoffeeScript for .coffee assets and views
gem "coffee-rails", "~> 4.1.0"
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
Expand Down
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
GIT
remote: https://github.com/DEFRA/waste-carriers-engine
revision: af386580ef1f426f691fccfc4c87fb231d35a81a
revision: 7c2cb01a0227a02c2481cacf6271584027a634f9
branch: master
specs:
waste_carriers_engine (0.0.1)
aasm (~> 4.12)
countries
defra_ruby_alert (~> 1.0.0)
defra_ruby_validators
high_voltage (~> 3.0)
jbuilder (~> 2.0)
Expand Down Expand Up @@ -88,6 +89,8 @@ GEM
crass (1.0.6)
database_cleaner (1.8.2)
debug_inspector (0.0.3)
defra_ruby_alert (1.0.0)
airbrake (~> 5.8.1)
defra_ruby_mocks (1.3.0)
nokogiri
rails (~> 4.2.11.1)
Expand Down Expand Up @@ -346,7 +349,6 @@ PLATFORMS
ruby

DEPENDENCIES
airbrake (= 5.8.1)
aws-healthcheck
byebug
cancancan (~> 1.10)
Expand Down
68 changes: 0 additions & 68 deletions config/initializers/airbrake.rb

This file was deleted.

7 changes: 7 additions & 0 deletions config/initializers/waste_carriers_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
if ENV["WCRS_MOCK_ENABLED"].to_s.downcase == "true"
configuration.companies_house_host = ENV["WCRS_MOCK_BO_COMPANIES_HOUSE_URL"]
end

# Configure airbrake, which is done via the engine using defra_ruby_alert
configuration.airbrake_enabled = ENV["WCRS_USE_AIRBRAKE"]
configuration.airbrake_host = ENV["WCRS_AIRBRAKE_URL"]
configuration.airbrake_project_key = ENV["WCRS_FRONTOFFICE_AIRBRAKE_PROJECT_KEY"]
configuration.airbrake_blacklist = [/password/i, /authorization/i]
end
WasteCarriersEngine.start_airbrake

0 comments on commit b08866b

Please sign in to comment.