Skip to content

Commit

Permalink
🚀 Enable Heroku Ruby Metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdawkins committed Feb 8, 2019
1 parent a19a2ba commit 79a87d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ gem 'bootsnap', '>= 1.1.0', require: false
gem 'puma', '~> 3.11' gem 'puma', '~> 3.11'
gem 'sidekiq' gem 'sidekiq'


# Metrics
gem 'barnes'

# Database # Database
gem 'data_migrate' gem 'data_migrate'
gem 'pg', '>= 0.18', '< 2.0' gem 'pg', '>= 0.18', '< 2.0'
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ GEM
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
arel (9.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
barnes (0.0.7)
multi_json (~> 1)
statsd-ruby (~> 1.1)
bootsnap (1.3.2) bootsnap (1.3.2)
msgpack (~> 1.0) msgpack (~> 1.0)
buftok (0.2.0) buftok (0.2.0)
Expand Down Expand Up @@ -255,6 +258,7 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
statsd-ruby (1.4.0)
thor (0.20.3) thor (0.20.3)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.9) tilt (2.0.9)
Expand Down Expand Up @@ -292,6 +296,7 @@ PLATFORMS


DEPENDENCIES DEPENDENCIES
andand! andand!
barnes
bootsnap (>= 1.1.0) bootsnap (>= 1.1.0)
commonmarker (~> 0.16) commonmarker (~> 0.16)
data_migrate data_migrate
Expand Down
36 changes: 10 additions & 26 deletions config/puma.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,34 +1,18 @@
# Puma can serve each request in a thread from an internal thread pool. require 'barnes'
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match before_fork do
# the maximum value specified for Puma. Default is set to 5 threads for minimum # worker specific setup
# and maximum; this matches the default thread size of Active Record.
# Barnes.start
end

threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count threads threads_count, threads_count


# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 } port ENV.fetch("PORT") { 3000 }


# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" } environment ENV.fetch("RAILS_ENV") { "development" }


# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart plugin :tmp_restart

0 comments on commit 79a87d4

Please sign in to comment.