hermes-rb 0.5.0 → 0.6.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/Changelog.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +27 -0
- data/bin/hermes_health_check +12 -0
- data/hermes-rb.gemspec +2 -2
- data/lib/hermes.rb +1 -0
- data/lib/hermes/checks.rb +5 -0
- data/lib/hermes/checks/health_check.rb +14 -0
- data/lib/hermes/logger.rb +4 -0
- data/lib/hermes/rb/version.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cc73b9dbd7c2d1569311975037c0d5f45aac33c3eca2ba581b095dc2670662f
|
4
|
+
data.tar.gz: dbb3cd464fd5ac24ba0e8f9c8dcbaf904a31d49ad43088f1e01c06323862ee36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04ebe50de83e5c3fbce03dc0c543563cdc7dd3e64f93cb65a7783c4437f56dadd31f5fcb60c8ec3332e480f8485224282728856ae9c0a1d732c7de9918b2a1b7
|
7
|
+
data.tar.gz: 2873fba2537bb1d8eb9b46e829fc1b312d079fd3eed7dc65bed09caa536349741c365ca2ee108617833b360e8e91d0c6814c01c23c13874b68ca725f84b11ae0
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -459,6 +459,33 @@ end
|
|
459
459
|
|
460
460
|
Hermes is just an extra layer on top of [hutch](https://github.com/gocardless/hutch), refer to Hutch's docs for more info about dealing with the workers and deployment.
|
461
461
|
|
462
|
+
## Health Checks
|
463
|
+
|
464
|
+
If you want to perform a health check, use `Hermes::Checks::HealthCheck.check`, which checks if it's possible to connect RabbitMQ via Hutch.
|
465
|
+
|
466
|
+
The interface is compliant with `health_check`[https://github.com/ianheggie/health_check] gem. If you want to add the custom health check, just add this to the config:
|
467
|
+
|
468
|
+
``` rb
|
469
|
+
config.add_custom_check("hermes") do
|
470
|
+
Hermes::Checks::HealthCheck.check
|
471
|
+
end
|
472
|
+
```
|
473
|
+
|
474
|
+
You can also use `bin/health_check` file to perform healthcheck - on success, the script exits with `0` status and on failure, it logs the error and exits with `1` status.
|
475
|
+
|
476
|
+
To perform the actual check:
|
477
|
+
|
478
|
+
1. Via `health_check` gem:
|
479
|
+
```
|
480
|
+
curl -v localhost:3000/health_check/hermes.json
|
481
|
+
```
|
482
|
+
|
483
|
+
2. Via binary:
|
484
|
+
|
485
|
+
```
|
486
|
+
bin/hermes_health_check
|
487
|
+
```
|
488
|
+
|
462
489
|
## CircleCI config for installing RabbitMQ
|
463
490
|
|
464
491
|
Use `- image: brandembassy/rabbitmq:latest`
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require_relative "../lib/hermes-rb"
|
5
|
+
|
6
|
+
result = Hermes::Checks::HealthCheck.check
|
7
|
+
if result.empty?
|
8
|
+
exit 0
|
9
|
+
else
|
10
|
+
Hermes::DependenciesContainer["logger"].log_health_check_failure(result)
|
11
|
+
exit 1
|
12
|
+
end
|
data/hermes-rb.gemspec
CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
24
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
25
|
end
|
26
|
-
spec.bindir = "
|
27
|
-
spec.executables =
|
26
|
+
spec.bindir = "bin"
|
27
|
+
spec.executables = ["hermes_health_check"]
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_dependency "dry-struct", "~> 1"
|
data/lib/hermes.rb
CHANGED
@@ -25,6 +25,7 @@ require "hermes/producer_error_handler"
|
|
25
25
|
require "hermes/producer_error_handler/null_handler"
|
26
26
|
require "hermes/producer_error_handler/safe_handler"
|
27
27
|
require "hermes/tracers"
|
28
|
+
require "hermes/checks"
|
28
29
|
require "active_support"
|
29
30
|
require "active_support/core_ext/string"
|
30
31
|
require "active_record"
|
data/lib/hermes/logger.rb
CHANGED
@@ -17,6 +17,10 @@ module Hermes
|
|
17
17
|
backend.info "[Hutch] published event to: #{routing_key}, properties: #{properties}, body: #{strip_sensitive_info(body)} at #{timestamp}"
|
18
18
|
end
|
19
19
|
|
20
|
+
def log_health_check_failure(error)
|
21
|
+
backend.info "[Hermes] health check failed: #{error}"
|
22
|
+
end
|
23
|
+
|
20
24
|
private
|
21
25
|
|
22
26
|
def strip_sensitive_info(body)
|
data/lib/hermes/rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hermes-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karol Galanciak
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -210,7 +210,8 @@ description: A messenger of gods, delivering them via RabbitMQ with a little hel
|
|
210
210
|
from Hutch
|
211
211
|
email:
|
212
212
|
- dev@bookingsync.com
|
213
|
-
executables:
|
213
|
+
executables:
|
214
|
+
- hermes_health_check
|
214
215
|
extensions: []
|
215
216
|
extra_rdoc_files: []
|
216
217
|
files:
|
@@ -224,12 +225,15 @@ files:
|
|
224
225
|
- README.md
|
225
226
|
- Rakefile
|
226
227
|
- bin/console
|
228
|
+
- bin/hermes_health_check
|
227
229
|
- bin/setup
|
228
230
|
- hermes-rb.gemspec
|
229
231
|
- lib/hermes-rb.rb
|
230
232
|
- lib/hermes.rb
|
231
233
|
- lib/hermes/b_3_propagation_model_headers.rb
|
232
234
|
- lib/hermes/base_event.rb
|
235
|
+
- lib/hermes/checks.rb
|
236
|
+
- lib/hermes/checks/health_check.rb
|
233
237
|
- lib/hermes/configuration.rb
|
234
238
|
- lib/hermes/consumer_builder.rb
|
235
239
|
- lib/hermes/database_error_handler.rb
|