diff --git a/Gemfile b/Gemfile index dfccc70..8904ff6 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,9 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +# GC Statsd Reporter [https://github.com/heroku/barnes] +gem 'barnes' + # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 4d3612f..646e7db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,6 +100,9 @@ GEM rake (>= 10.4, < 14.0) ast (2.4.2) attr_required (1.0.2) + barnes (0.0.9) + multi_json (~> 1) + statsd-ruby (~> 1.1) base64 (0.2.0) bcrypt (3.1.20) bigdecimal (3.1.8) @@ -230,6 +233,7 @@ GEM mini_mime (1.1.5) minitest (5.25.1) msgpack (1.7.2) + multi_json (1.15.0) mutex_m (0.2.0) net-http (0.4.1) uri @@ -409,6 +413,7 @@ GEM sqlite3 (1.7.3-arm64-darwin) sqlite3 (1.7.3-x86_64-darwin) sqlite3 (1.7.3-x86_64-linux) + statsd-ruby (1.5.0) stimulus-rails (1.3.4) railties (>= 6.0.0) stringex (2.8.6) @@ -469,6 +474,7 @@ PLATFORMS DEPENDENCIES administrate (~> 0.20.1) annotate + barnes bootsnap cancancan capybara diff --git a/app.json b/app.json index 4bb3f32..a674237 100644 --- a/app.json +++ b/app.json @@ -26,6 +26,9 @@ "buildpacks": [ { "url": "heroku/ruby" + }, + { + "url": "heroku/metrics" } ] } diff --git a/config/puma.rb b/config/puma.rb index afa809b..a180289 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -33,3 +33,11 @@ # Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart + +require 'barnes' + +before_fork do + # worker specific setup + + Barnes.start # Must have enabled worker mode for this to block to be called +end