diff --git a/Gemfile b/Gemfile index c7e57429a66..338447edbb8 100644 --- a/Gemfile +++ b/Gemfile @@ -64,4 +64,5 @@ end group :production do gem 'lograge', '~> 0.14.0' gem 'remote_syslog_logger' + gem 'puma-metrics', '~> 1.2.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 36791204bb0..29e26f64ae3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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 diff --git a/config/puma.rb b/config/puma.rb index f17f921d293..cc594aa5419 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -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'