govuk_app_config 1.5.1 → 1.6.0

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: 0ac8e47ae56fb42b44e9c976322ddad4e8684412320fc6938e82a4e076a253c2
4
- data.tar.gz: 9cb6a01336c4d409c80af123fcdf4ef42086288b79ced7ae94ecad5b8a10cb86
3
+ metadata.gz: 209a3832e7995ecd4fae908416ca9656849489c3b2dd9f287c175029d3c2a683
4
+ data.tar.gz: 5c12231bddd44f7fff7dd32c6b21484bc1ff7fef9bb3b7d54bf3abcf266bb46b
5
5
  SHA512:
6
- metadata.gz: edd4237e5e0b9f07f710d4cc32dfe3ffea1166fecb99b396d3f43cb4eaca8d71c50530414c1753f2369c089fd9e1f52a15dbc9159c9ffe45f4992f7bd035a9b3
7
- data.tar.gz: f9693d072813e00999277e175cd90773278ac3625efa87de011e537fe0604d2642eeb3cf0044ef3b92a8dc25eebd15f0a697a1042f760483adc96f5fe72521da
6
+ metadata.gz: 820ef2c5342d0fc44d64d756bef5732789e65fefb0053b45ca961af214b523401348c2887cf46c93b43734a414b2a276eeb8916c79e85e1143e54dafd2710a61
7
+ data.tar.gz: 6fc2796951741d81cbe57712cd4de98d77976e046cecfbd68096b5f7726dbcadf1a6817f5afd557c6d80bee9f8cdaa6e4ad93aa7a628cb17b58a4414065b3877
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.6.0
2
+
3
+ * Make health checks classes rather than instances, allowing internal data to
4
+ be cached and improve performance.
5
+
1
6
  # 1.5.1
2
7
 
3
8
  * Set the `Content-Type` of healthchecks to `application/json`.
data/README.md CHANGED
@@ -110,25 +110,26 @@ GovukStatsd.time("account.activate") { @account.activate! }
110
110
  Set up a route in your rack-compatible Ruby application, and pick the built-in
111
111
  or custom checks you wish to perform.
112
112
 
113
- Custom checks must be any class or instance which implements
113
+ Custom checks must be a class which implements
114
114
  [this interface](spec/lib/govuk_healthcheck/shared_interface.rb):
115
+
115
116
  ```ruby
116
- module CustomCheck
117
- def self.name
117
+ class CustomCheck
118
+ def name
118
119
  :custom_check
119
120
  end
120
121
 
121
- def self.status
122
+ def status
122
123
  ThingChecker.everything_okay? ? OK : CRITICAL
123
124
  end
124
125
 
125
126
  # Optional
126
- def self.message
127
+ def message
127
128
  "This is an optional custom message"
128
129
  end
129
130
 
130
131
  # Optional
131
- def self.details
132
+ def details
132
133
  {
133
134
  extra: "This is an optional details hash",
134
135
  }
@@ -150,6 +151,9 @@ This will check:
150
151
  - Database connectivity (via ActiveRecord)
151
152
  - Your custom healthcheck
152
153
 
154
+ Each check class gets instanced each time the health check end point is called.
155
+ This allows you to cache any complex queries speeding up performance.
156
+
153
157
  ## Rails logging
154
158
 
155
159
  In Rails applications, the application will be configured to send JSON-formatted
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "rspec", "~> 3.6.0"
32
32
  spec.add_development_dependency "climate_control"
33
33
  spec.add_development_dependency "webmock"
34
+ spec.add_development_dependency "pry"
34
35
  end
@@ -1,10 +1,10 @@
1
1
  module GovukHealthcheck
2
- module ActiveRecord
3
- def self.name
2
+ class ActiveRecord
3
+ def name
4
4
  :database_connectivity
5
5
  end
6
6
 
7
- def self.status
7
+ def status
8
8
  ::ActiveRecord::Base.connected? ? OK : CRITICAL
9
9
  end
10
10
  end
@@ -20,8 +20,10 @@ module GovukHealthcheck
20
20
 
21
21
  private
22
22
 
23
+ attr_reader :checks
24
+
23
25
  def component_statuses
24
- @component_statuses ||= @checks.each_with_object({}) do |check, hash|
26
+ @component_statuses ||= checks.map(&:new).each_with_object({}) do |check, hash|
25
27
  hash[check.name] = build_component_status(check)
26
28
  end
27
29
  end
@@ -1,10 +1,10 @@
1
1
  module GovukHealthcheck
2
- module SidekiqRedis
3
- def self.name
2
+ class SidekiqRedis
3
+ def name
4
4
  :redis_connectivity
5
5
  end
6
6
 
7
- def self.status
7
+ def status
8
8
  Sidekiq.redis_info ? OK : CRITICAL
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "1.5.1"
2
+ VERSION = "1.6.0"
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: 1.5.1
4
+ version: 1.6.0
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: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: statsd-ruby
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: Base configuration for GOV.UK applications
140
154
  email:
141
155
  - govuk-dev@digital.cabinet-office.gov.uk