health-monitor-rails 12.3.0 → 12.4.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 +4 -4
- data/README.md +11 -1
- data/lib/health_monitor/configuration.rb +1 -1
- data/lib/health_monitor/providers/cache.rb +1 -1
- data/lib/health_monitor/providers/database.rb +1 -1
- data/lib/health_monitor/providers/delayed_job.rb +1 -1
- data/lib/health_monitor/providers/file_absence.rb +34 -0
- data/lib/health_monitor/providers/redis.rb +1 -1
- data/lib/health_monitor/providers/sidekiq.rb +1 -1
- data/lib/health_monitor/providers/solr.rb +1 -1
- data/lib/health_monitor/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b3587a34b753e20332f2ee30e5a8fabf95485edc28dbf0521be42895bc2dbb0
|
4
|
+
data.tar.gz: 4b9b77a3c16bb5d01182af1ff1d327deb0089785da6905012a498be977b20038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 808e2ed0c5fa88496ff3eae0540e559b871629970210ea371f0cbf95ad8e71f2f9687e72bb802b6f26b961bb59dcc42c0c904a5f6a68af9754d172c5e42ccbfb
|
7
|
+
data.tar.gz: 6d31d3cf3605c2d3eddd144242794774db6abaf7022b2cbf8cb7430ba8495d38ac81018ea97a6d516258a190dd3933e031b52103e036538a60c7d3694e36af96
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/health-monitor-rails)
|
4
4
|
[](https://github.com/lbeder/health-monitor-rails/actions/workflows/ci.yml)
|
5
|
-
[](https://coveralls.io/r/lbeder/health-monitor-rails)
|
6
5
|
|
7
6
|
This is a health monitoring Rails mountable plug-in, which checks various services (db, cache, sidekiq, redis, etc.).
|
8
7
|
|
@@ -177,6 +176,7 @@ The following services are currently supported:
|
|
177
176
|
* Resque
|
178
177
|
* Delayed Job
|
179
178
|
* Solr
|
179
|
+
* FileAbsence
|
180
180
|
|
181
181
|
## Configuration
|
182
182
|
|
@@ -318,6 +318,12 @@ Please note that `url` or `connection` can't be used at the same time.
|
|
318
318
|
* `url`: the URL used to connect to your Solr instance - must be a string. You can also use `url` to explicitly configure authentication (e.g., `'https://user:pass@example.solr.com:8983/'`)
|
319
319
|
* `collection`: An optional parameter used to connect to your specific Solr collection - must be a string. By setting this parameter the code will check the status of this individual collection in your Solr instance instead of just the status of the overall Solr instance
|
320
320
|
|
321
|
+
### FileAbsence
|
322
|
+
|
323
|
+
This check allows you to create a file on your server when you would like to force the check to fail. For example if you are utilizing the `health.json` as you health check page for your load balancer and would like to force a machine offline.
|
324
|
+
|
325
|
+
* `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`
|
326
|
+
|
321
327
|
### Adding a Custom Provider
|
322
328
|
|
323
329
|
It's also possible to add custom health check providers suited for your needs (of course, it's highly appreciated and encouraged if you'd contribute useful providers to the project).
|
@@ -441,9 +447,11 @@ nicolas@desktop:$ echo $?
|
|
441
447
|
```
|
442
448
|
|
443
449
|
## Development
|
450
|
+
|
444
451
|
In order to work on development on the gem itself
|
445
452
|
|
446
453
|
### Installing the gems
|
454
|
+
|
447
455
|
Use the [appraisal gem](https://github.com/thoughtbot/appraisal) to install the bundles for different rails versions:
|
448
456
|
|
449
457
|
```bash
|
@@ -453,7 +461,9 @@ appraisal install
|
|
453
461
|
```
|
454
462
|
|
455
463
|
### Running the tests
|
464
|
+
|
456
465
|
Use appraisal to run the tests using rake
|
466
|
+
|
457
467
|
```bash
|
458
468
|
appraisal rake
|
459
469
|
```
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module HealthMonitor
|
4
4
|
class Configuration
|
5
|
-
PROVIDERS = %i[cache database delayed_job redis resque sidekiq solr].freeze
|
5
|
+
PROVIDERS = %i[cache database delayed_job file_absence redis resque sidekiq solr].freeze
|
6
6
|
|
7
7
|
attr_accessor :basic_auth_credentials,
|
8
8
|
:environment_variables,
|
@@ -11,7 +11,7 @@ module HealthMonitor
|
|
11
11
|
failed_databases = []
|
12
12
|
|
13
13
|
ActiveRecord::Base.connection_handler.connection_pool_list(:all).each do |cp|
|
14
|
-
cp.
|
14
|
+
cp.lease_connection.execute('SELECT 1')
|
15
15
|
rescue Exception
|
16
16
|
failed_databases << cp.db_config.name
|
17
17
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'health_monitor/providers/base'
|
4
|
+
|
5
|
+
module HealthMonitor
|
6
|
+
module Providers
|
7
|
+
class FileAbsenceException < StandardError; end
|
8
|
+
|
9
|
+
class FileAbsence < Base
|
10
|
+
class Configuration < Base::Configuration
|
11
|
+
DEFAULT_FILENAME = nil
|
12
|
+
attr_accessor :filename
|
13
|
+
|
14
|
+
def initialize(provider)
|
15
|
+
super
|
16
|
+
|
17
|
+
@filename = DEFAULT_FILENAME
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def check!
|
22
|
+
return unless File.exist?(configuration.filename)
|
23
|
+
|
24
|
+
raise FileAbsenceException.new("Unwanted file #{configuration.filename} exists!")
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def configuration_class
|
30
|
+
::HealthMonitor::Providers::FileAbsence::Configuration
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
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.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Beder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/health_monitor/providers/cache.rb
|
46
46
|
- lib/health_monitor/providers/database.rb
|
47
47
|
- lib/health_monitor/providers/delayed_job.rb
|
48
|
+
- lib/health_monitor/providers/file_absence.rb
|
48
49
|
- lib/health_monitor/providers/redis.rb
|
49
50
|
- lib/health_monitor/providers/resque.rb
|
50
51
|
- lib/health_monitor/providers/sidekiq.rb
|
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.4.19
|
74
75
|
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: Health monitoring Rails plug-in, which checks various services (db, cache,
|