health-monitor-rails 12.6.0 → 12.7.0
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 +4 -4
- data/README.md +3 -3
- data/lib/health_monitor/monitor.rb +5 -7
- data/lib/health_monitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65ddef8cba3d98c9824273f2eb677bb4eb5797a88ea3a020d846ab9e7b170bf9
|
4
|
+
data.tar.gz: 30b1ff30cdc3c8c95a180701b251756514cacc4f8a6969c07dc07b21fddb538c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdba690258230630638d475e00cad004127a086cf548460504864038ec1e02eeb434e083cf49e7c23ab00f08ef764e7bacee01a1beaec16d01c1486854ee6a76
|
7
|
+
data.tar.gz: ca61f98fca9a3adc8b89c47748d82ce7a9523842b807d757171474e73f13721d2db6085f65813b3be2829b7f1b3ff3a176020727eae4d11f5392e5e2b4b1314d
|
data/README.md
CHANGED
@@ -231,7 +231,7 @@ end
|
|
231
231
|
```
|
232
232
|
|
233
233
|
* __name__: Custom name for the provider (Defaults to __class name__. Ex: 'Redis', 'Sidekiq')
|
234
|
-
* __critical__: Whether or not the provider is a critical dependency (Defaults to: __true__). If set to __false__, the monitor will report its status but ignore it when determining overall application health status
|
234
|
+
* __critical__: Whether or not the provider is a critical dependency (Defaults to: __true__). If set to __false__, the monitor will report its status as `WARNING` but ignore it when determining overall application health status. This could be used to send to a non critical notifications channel
|
235
235
|
|
236
236
|
> The __critical__ option allows you to monitor for additional non-critical dependencies that are not fully required for your application to be operational, like a cache database for instance
|
237
237
|
|
@@ -288,7 +288,7 @@ HealthMonitor.configure do |config|
|
|
288
288
|
end
|
289
289
|
```
|
290
290
|
|
291
|
-
For providers that can be configured with its
|
291
|
+
For providers that can be configured with its endpoints/urls you can also add multiple declarations to ensure you are reporting across all dependencies:
|
292
292
|
|
293
293
|
```ruby
|
294
294
|
HealthMonitor.configure do |config|
|
@@ -335,7 +335,7 @@ Please note that `url` or `connection` can't be used at the same time.
|
|
335
335
|
|
336
336
|
### FileAbsence
|
337
337
|
|
338
|
-
This check allows you to create a file on your server when you would like to force the check to fail. For example if
|
338
|
+
This check allows you to create a file on your server when you would like to force the check to fail. For example, if utilizing the `health.json` as the health check page for your load balancer and would like to force a machine offline.
|
339
339
|
|
340
340
|
* `filename`: the file relative to the rails root that must remain absent for the health check to remain passing. For example: `public/remove-from-nginx` (Can also be a full path `/opt/app/remove-from-nginx`)
|
341
341
|
|
@@ -5,6 +5,7 @@ require 'health_monitor/configuration'
|
|
5
5
|
module HealthMonitor
|
6
6
|
STATUSES = {
|
7
7
|
ok: 'OK',
|
8
|
+
warning: 'WARNING',
|
8
9
|
error: 'ERROR'
|
9
10
|
}.freeze
|
10
11
|
|
@@ -25,10 +26,9 @@ module HealthMonitor
|
|
25
26
|
end
|
26
27
|
|
27
28
|
results = providers.map { |provider| provider_result(provider, request) }
|
28
|
-
|
29
29
|
{
|
30
|
-
results: results
|
31
|
-
status: results.any? { |res| res[:status]
|
30
|
+
results: results,
|
31
|
+
status: results.any? { |res| res[:status] == STATUSES[:error] } ? :service_unavailable : :ok,
|
32
32
|
timestamp: Time.now.to_formatted_s(:rfc2822)
|
33
33
|
}
|
34
34
|
end
|
@@ -43,8 +43,7 @@ module HealthMonitor
|
|
43
43
|
{
|
44
44
|
name: provider.name,
|
45
45
|
message: '',
|
46
|
-
status: STATUSES[:ok]
|
47
|
-
critical: provider.critical
|
46
|
+
status: STATUSES[:ok]
|
48
47
|
}
|
49
48
|
rescue StandardError => e
|
50
49
|
configuration.error_callback.try(:call, e)
|
@@ -52,8 +51,7 @@ module HealthMonitor
|
|
52
51
|
{
|
53
52
|
name: provider.name,
|
54
53
|
message: e.message,
|
55
|
-
status: STATUSES[:error]
|
56
|
-
critical: provider.critical
|
54
|
+
status: provider.critical ? STATUSES[:error] : STATUSES[:warning]
|
57
55
|
}
|
58
56
|
end
|
59
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health-monitor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.
|
4
|
+
version: 12.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Beder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|