rails_pod_kit 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 +4 -4
- data/README.md +6 -1
- data/VERSION +1 -1
- data/lib/rails_pod_kit/puma.rb +4 -2
- data/lib/rails_pod_kit.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24c0e428faf1a3c46646a1d7a0e693b5cde8373f6aea61f9dc005d6b6dcba192
|
|
4
|
+
data.tar.gz: 968fc08545c75f5b22f91c2c882068b20069d7bb2bb6f48d1abf2aa09f4bc71b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 266b27abb0911f031e54522dfcea870d603e1ec143465b4441a206590654087c1604a9aeb4438745bc10600bf3696b7d4938c0c936e0145322b76cb0279a5513
|
|
7
|
+
data.tar.gz: dedc4665fb51d38b9e713caead650ee875108aed4a24e9f27bb3053f2ec0152bdcc0f3840cc0ac76056858f330b723c502bc5f66d726261db47a7033e6ae2142
|
data/README.md
CHANGED
|
@@ -332,7 +332,12 @@ Booting the full host app just to read a handful of Redis counters would cost
|
|
|
332
332
|
require only the config core, so the Rails-free exporter stays
|
|
333
333
|
railties-free and a `puma -C config/puma.rb` boot (which evaluates
|
|
334
334
|
`config/puma.rb` before Rails) still gets the integrations once
|
|
335
|
-
`Bundler.require` runs.
|
|
335
|
+
`Bundler.require` runs. The main file also loads the yabeda-prometheus-mmap
|
|
336
|
+
adapter at require time — before any host initializer runs — so host
|
|
337
|
+
initializers may declare Yabeda metrics (yabeda-rails, yabeda-activejob, a
|
|
338
|
+
custom collector) safely: the adapter registers itself while no metric exists
|
|
339
|
+
yet, regardless of whether the app boots via `bin/rails server` or
|
|
340
|
+
`puma -C config/puma.rb`.
|
|
336
341
|
|
|
337
342
|
## Local verification
|
|
338
343
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.3
|
data/lib/rails_pod_kit/puma.rb
CHANGED
|
@@ -29,8 +29,10 @@ module RailsPodKit
|
|
|
29
29
|
|
|
30
30
|
# The Puma plugin only pulls in the exporter class; we must also load the
|
|
31
31
|
# full mmap module so `Yabeda::Prometheus::Mmap.registry` exists and the
|
|
32
|
-
# mmap adapter is registered
|
|
33
|
-
#
|
|
32
|
+
# mmap adapter is registered. The gem's main entry (lib/rails_pod_kit.rb)
|
|
33
|
+
# already loaded it at Bundler.require, so this is normally a no-op — it
|
|
34
|
+
# matters only under `puma -C config/puma.rb`, where config/puma.rb runs
|
|
35
|
+
# before Rails and thus before the main entry, so this is the first require.
|
|
34
36
|
require 'yabeda/prometheus/mmap'
|
|
35
37
|
|
|
36
38
|
# The control app exposes Puma's /stats over a localhost-only socket that
|
data/lib/rails_pod_kit.rb
CHANGED
|
@@ -43,6 +43,19 @@ require 'rails_pod_kit/config'
|
|
|
43
43
|
# - under `puma -C config/puma.rb` — where Puma evaluates config/puma.rb
|
|
44
44
|
# (and thus rails_pod_kit/puma) before Rails exists — this file is still
|
|
45
45
|
# fresh for Bundler.require, so the integrations load once Rails is up.
|
|
46
|
+
|
|
47
|
+
# Load the mmap adapter here — at Bundler.require, before any host initializer
|
|
48
|
+
# runs — so its self-registration (`Yabeda.register_adapter` at require time)
|
|
49
|
+
# happens while no Yabeda metric exists yet, making it a no-op. The adapter's
|
|
50
|
+
# own `mmap.rb` requires the adapter *before* defining
|
|
51
|
+
# `Yabeda::Prometheus::Mmap.registry`; if a metric is already declared when the
|
|
52
|
+
# adapter loads, registration eagerly reaches for that not-yet-defined method
|
|
53
|
+
# and boots crash with a NoMethodError. Under `bin/rails server` Rails boots
|
|
54
|
+
# (and its initializers may declare metrics) before config/puma.rb requires the
|
|
55
|
+
# adapter, so loading it here is what makes the order-of-boot irrelevant. The
|
|
56
|
+
# lazy require in RailsPodKit::Puma.activate then degrades to a cheap no-op.
|
|
57
|
+
require 'yabeda/prometheus/mmap'
|
|
58
|
+
|
|
46
59
|
require 'rails_pod_kit/sidekiq'
|
|
47
60
|
require 'rails_pod_kit/health'
|
|
48
61
|
require 'rails_pod_kit/railtie'
|