Skip to content

Commit 19f6d3f

Browse files
committed
feat: add puma metrics gem
This allows to monitor PUMA via prometheus, providing insights for health, scaling, etc.
1 parent c5a16e7 commit 19f6d3f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ end
6464
group :production do
6565
gem 'lograge', '~> 0.14.0'
6666
gem 'remote_syslog_logger'
67+
gem 'puma-metrics', '~> 1.2.0'
6768
end

Gemfile.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,15 @@ GEM
312312
ast (~> 2.4.1)
313313
racc
314314
pg (1.4.5)
315+
prometheus-client (4.2.2)
315316
psych (5.1.2)
316317
stringio
317318
public_suffix (5.0.3)
318319
puma (5.6.8)
319320
nio4r (~> 2.0)
321+
puma-metrics (1.2.5)
322+
prometheus-client (>= 0.10)
323+
puma (>= 5.0)
320324
racc (1.7.3)
321325
rack (2.2.8.1)
322326
rack-oauth2 (2.2.0)
@@ -534,6 +538,7 @@ DEPENDENCIES
534538
pagy (~> 6.0, >= 6.0.0)
535539
pg
536540
puma (~> 5.6)
541+
puma-metrics (~> 1.2.0)
537542
rails (~> 7.1.3)
538543
redis (~> 4.0)
539544
remote_syslog_logger

config/puma.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,10 @@
5959

6060
# Allow puma to be restarted by `bin/rails restart` command.
6161
plugin :tmp_restart
62+
# Enable puma-metrics gem https://rubygems.org/gems/puma-metrics
63+
plugin 'metrics'
64+
# Bind the metric server to "url". "tcp://" is the only accepted protocol.
65+
#
66+
# The default is "tcp://0.0.0.0:9393", we bind it to localhost to be safe
67+
# by default.
68+
metrics_url 'tcp://127.0.0.1:9393'

0 commit comments

Comments
 (0)