Class: GovukError::Configuration
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- GovukError::Configuration
- Defined in:
- lib/govuk_app_config/govuk_error/configuration.rb
Instance Attribute Summary collapse
-
#data_sync ⇒ Object
readonly
Returns the value of attribute data_sync.
-
#data_sync_excluded_exceptions ⇒ Object
Returns the value of attribute data_sync_excluded_exceptions.
Instance Method Summary collapse
- #before_send=(closure) ⇒ Object
-
#initialize(_sentry_configuration) ⇒ Configuration
constructor
A new instance of Configuration.
- #set_up_defaults ⇒ Object
Constructor Details
#initialize(_sentry_configuration) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 |
# File 'lib/govuk_app_config/govuk_error/configuration.rb', line 9 def initialize(_sentry_configuration) super @data_sync = GovukDataSync.new(ENV["GOVUK_DATA_SYNC_PERIOD"]) set_up_defaults end |
Instance Attribute Details
#data_sync ⇒ Object (readonly)
Returns the value of attribute data_sync.
6 7 8 |
# File 'lib/govuk_app_config/govuk_error/configuration.rb', line 6 def data_sync @data_sync end |
#data_sync_excluded_exceptions ⇒ Object
Returns the value of attribute data_sync_excluded_exceptions.
7 8 9 |
# File 'lib/govuk_app_config/govuk_error/configuration.rb', line 7 def data_sync_excluded_exceptions @data_sync_excluded_exceptions end |
Instance Method Details
#before_send=(closure) ⇒ Object
82 83 84 85 |
# File 'lib/govuk_app_config/govuk_error/configuration.rb', line 82 def before_send=(closure) @before_send_callbacks.insert(-2, closure) super(run_before_send_callbacks) end |
#set_up_defaults ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/govuk_app_config/govuk_error/configuration.rb', line 15 def set_up_defaults self.excluded_exceptions = [ # Default ActionDispatch rescue responses "ActionController::RoutingError", "AbstractController::ActionNotFound", "ActionController::MethodNotAllowed", "ActionController::UnknownHttpMethod", "ActionController::NotImplemented", "ActionController::UnknownFormat", "Mime::Type::InvalidMimeType", "ActionController::MissingExactTemplate", "ActionController::InvalidAuthenticityToken", "ActionController::InvalidCrossOriginRequest", "ActionDispatch::Http::Parameters::ParseError", "ActionController::BadRequest", "ActionController::ParameterMissing", "Rack::QueryParser::ParameterTypeError", "Rack::QueryParser::InvalidParameterError", # Default ActiveRecord rescue responses "ActiveRecord::RecordNotFound", "ActiveRecord::StaleObjectError", "ActiveRecord::RecordInvalid", "ActiveRecord::RecordNotSaved", # Additional items "ActiveJob::DeserializationError", "CGI::Session::CookieStore::TamperedWithCookie", "GdsApi::HTTPIntermittentServerError", "GdsApi::TimedOutException", "GDS::SSO::PermissionDeniedError", "Mongoid::Errors::DocumentNotFound", "Puma::HttpParserError", "Sinatra::NotFound", "Slimmer::IntermittentRetrievalError", "Slimmer::SourceWrapperNotFoundError", "Sidekiq::JobRetry::Skip", "Sanitiser::Strategy::SanitisingError", "SignalException", ] # This will exclude exceptions that are triggered by one of the ignored # exceptions. For example, when any exception occurs in a template, # Rails will raise a ActionView::Template::Error, instead of the original error. self.inspect_exception_causes_for_exclusion = true # List of exceptions to ignore if they take place during the data sync. # Some errors are transient in nature, e.g. PostgreSQL databases being # unavailable, and add little value. In fact, their presence can greatly # increase the number of errors being sent and risk genuine errors being # rate-limited by Sentry. self.data_sync_excluded_exceptions = [ "PG::Error", "GdsApi::ContentStore::ItemNotFound", ] # Avoid "Sending envelope with items ... to Sentry" logspew, since we # don't use Sentry's automatic session tracking. self.auto_session_tracking = false @before_send_callbacks = [ ignore_excluded_exceptions_in_data_sync, increment_govuk_statsd_counters, ] # Need to invoke an arbitrary `before_send=` in order to trigger the # `before_send_callbacks` behaviour self.before_send = ->(error_or_event, _hint) { error_or_event } end |