rails_pod_kit 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: fb47aab3b005492f13eaaa6ede0a89a5891cfbc8d034ebc0f1284b590efbb59a
4
- data.tar.gz: 3f0f50b521bb1f96655edcbb296ea00156f90b631239491c49fad381f351989e
3
+ metadata.gz: 01df88e896cc7b8aac64c01bd55b33be595cea12690fd0b0e47aa4b1289f5d95
4
+ data.tar.gz: fec8ba424464b8b15c20fe8c87b604fea5b667f42df9908921c13ac42a66e3ba
5
5
  SHA512:
6
- metadata.gz: 33733cd886176b0341314e9ba6641cb0368f6010e3d24e0b11851d8a18d32119dd183eb8f17a885d8be5f4c5e36d7b123205d5051bf79b90e8f0cc95b434d0ef
7
- data.tar.gz: db116a08eb1b3fb3c0d4017a5be0082568e48907032717d35dbb10933f741811b0009c64749937747aa44e45db0dbb73a1647d288f1dca986c6ec8007cc4531e
6
+ metadata.gz: a2b637351c73a11dcb83f5e4db150ae75bbcf61840af4a4262fd6063fce1a3069912ccea5031ccb84d90513aebf33e193614f5c05703835706a769ca59e675d4
7
+ data.tar.gz: b8c3b5682c277f6e5b39267454c820e206635c93e8fd74620e43ec673f1367e8c11c8585fcd914814d5e7db7655578352cebec492493eb4cc73e9f483aa59b87
data/README.md CHANGED
@@ -8,7 +8,7 @@ packaged behind a single, opinionated entry point:
8
8
  worker (Sidekiq) processes — no sidecar, no separate collector process. A
9
9
  metrics agent (e.g. the Datadog Agent via OpenMetrics autodiscovery) scrapes
10
10
  the pod directly.
11
- - **Health checks** on `/healthz` (database, cache, Redis, optionally Sidekiq),
11
+ - **Health checks** on `/healthz` (database, cache, optionally Redis and Sidekiq),
12
12
  wired for Kubernetes startup/liveness/readiness probes — a thin, opinionated
13
13
  wrapper around [health-monitor-rails](https://github.com/lbeder/health-monitor-rails).
14
14
 
@@ -90,8 +90,10 @@ no initializers.
90
90
 
91
91
  `Health.install!` configures health-monitor-rails with the kit's defaults:
92
92
  endpoint at `/healthz`, checking **database** (health_monitor's default),
93
- **cache**, **Redis** (connection injected by the host) andwhen a `sidekiq:`
94
- thresholds hash is given**Sidekiq**. The gem's Railtie mounts
93
+ **cache**, when a `redis:` connection is given**Redis** (connection
94
+ injected by the host) and when a `sidekiq:` thresholds hash is given —
95
+ **Sidekiq**. Omit `redis:` on hosts with no Redis dependency (e.g. a Solid
96
+ Queue stack) to get a database + cache only endpoint. The gem's Railtie mounts
95
97
  `HealthMonitor::Engine` at `/` automatically; pass `mount: false` to keep
96
98
  route ownership (custom mount point, constraints) and mount it yourself in
97
99
  `config/routes.rb`. Any further tuning goes through the optional block, which
@@ -99,7 +101,9 @@ receives the `HealthMonitor` configuration.
99
101
 
100
102
  ```ruby
101
103
  RailsPodKit::Health.install!(
102
- redis: { url: ENV['REDIS_URL'] }, # or a ready Redis/ConnectionPool object
104
+ redis: { url: ENV['REDIS_URL'] }, # optional: a ready Redis/ConnectionPool
105
+ # object or options hash; omit for no
106
+ # Redis provider
103
107
  path: :healthz, # default
104
108
  sidekiq: { queue_size: 200, latency: 10.minutes }
105
109
  ) do |config|
@@ -107,6 +111,13 @@ RailsPodKit::Health.install!(
107
111
  end
108
112
  ```
109
113
 
114
+ Without a `redis:` argument the endpoint checks only database and cache
115
+ (plus Sidekiq when its thresholds are given):
116
+
117
+ ```ruby
118
+ RailsPodKit::Health.install!(path: :healthz) # database + cache only
119
+ ```
120
+
110
121
  Probe wiring on Kubernetes:
111
122
 
112
123
  - **startup probe** → `/healthz` — the full check, so the pod doesn't go ready
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -21,7 +21,7 @@ module RailsPodKit
21
21
  # )
22
22
  #
23
23
  # gives the app a /healthz endpoint checking database (health_monitor's
24
- # default), cache, Redis and (optionally) Sidekiq — suitable as a k8s startup
24
+ # default), cache and (optionally) Redis and Sidekiq — suitable as a k8s startup
25
25
  # probe. For liveness/readiness, probe `/healthz?providers[]=none` to
26
26
  # short-circuit the dependency checks once the pod is live, so a transient
27
27
  # Redis hiccup doesn't restart the app. Same trick for a manual basic check:
@@ -35,8 +35,11 @@ module RailsPodKit
35
35
 
36
36
  # Configures HealthMonitor with the kit's defaults.
37
37
  #
38
- # redis: Redis connection options hash (same shape the host passes to
39
- # Sidekiq) or a ready connection object (Redis / ConnectionPool).
38
+ # redis: optional Redis connection options hash (same shape the host
39
+ # passes to Sidekiq) or a ready connection object (Redis /
40
+ # ConnectionPool); when given the Redis provider is added. Omit
41
+ # entirely (or pass nil) on hosts with no Redis dependency to get
42
+ # a database + cache only endpoint.
40
43
  # path: mount-relative endpoint path (default :healthz).
41
44
  # sidekiq: optional thresholds hash; when given the Sidekiq provider is
42
45
  # added with the provided `queue_size:` / `latency:` overrides
@@ -51,14 +54,17 @@ module RailsPodKit
51
54
  #
52
55
  # Any further host-specific tuning (extra providers, error callback, …) can
53
56
  # be done in the block, which receives the HealthMonitor configuration.
54
- def install!(redis:, path: :healthz, sidekiq: nil, silence_controller_log: true, mount: true)
57
+ def install!(redis: nil, path: :healthz, sidekiq: nil, silence_controller_log: true, mount: true)
55
58
  @auto_mount = mount
56
59
 
57
60
  HealthMonitor.configure do |config|
58
61
  config.path = path
59
62
  config.cache
60
- config.redis.configure do |redis_config|
61
- redis_config.connection = build_connection(redis)
63
+
64
+ if redis
65
+ config.redis.configure do |redis_config|
66
+ redis_config.connection = build_connection(redis)
67
+ end
62
68
  end
63
69
 
64
70
  if sidekiq
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pod_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Napoleoni