From f28da80fafa131620124f781714ec97687a9f39c Mon Sep 17 00:00:00 2001 From: ChrisBAshton Date: Tue, 20 Oct 2020 13:18:16 +0100 Subject: [PATCH] Remove unneeded `should_capture` code As of govuk_app_config 2.5.0, excluding errors of type `PG::Error` that occur during the data sync on integration/staging now happens automatically. See /~https://github.com/alphagov/govuk_app_config/pull/160 Trello: https://trello.com/c/rAlvGlSp/2123-5-ignore-data-sync-errors-in-govukappconfig --- Gemfile.lock | 10 ++++++---- config/initializers/govuk_error.rb | 16 ---------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6aab418c1..b5d238a9a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -101,8 +101,9 @@ GEM factory_bot_rails (6.1.0) factory_bot (~> 6.1.0) railties (>= 5.0.0) - faraday (1.0.1) + faraday (1.1.0) multipart-post (>= 1.2, < 3) + ruby2_keywords ffi (1.13.1) fugit (1.3.6) et-orbi (~> 1.1, >= 1.1.8) @@ -123,9 +124,9 @@ GEM warden-oauth2 (~> 0.0.1) globalid (0.4.2) activesupport (>= 4.2.0) - govuk_app_config (2.4.0) + govuk_app_config (2.5.0) logstasher (>= 1.2.2, < 1.4.0) - sentry-raven (>= 2.7.1, < 3.1.0) + sentry-raven (~> 3.1.1) statsd-ruby (~> 1.4.0) unicorn (>= 5.4, < 5.8) govuk_document_types (0.9.2) @@ -307,10 +308,11 @@ GEM rubocop-rspec (1.42.0) rubocop (>= 0.87.0) ruby-progressbar (1.10.1) + ruby2_keywords (0.0.2) rufus-scheduler (3.6.0) fugit (~> 1.1, >= 1.1.6) safe_yaml (1.0.5) - sentry-raven (3.0.4) + sentry-raven (3.1.1) faraday (>= 1.0) sidekiq (5.2.9) connection_pool (~> 2.2, >= 2.2.2) diff --git a/config/initializers/govuk_error.rb b/config/initializers/govuk_error.rb index 281215d46..6201a5e3e 100644 --- a/config/initializers/govuk_error.rb +++ b/config/initializers/govuk_error.rb @@ -1,19 +1,3 @@ GovukError.configure do |config| config.excluded_exceptions << "DeliveryRequestWorker::ProviderCommunicationFailureError" - - # Don't capture postgres errors that occur during the time that the data sync - # is running in integration and staging environments - # This lambda is called with Ruby Exception objects, Raven::Event objects - # and may be called with other types. - config.should_capture = lambda do |error_or_event| - data_sync_ignored_error = error_or_event.is_a?(PG::Error) || - (error_or_event.respond_to?(:cause) && error_or_event.cause.is_a?(PG::Error)) - - data_sync_environment = ENV.fetch("SENTRY_CURRENT_ENV", "") - .match(/integration|staging/) - - data_sync_time = Time.zone.now.hour <= 8 - - !(data_sync_ignored_error && data_sync_environment && data_sync_time) - end end