Skip to content

Commit

Permalink
feat: add puma metrics gem
Browse files Browse the repository at this point in the history
This allows to monitor PUMA via prometheus, providing insights for
health, scaling, etc.
  • Loading branch information
danimo committed Mar 6, 2024
1 parent c5a16e7 commit 19f6d3f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ end
group :production do
gem 'lograge', '~> 0.14.0'
gem 'remote_syslog_logger'
gem 'puma-metrics', '~> 1.2.0'
end
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,15 @@ GEM
ast (~> 2.4.1)
racc
pg (1.4.5)
prometheus-client (4.2.2)
psych (5.1.2)
stringio
public_suffix (5.0.3)
puma (5.6.8)
nio4r (~> 2.0)
puma-metrics (1.2.5)
prometheus-client (>= 0.10)
puma (>= 5.0)
racc (1.7.3)
rack (2.2.8.1)
rack-oauth2 (2.2.0)
Expand Down Expand Up @@ -534,6 +538,7 @@ DEPENDENCIES
pagy (~> 6.0, >= 6.0.0)
pg
puma (~> 5.6)
puma-metrics (~> 1.2.0)
rails (~> 7.1.3)
redis (~> 4.0)
remote_syslog_logger
Expand Down
7 changes: 7 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@

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

0 comments on commit 19f6d3f

Please sign in to comment.