health-reporter 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90f655ef277bd77b6f90e6129976868c5c3f934f
4
- data.tar.gz: d905978f2768c0472a238e4b5c8c3c0b3831e882
3
+ metadata.gz: 155d97c5b4cc48d064e2d0c3ba40c19094a6c700
4
+ data.tar.gz: 2e1bc68f9c30819cd1fd586ce1a7f01552e038dc
5
5
  SHA512:
6
- metadata.gz: 9ab4e6974bcc5ffad2e8d454e28f21e87d1528c6bd3fbfc4fd13bdcd1850d57a0502df6e7000b9d2fa3d21fa0eabfcca69564b0495f2972f25d256aa8262fd0d
7
- data.tar.gz: df47ccab910847e661cc3769594344408635bdced26e8c93563bfceb672fa6445ad332010ae94dc05cf0ede58be9fb7bcf80fec1cd13b8afb28a77eae4e935ac
6
+ metadata.gz: 049f9b1956fccdd9d144bcb087e159b8555e2e861d239a0f32929209ce65c88426586fa5d2b18647656f02e50e4be0e08e1ba1d426d30427f36b6dd007bdd9a8
7
+ data.tar.gz: 1a538e5844bff5fd7c8ac3a0e29d1814e86884ffb03f040959dfdc731944865e64960237453c9f10ef6d3eb73581cec4f276980e0f601c42f0d9b836373bdb46
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # HealthReporter
2
2
 
3
+ The HealthReporter gem makes the caching of health check requests on services easy. Simiply register a lambda returning true/false that determines if the service is healthy or not. The HealthReporter caches the result for future requests using a TTL value. If the cache is still valid it will not use the lambda to determine service health.
3
4
 
4
5
  ## Installation
5
6
 
@@ -33,7 +34,47 @@ docker-compose run --rm health-reporter bundle exec rspec -cfd spec/*
33
34
 
34
35
  ## Usage
35
36
 
36
- #TODO add dependency registration and calling
37
+ ### Overview
38
+
39
+ Out of the box you can simply call it as follows with the preconfigured always true self-check lambda:
40
+ ```ruby
41
+ require 'health_reporter'
42
+ HealthReporter.healthy?
43
+ => true
44
+ ```
45
+
46
+ The default values can be overridden as follow:
47
+ ```ruby
48
+ require 'health_reporter'
49
+ HealthReporter.self_test = lambda{ false }
50
+ HealthReporter.healthy_cache_ttl = 60
51
+ HealthReporter.unhealthy_cache_ttl = 30
52
+ HealthReporter.healthy?
53
+ => false
54
+ ```
55
+
56
+ ### Configuration on startup
57
+
58
+ First it is set up somewhere in your service startup (config.ru) where you configure how it determines health:
59
+ ```ruby
60
+ require 'health_reporter'
61
+ HealthReporter.self_test = lambda{ false }
62
+ HealthReporter.healthy_cache_ttl = 60
63
+ HealthReporter.unhealthy_cache_ttl = 30
64
+ ```
65
+
66
+ ### Health checking via an endpoint
67
+
68
+ In the controller/model of the health check you simply call the following and based on the boolean return respond with 200 or 500 for other services to see this service health:
69
+ ```ruby
70
+ require 'health_reporter'
71
+ HealthReporter.healthy?
72
+ => false
73
+ ```
74
+
75
+ ## Future
76
+
77
+ ### Add dependency registration and calling
37
78
 
38
79
  ## Contributing
39
80
 
@@ -1,3 +1,3 @@
1
1
  class HealthReporter
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barney de Villiers