govuk_app_config 3.1.1 → 4.0.0.pre.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: 20aaa15a96de29af59424ad9889d8020af8964c557089dc11c429ef38d67513c
4
- data.tar.gz: 6e20e3346f6bf65927b4a4835f1c45f9da92c3daf2f261c6f9fc433f9620b8be
3
+ metadata.gz: 2b08ba5468f1f0639c3dab2c7067d7a3acff2169ce85a246ceb2a976b04686a7
4
+ data.tar.gz: ce9d8876d37175726d4aa81633e4b11232975dd3d65d24bca6ac58b219248b09
5
5
  SHA512:
6
- metadata.gz: 47386015166932a21469cb73fd7be967293a61b244b72f1f1bc5fc8065131a2ffd805441a2813d3bbc182754624b78ee866cb2f3baa6ebcc954b3041076c8477
7
- data.tar.gz: 77833ef66a28baf07a35cdb033f2fb44a2d259392b53b61cc5cf8e4e6df82ca15bdeeab96aecc309506f6b0ed4187be4be3dde3b00aed717056d5230e3a69387
6
+ metadata.gz: a0eb71467c7fa26805e5606bec9f96312c6bb5e0f0d0ef3b93e1a8cfa5d556164f5ac537c9606416724eb93acbef298f57163a16876ddb5ba48b5dea05c94227
7
+ data.tar.gz: cae07877f651a180c2c62a7fd32a15714421e2dfee5c7fda5957d7601d5cd99c57e110c3b2071d7d5a4dac62c924e662c1dc70379f206b5de849ac373999d3e4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 4.0.0.pre-1
2
+
3
+ - BREAKING: upgrades Sentry gem from `sentry-raven` to `sentry-ruby` ([#199](https://github.com/alphagov/govuk_app_config/pull/199)). There is a **[migration guide](https://docs.sentry.io/platforms/ruby/migration/)** you should follow before upgrading to this version of govuk_app_config.
4
+ - This release also fixes the `data_sync_excluded_exceptions` behaviour that has been broken since v3.1.0.
5
+ - Released as a pre-release to identify and fix any problems before a wider rollout.
6
+
1
7
  # 3.1.1
2
8
 
3
9
  - Fix the new before_send behaviour & tests, and add documentation ([#197](https://github.com/alphagov/govuk_app_config/pull/197))
data/README.md CHANGED
@@ -116,8 +116,8 @@ and occurs at the time of a data sync, then it will be excluded even if the cust
116
116
 
117
117
  ```ruby
118
118
  GovukError.configure do |config|
119
- config.before_send = lambda do |error_or_event|
120
- error_or_event == "do capture" ? error_or_event : nil
119
+ config.before_send = lambda do |event, hint|
120
+ hint[:exception].is_a?(ErrorWeWantToIgnore) ? nil : event
121
121
  end
122
122
  end
123
123
  ```
@@ -13,15 +13,15 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/alphagov/govuk_app_config"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
18
- end
16
+ spec.required_ruby_version = ">= 2.6"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
19
  spec.bindir = "exe"
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = %w[lib]
22
22
 
23
23
  spec.add_dependency "logstasher", ">= 1.2.2", "< 2.2.0"
24
- spec.add_dependency "sentry-raven", "~> 3.1.1"
24
+ spec.add_dependency "sentry-ruby", "~> 4.5.0"
25
25
  spec.add_dependency "statsd-ruby", "~> 1.5.0"
26
26
  spec.add_dependency "unicorn", ">= 5.4", "< 5.9"
27
27
 
@@ -1,4 +1,4 @@
1
- require "sentry-raven"
1
+ require "sentry-ruby"
2
2
  require "govuk_app_config/govuk_statsd"
3
3
  require "govuk_app_config/govuk_error/configuration"
4
4
  require "govuk_app_config/version"
@@ -13,11 +13,11 @@ module GovukError
13
13
  args[:tags] ||= {}
14
14
  args[:tags][:govuk_app_config_version] = GovukAppConfig::VERSION
15
15
 
16
- Raven.capture_exception(exception_or_message, args)
16
+ Sentry.capture_exception(exception_or_message, args)
17
17
  end
18
18
 
19
19
  def self.configure
20
- @configuration ||= Configuration.new(Raven.configuration)
20
+ @configuration ||= Configuration.new(Sentry::Configuration.new)
21
21
  yield @configuration
22
22
  end
23
23
  end
@@ -6,7 +6,7 @@ module GovukError
6
6
  attr_reader :data_sync, :sentry_environment
7
7
  attr_accessor :active_sentry_environments, :data_sync_excluded_exceptions
8
8
 
9
- def initialize(_raven_configuration)
9
+ def initialize(_sentry_configuration)
10
10
  super
11
11
  @sentry_environment = ENV["SENTRY_CURRENT_ENV"]
12
12
  @data_sync = GovukDataSync.new(ENV["GOVUK_DATA_SYNC_PERIOD"])
@@ -27,14 +27,14 @@ module GovukError
27
27
  protected
28
28
 
29
29
  def ignore_exceptions_if_not_in_active_sentry_env
30
- ->(error_or_event, _hint) { error_or_event if active_sentry_environments.include?(sentry_environment) }
30
+ ->(event, _hint) { event if active_sentry_environments.include?(sentry_environment) }
31
31
  end
32
32
 
33
33
  def ignore_excluded_exceptions_in_data_sync
34
- lambda { |error_or_event, _hint|
34
+ lambda { |event, hint|
35
35
  data_sync_ignored_error = data_sync_excluded_exceptions.any? do |exception_to_ignore|
36
36
  exception_to_ignore = Object.const_get(exception_to_ignore) unless exception_to_ignore.is_a?(Module)
37
- exception_chain = Raven::Utils::ExceptionCauseChain.exception_to_array(error_or_event)
37
+ exception_chain = Sentry::Utils::ExceptionCauseChain.exception_to_array(hint[:exception])
38
38
  exception_chain.any? { |exception| exception.is_a?(exception_to_ignore) }
39
39
  rescue NameError
40
40
  # the exception type represented by the exception_to_ignore string
@@ -42,23 +42,25 @@ module GovukError
42
42
  false
43
43
  end
44
44
 
45
- error_or_event unless data_sync.in_progress? && data_sync_ignored_error
45
+ event unless data_sync.in_progress? && data_sync_ignored_error
46
46
  }
47
47
  end
48
48
 
49
49
  def increment_govuk_statsd_counters
50
- lambda { |error_or_event, _hint|
51
- GovukStatsd.increment("errors_occurred")
52
- GovukStatsd.increment("error_types.#{error_or_event.class.name.demodulize.underscore}")
53
- error_or_event
50
+ lambda { |event, hint|
51
+ if hint[:exception]
52
+ GovukStatsd.increment("errors_occurred")
53
+ GovukStatsd.increment("error_types.#{hint[:exception].class.name.split('::').last.underscore}")
54
+ end
55
+ event
54
56
  }
55
57
  end
56
58
 
57
59
  def run_before_send_callbacks
58
- lambda do |error_or_event, hint|
59
- result = error_or_event
60
+ lambda do |event, hint|
61
+ result = event
60
62
  @before_send_callbacks.each do |callback|
61
- result = callback.call(error_or_event, hint)
63
+ result = callback.call(event, hint)
62
64
  break if result.nil?
63
65
  end
64
66
  result
@@ -3,14 +3,8 @@ require "time"
3
3
  module GovukError
4
4
  class GovukDataSync
5
5
  class MalformedDataSyncPeriod < RuntimeError
6
- attr_reader :invalid_value
7
-
8
6
  def initialize(invalid_value)
9
- @invalid_value = invalid_value
10
- end
11
-
12
- def message
13
- "\"#{invalid_value}\" is not a valid value (should be of form '22:00-03:00')."
7
+ super("\"#{invalid_value}\" is not a valid value (should be of form '22:00-03:00').")
14
8
  end
15
9
  end
16
10
 
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "3.1.1".freeze
2
+ VERSION = "4.0.0.pre.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: 3.1.1
4
+ version: 4.0.0.pre.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: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -31,19 +31,19 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.2.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: sentry-raven
34
+ name: sentry-ruby
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 3.1.1
39
+ version: 4.5.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 3.1.1
46
+ version: 4.5.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: statsd-ruby
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -258,14 +258,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
258
  requirements:
259
259
  - - ">="
260
260
  - !ruby/object:Gem::Version
261
- version: '0'
261
+ version: '2.6'
262
262
  required_rubygems_version: !ruby/object:Gem::Requirement
263
263
  requirements:
264
- - - ">="
264
+ - - ">"
265
265
  - !ruby/object:Gem::Version
266
- version: '0'
266
+ version: 1.3.1
267
267
  requirements: []
268
- rubygems_version: 3.1.4
268
+ rubygems_version: 3.0.3
269
269
  signing_key:
270
270
  specification_version: 4
271
271
  summary: Base configuration for GOV.UK applications