govuk_app_config 4.5.0 → 4.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9adf3a7bee21ade140141a007885695bba39c0f968216960f0b7736cdc995ab4
4
- data.tar.gz: 9d32f18cdd2517bd50456b2d5824ecfb01f1ba5de9752c5d7b43f42b3341f2df
3
+ metadata.gz: 0f3849d5bf53877e6244bcda92162ec86e9a37c5788a491e1f436af79da3433e
4
+ data.tar.gz: 8d198f89774cf5962ae877e5437bff4025123c102645ac7d4a2b81b2525ef0c3
5
5
  SHA512:
6
- metadata.gz: 8a4d51406523a7c93a59c49cf6ebb65af9e1659c3188ac2772f8a664a332be9c5608af669a48b23fb33d5e780d4a548a8e5b75fd3b82a8a79ff69661c76f485e
7
- data.tar.gz: 1e70b03b2026eba3e77ea20d570edbc9728140d88b6e0448f9290c762c2cb8fbf7b28bbcc1efce39e168244ac6e703aed843652aa4ca47acb85265205b09a785
6
+ metadata.gz: e5c4e6173b2c7b41ff37430b603bb1d04dcc108fd24c4b374f2d4731512ce780fb1dd43d7bdd13a0bdc4e0948be48f4a6a6913cabb337ff1afe5a3110213d650
7
+ data.tar.gz: 3a810d79466ce2780c3e19b77da1edaf3a98546cc0ddbb28f6e10deb20558bc8a2eac44e1777af90be739138059176401535d75ff1bb918362e855fccb7ce1ca
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 2.7.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 4.6.2
2
+
3
+ - Adds a new domain to the security policy for GA ([#248](https://https://github.com/alphagov/govuk_app_config/pull/248))
4
+
5
+ # 4.6.1
6
+
7
+ - Fixes warning message to refer to correct Sidekiq gem dependency name ([#243](https://github.com/alphagov/govuk_app_config/pull/243)).
8
+
9
+ # 4.6.0
10
+
11
+ - Add a warning for apps using GovukError with Sidekiq that don't have sentry-sidekiq installed ([#241](https://github.com/alphagov/govuk_app_config/pull/241)).
12
+ - Add internal Sidekiq exception "Sidekiq::JobRetry::Skip" to excluded exceptions ([#241](https://github.com/alphagov/govuk_app_config/pull/241)).
13
+
1
14
  # 4.5.0
2
15
 
3
16
  - Add lux.speedcurve.com to connect_src for GOV.UK Content Security Policy ([#232](https://github.com/alphagov/govuk_app_config/pull/232))
data/docs/healthchecks.md CHANGED
@@ -1,47 +1,6 @@
1
1
  # Health Checks
2
2
 
3
- ## Check interface
4
-
5
- A check is expected to be a class with the following methods:
6
-
7
- ```ruby
8
- class CustomCheck
9
- def name
10
- :the_name_of_the_check
11
- end
12
-
13
- def status
14
- if critical_condition?
15
- :critical
16
- elsif warning_condition?
17
- :warning
18
- else
19
- :ok
20
- end
21
- end
22
-
23
- # Optional
24
- def message
25
- "This is an optional custom message that will show up in the alert in Icinga"
26
- end
27
-
28
- # Optional
29
- def details
30
- {
31
- extra: "This is an optional details hash",
32
- }
33
- end
34
-
35
- # Optional
36
- def enabled?
37
- true # false if the check is not relevant at this time
38
- end
39
- end
40
- ```
41
-
42
- It is expected that these methods may cache their results for performance
43
- reasons, if a user wants to ensure they have the latest value they should
44
- create a new instance of the check first.
3
+ GOV.UK apps often have special `/healthcheck` routes, which give an indication of whether the app is running and able to respond to requests. [Read about how health checks are used](https://docs.publishing.service.gov.uk/manual/alerts/app-healthcheck-not-ok.html).
45
4
 
46
5
  ## Including checks in your app
47
6
 
@@ -51,7 +10,7 @@ or custom checks you wish to perform.
51
10
  For Rails apps:
52
11
 
53
12
  ```ruby
54
- get "/healthcheck", to: GovukHealthcheck.rack_response(
13
+ get "/healthcheck/ready", to: GovukHealthcheck.rack_response(
55
14
  GovukHealthcheck::SidekiqRedis,
56
15
  GovukHealthcheck::ActiveRecord,
57
16
  CustomCheck,
@@ -61,95 +20,64 @@ get "/healthcheck", to: GovukHealthcheck.rack_response(
61
20
  It also accepts objects, so classes can be initialized:
62
21
 
63
22
  ```ruby
64
- get "/healthcheck", to: GovukHealthcheck.rack_response(
23
+ get "/healthcheck/ready", to: GovukHealthcheck.rack_response(
65
24
  InitializedCheck.new(:param),
66
25
  )
67
26
  ```
68
27
 
69
- ## Built-in Checks
70
-
71
- A convention used when naming these classes is that it should end with `Check`
72
- if it must be subclassed to work, but a concrete class which works on its own
73
- doesn't need that suffix. You should aim to follow this convention in your own
74
- apps, ideally putting custom health checks into a `Healthcheck` module.
75
-
76
- ### `RailsCache`
28
+ Built-in checks you can use include:
77
29
 
78
- This checks that the Rails cache store, such as Memcached, is acessible by
79
- writing and reading back a cache entry called "healthcheck-cache".
30
+ - `GovukHealthcheck::RailsCache` - checks that the Rails cache store, such as Memcached, is acessible by writing and reading back a cache entry called "healthcheck-cache".
80
31
 
81
- ### `Mongoid`
32
+ - `GovukHealthcheck::Redis` - checks that the app can connect to Redis by writing and reading back a cache entry called "healthcheck-cache".
82
33
 
83
- This checks that the app has a connection to its Mongo database via Mongoid.
34
+ - `GovukHealthcheck::Mongoid` - checks that the app has a connection to its Mongo database via Mongoid.
84
35
 
85
- ### `SidekiqRedis`
36
+ - `GovukHealthcheck::SidekiqRedis` - checks that the app has a connection to Redis via Sidekiq.
86
37
 
87
- This checks that the app has a connection to Redis via Sidekiq.
38
+ - `GovukHealthcheck::ActiveRecord` - checks that the app has a connection to the database via ActiveRecord.
88
39
 
89
- ### `ActiveRecord`
40
+ ## Writing a custom healthcheck
90
41
 
91
- This checks that the app has a connection to the database via ActiveRecord.
92
-
93
- ### `ThresholdCheck`
94
-
95
- This class is the basis for a check which compares a value with a warning or a
96
- critical threshold.
42
+ A check is expected to be a class with the following methods:
97
43
 
98
44
  ```ruby
99
- class MyThresholdCheck < GovukHealthcheck::ThresholdCheck
45
+ class CustomCheck
100
46
  def name
101
- :my_threshold_check
102
- end
103
-
104
- def value
105
- # get the value to be checked
106
- end
107
-
108
- def total
109
- # (optional) get the total value to be included in the details as extra
110
- # information
47
+ :the_name_of_the_check
111
48
  end
112
49
 
113
- def warning_threshold
114
- # if the value is above this threshold, its status is warning
50
+ def status
51
+ if critical_condition?
52
+ :critical
53
+ elsif warning_condition?
54
+ :warning
55
+ else
56
+ :ok
57
+ end
115
58
  end
116
59
 
117
- def critical_threshold
118
- # if the value is above this threshold, its status is critical
60
+ # Optional
61
+ def message
62
+ "This is an optional custom message that will show up in the alert in Icinga"
119
63
  end
120
- end
121
- ```
122
64
 
123
- ### `SidekiqQueueLatencyCheck`
124
-
125
- This class is the basis for a check which compares the Sidekiq queue latencies
126
- with warning or critical thresholds.
127
-
128
- ```ruby
129
- class MySidekiqQueueLatencyCheck < GovukHealthcheck::SidekiqQueueLatencyCheck
130
- def warning_threshold(queue:)
131
- # the warning threshold for a particular queue
65
+ # Optional
66
+ def details
67
+ {
68
+ extra: "This is an optional details hash",
69
+ }
132
70
  end
133
71
 
134
- def critical_threshold(queue:)
135
- # the critical threshold for a particular queue
72
+ # Optional
73
+ def enabled?
74
+ true # false if the check is not relevant at this time
136
75
  end
137
76
  end
138
77
  ```
139
78
 
140
- ### `SidekiqRetrySizeCheck`
141
-
142
- Similar to `SidekiqQueueSizeCheck`, this class is the basis for a check which
143
- compares the Sidekiq retry set size with a warning and critical threshold.
144
-
145
- ```ruby
146
- class MySidekiqRetrySizeCheck < GovukHealthcheck::SidekiqRetrySizeCheck
147
- def warning_threshold
148
- # the warning threshold for the retry set
149
- end
79
+ It is expected that these methods may cache their results for performance
80
+ reasons, if a user wants to ensure they have the latest value they should
81
+ create a new instance of the check first.
150
82
 
151
- def critical_threshold
152
- # the critical threshold for the retry set
153
- end
154
- end
155
- ```
83
+ Put custom health checks for your app into a `Healtcheck` module. Each custom check class should end with `Check`.
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "logstasher", "~> 2.1"
24
24
  spec.add_dependency "prometheus_exporter", "~> 2.0"
25
25
  spec.add_dependency "puma", "~> 5.6"
26
- spec.add_dependency "sentry-rails", "~> 5.2"
27
- spec.add_dependency "sentry-ruby", "~> 5.2"
26
+ spec.add_dependency "sentry-rails", "~> 5.3"
27
+ spec.add_dependency "sentry-ruby", "~> 5.3"
28
28
  spec.add_dependency "statsd-ruby", "~> 1.5"
29
29
  spec.add_dependency "unicorn", "~> 6.1"
30
30
 
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "rake", "~> 13.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.10"
37
37
  spec.add_development_dependency "rspec-its", "~> 1.3"
38
- spec.add_development_dependency "rubocop-govuk", "4.3.0"
38
+ spec.add_development_dependency "rubocop-govuk", "4.4.0"
39
39
  spec.add_development_dependency "webmock"
40
40
  end
@@ -18,7 +18,8 @@ module GovukContentSecurityPolicy
18
18
  GOOGLE_ANALYTICS_DOMAINS = %w[www.google-analytics.com
19
19
  ssl.google-analytics.com
20
20
  stats.g.doubleclick.net
21
- www.googletagmanager.com].freeze
21
+ www.googletagmanager.com
22
+ www.region1.google-analytics.com].freeze
22
23
 
23
24
  GOOGLE_STATIC_DOMAINS = %w[www.gstatic.com].freeze
24
25
 
@@ -53,6 +53,7 @@ module GovukError
53
53
  "Mongoid::Errors::DocumentNotFound",
54
54
  "Sinatra::NotFound",
55
55
  "Slimmer::IntermittentRetrievalError",
56
+ "Sidekiq::JobRetry::Skip",
56
57
  ]
57
58
 
58
59
  # This will exclude exceptions that are triggered by one of the ignored
@@ -34,6 +34,10 @@ module GovukError
34
34
  def self.configure
35
35
  raise GovukError::AlreadyInitialised if is_configured?
36
36
 
37
+ if defined?(Sidekiq) && !defined?(Sentry::Sidekiq)
38
+ warn "Warning: GovukError is not configured to track Sidekiq errors, install the sentry-sidekiq gem to track them."
39
+ end
40
+
37
41
  Sentry.init do |sentry_config|
38
42
  config = Configuration.new(sentry_config)
39
43
  yield config if block_given?
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "4.5.0".freeze
2
+ VERSION = "4.6.2".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: 4.5.0
4
+ version: 4.6.2
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: 2022-04-08 00:00:00.000000000 Z
11
+ date: 2022-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.2'
61
+ version: '5.3'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.2'
68
+ version: '5.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sentry-ruby
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '5.2'
75
+ version: '5.3'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '5.2'
82
+ version: '5.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: statsd-ruby
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 4.3.0
215
+ version: 4.4.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 4.3.0
222
+ version: 4.4.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: webmock
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  - !ruby/object:Gem::Version
297
297
  version: '0'
298
298
  requirements: []
299
- rubygems_version: 3.3.11
299
+ rubygems_version: 3.3.16
300
300
  signing_key:
301
301
  specification_version: 4
302
302
  summary: Base configuration for GOV.UK applications