govuk_app_config 2.5.2 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac69416b5c20576e14410fd9f46d4b0992b13d823b64983f702ea0226dc40461
4
- data.tar.gz: eb47104d4c81dc24f9c6919d650a21acc388986948819a971294a46594bc7ea1
3
+ metadata.gz: 9ecfcca9fa13215a2bcc0771733d647f3efbeed1f92d6b2a37da4ee55ca1f279
4
+ data.tar.gz: e149048f64bf194cc831a771258e99128afbb038a99007ca52ead1582d482884
5
5
  SHA512:
6
- metadata.gz: 171a7f28f2d6daf265b3829a487d8b2b6a355915a535f9d3c728edce1f4d6bf89aa8163e11c37ce0c5976cd18f6c7ca9a5bddf3ca0bca4ccbdf3453d19470c9f
7
- data.tar.gz: cc5a3382d6fdc1ce5ac1cd868c18fc6e7a77b68d8da04d32190c1317ec8def77969dab9528821cea8e5257676f7a15155fced541148dfd8c4dd850f342235005
6
+ metadata.gz: 1df4fc870c49679442395ff7b2240bdb8f810f06117b87bcb2adb5dab542f4afca901e09b5292542d0a655c6851092bd2947e77ea0935644a0d7f91c982040df
7
+ data.tar.gz: 51172f8ab6ca1fdb4c0093502b230af01a6fcafa989566bd4d811025939d175df17405ec20331b3c8eeff026c18e0a2a03154cb2e19c2186ff03312734a3158b
@@ -1,3 +1,24 @@
1
+ # 2.8.1
2
+
3
+ * Add `GdsApi::ContentStore::ItemNotFound` to `data_sync_excluded_exceptions` (https://github.com/alphagov/govuk_app_config/pull/178)
4
+ * Dependabot bumps to allow latest versions of logstasher ([#177](https://github.com/alphagov/govuk_app_config/pull/177)) and unicorn ([#175](https://github.com/alphagov/govuk_app_config/pull/175))
5
+
6
+ # 2.8.0
7
+
8
+ * Adds govuk_app_config version to every Sentry call (https://github.com/alphagov/govuk_app_config/pull/174)
9
+
10
+ # 2.7.1
11
+
12
+ * Fix broken data sync error handling for non-Rails apps (https://github.com/alphagov/govuk_app_config/pull/172)
13
+
14
+ # 2.7.0
15
+
16
+ * Ignore intermittent template retrieval errors from Slimmer (https://github.com/alphagov/govuk_app_config/pull/170)
17
+
18
+ # 2.6.0
19
+
20
+ * Ignore errors that occur in temporary environments (adds `active_sentry_environments` config) (https://github.com/alphagov/govuk_app_config/pull/168)
21
+
1
22
  # 2.5.2
2
23
 
3
24
  * Fix govuk_app_config in Ruby 2.7 environments by explicitly requiring the 'delegate' library (https://github.com/alphagov/govuk_app_config/pull/167)
data/README.md CHANGED
@@ -51,7 +51,7 @@ If you include `govuk_app_config` in your `Gemfile`, Rails' autoloading mechanis
51
51
  Your app will have to have the following environment variables set:
52
52
 
53
53
  - `SENTRY_DSN` - the [Data Source Name (DSN)][dsn] for Sentry
54
- - `SENTRY_CURRENT_ENV` - production, staging or integration
54
+ - `SENTRY_CURRENT_ENV` - e.g. "production". Make sure it is [configured to be active](#active-sentry-environments).
55
55
  - `GOVUK_STATSD_PREFIX` - a Statsd prefix like `govuk.apps.application-name.hostname`
56
56
 
57
57
  [dsn]: https://docs.sentry.io/quickstart/#about-the-dsn
@@ -79,6 +79,18 @@ GovukError.notify(
79
79
  )
80
80
  ```
81
81
 
82
+ ### Active Sentry environments
83
+
84
+ GovukError will only send errors to Sentry if your `SENTRY_CURRENT_ENV` matches one of the 'active environments' in the [default configuration](https://github.com/alphagov/govuk_app_config/blob/master/lib/govuk_app_config/govuk_error/configure.rb). This is to prevent temporary test environments from flooding our Sentry account with errors.
85
+
86
+ You can add your environment to the list of active Sentry environments like so:
87
+
88
+ ```ruby
89
+ GovukError.configure do |config|
90
+ config.active_sentry_environments << "my-test-environment"
91
+ end
92
+ ```
93
+
82
94
  ### Error configuration
83
95
 
84
96
  You can exclude certain errors from being reported using this:
@@ -20,18 +20,18 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = %w[lib]
22
22
 
23
- spec.add_dependency "logstasher", ">= 1.2.2", "< 1.4.0"
23
+ spec.add_dependency "logstasher", ">= 1.2.2", "< 2.2.0"
24
24
  spec.add_dependency "sentry-raven", "~> 3.1.1"
25
25
  spec.add_dependency "statsd-ruby", "~> 1.4.0"
26
- spec.add_dependency "unicorn", ">= 5.4", "< 5.8"
26
+ spec.add_dependency "unicorn", ">= 5.4", "< 5.9"
27
27
 
28
28
  spec.add_development_dependency "byebug"
29
29
  spec.add_development_dependency "climate_control"
30
- spec.add_development_dependency "rack-test", "~> 1.1.0"
30
+ spec.add_development_dependency "rack-test", "~> 1.1"
31
31
  spec.add_development_dependency "rails", "~> 6"
32
32
  spec.add_development_dependency "rake", "~> 13.0"
33
- spec.add_development_dependency "rspec", "~> 3.9.0"
34
- spec.add_development_dependency "rspec-its", "~> 1.3.0"
33
+ spec.add_development_dependency "rspec", "~> 3.10"
34
+ spec.add_development_dependency "rspec-its", "~> 1.3"
35
35
  spec.add_development_dependency "rubocop-govuk"
36
36
  spec.add_development_dependency "webmock"
37
37
  end
@@ -1,6 +1,7 @@
1
1
  require "sentry-raven"
2
2
  require "govuk_app_config/govuk_statsd"
3
3
  require "govuk_app_config/govuk_error/configuration"
4
+ require "govuk_app_config/version"
4
5
 
5
6
  module GovukError
6
7
  def self.notify(exception_or_message, args = {})
@@ -9,6 +10,9 @@ module GovukError
9
10
  args[:extra] ||= {}
10
11
  args[:extra].merge!(parameters: args.delete(:parameters))
11
12
 
13
+ args[:tags] ||= {}
14
+ args[:tags][:govuk_app_config_version] = GovukAppConfig::VERSION
15
+
12
16
  Raven.capture_exception(exception_or_message, args)
13
17
  end
14
18
 
@@ -3,19 +3,21 @@ require "govuk_app_config/govuk_error/govuk_data_sync"
3
3
 
4
4
  module GovukError
5
5
  class Configuration < SimpleDelegator
6
- attr_reader :data_sync
7
- attr_accessor :data_sync_excluded_exceptions
6
+ attr_reader :data_sync, :sentry_environment
7
+ attr_accessor :active_sentry_environments, :data_sync_excluded_exceptions
8
8
 
9
9
  def initialize(_raven_configuration)
10
10
  super
11
+ @sentry_environment = ENV["SENTRY_CURRENT_ENV"]
11
12
  @data_sync = GovukDataSync.new(ENV["GOVUK_DATA_SYNC_PERIOD"])
13
+ self.active_sentry_environments = []
12
14
  self.data_sync_excluded_exceptions = []
13
- self.should_capture = ignore_excluded_exceptions_in_data_sync
15
+ self.should_capture = ignore_exceptions_based_on_env_and_data_sync
14
16
  end
15
17
 
16
18
  def should_capture=(closure)
17
19
  combined = lambda do |error_or_event|
18
- (ignore_excluded_exceptions_in_data_sync.call(error_or_event) && closure.call(error_or_event))
20
+ (ignore_exceptions_based_on_env_and_data_sync.call(error_or_event) && closure.call(error_or_event))
19
21
  end
20
22
 
21
23
  super(combined)
@@ -23,6 +25,17 @@ module GovukError
23
25
 
24
26
  protected
25
27
 
28
+ def ignore_exceptions_based_on_env_and_data_sync
29
+ lambda do |error_or_event|
30
+ ignore_exceptions_if_not_in_active_sentry_env.call(error_or_event) &&
31
+ ignore_excluded_exceptions_in_data_sync.call(error_or_event)
32
+ end
33
+ end
34
+
35
+ def ignore_exceptions_if_not_in_active_sentry_env
36
+ ->(_error_or_event) { active_sentry_environments.include?(sentry_environment) }
37
+ end
38
+
26
39
  def ignore_excluded_exceptions_in_data_sync
27
40
  lambda { |error_or_event|
28
41
  data_sync_ignored_error = data_sync_excluded_exceptions.any? do |exception_to_ignore|
@@ -7,6 +7,16 @@ GovukError.configure do |config|
7
7
 
8
8
  config.silence_ready = !Rails.env.production? if defined?(Rails)
9
9
 
10
+ # These are the environments (described by the `SENTRY_CURRENT_ENV`
11
+ # ENV variable) where we want to capture Sentry errors. If
12
+ # `SENTRY_CURRENT_ENV` isn't in this list, or isn't defined, then
13
+ # don't capture the error.
14
+ config.active_sentry_environments = %w[
15
+ integration-blue-aws
16
+ staging
17
+ production
18
+ ]
19
+
10
20
  config.excluded_exceptions = [
11
21
  # Default ActionDispatch rescue responses
12
22
  "ActionController::RoutingError",
@@ -36,6 +46,7 @@ GovukError.configure do |config|
36
46
  "GdsApi::TimedOutException",
37
47
  "Mongoid::Errors::DocumentNotFound",
38
48
  "Sinatra::NotFound",
49
+ "Slimmer::IntermittentRetrievalError",
39
50
  ]
40
51
 
41
52
  # This will exclude exceptions that are triggered by one of the ignored
@@ -50,6 +61,7 @@ GovukError.configure do |config|
50
61
  # rate-limited by Sentry.
51
62
  config.data_sync_excluded_exceptions = [
52
63
  "PG::Error",
64
+ "GdsApi::ContentStore::ItemNotFound",
53
65
  ]
54
66
 
55
67
  config.transport_failure_callback = proc {
@@ -28,7 +28,7 @@ module GovukError
28
28
  end
29
29
 
30
30
  def in_progress?
31
- from.present? && to.present? && in_time_range?(from, to)
31
+ !from.nil? && !to.nil? && in_time_range?(from, to)
32
32
  end
33
33
 
34
34
  private
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "2.5.2".freeze
2
+ VERSION = "2.8.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 1.2.2
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.0
22
+ version: 2.2.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 1.2.2
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 1.4.0
32
+ version: 2.2.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: sentry-raven
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '5.4'
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
- version: '5.8'
70
+ version: '5.9'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '5.4'
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
- version: '5.8'
80
+ version: '5.9'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: byebug
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -112,14 +112,14 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 1.1.0
115
+ version: '1.1'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: 1.1.0
122
+ version: '1.1'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: rails
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -154,28 +154,28 @@ dependencies:
154
154
  requirements:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
- version: 3.9.0
157
+ version: '3.10'
158
158
  type: :development
159
159
  prerelease: false
160
160
  version_requirements: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
- version: 3.9.0
164
+ version: '3.10'
165
165
  - !ruby/object:Gem::Dependency
166
166
  name: rspec-its
167
167
  requirement: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - "~>"
170
170
  - !ruby/object:Gem::Version
171
- version: 1.3.0
171
+ version: '1.3'
172
172
  type: :development
173
173
  prerelease: false
174
174
  version_requirements: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
- version: 1.3.0
178
+ version: '1.3'
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: rubocop-govuk
181
181
  requirement: !ruby/object:Gem::Requirement