heroku / barnes

Tell StatsD about request time, GC, objects and more. Latest Rails 4 and Ruby 2.1 support, and ancient Rails 2 and Ruby 1.8 support.
MIT License
0 stars 0 forks source link

Detect when app is using Puma #18

Closed schneems closed 6 years ago

schneems commented 6 years ago

When the app is using puma then we send a value of 1 this allows us to detect if the app should be sending a specific stat but it is not due to using an older version of Puma.

As part of this work I renamed PumaBacklog to PumaInstrument since we're no longer recording backlog.

bf4 commented 6 years ago

Does this mean that the docs are out of date, that as of this commit, we don't need to start Barnes manually in a puma fork? https://devcenter.heroku.com/articles/language-runtime-metrics-ruby#add-the-barnes-gem-to-your-application

docs there say to add (presumably in the config/puma.rb

require 'barnes'

on_worker_boot do
  # worker specific setup

  Barnes.start
end

Docs also say you can get Puma pool usage with Barnes gem >= 0.07 and Puma gem >= 3.12.0.

Should Barnes releases recommend a Puma version? I see I'm on 3.11.2 (and Barnes 0.0.4)

schneems commented 6 years ago

“Barnes.start” is still required.

I would recommend the latest Puma and latest Barnes to get access to the Puma Pool usage https://devcenter.heroku.com/articles/language-runtime-metrics-ruby#puma-pool-usage

This PR sends Data back to Heroku that we can use to give a helpful message about what versions need to be used in the dashboard.

bf4 commented 6 years ago

“Barnes.start” is still required.

I believe you mean it's still required in the config/puma.rb as documented in the heroku docs, but not in this repo? We've had metrics on for a while. I can't tell if there's something missing that Barnes.start would add, or how to check if it's 'started'. I only see that the railtie starts it on Rails initialize, which presumably is happening

Since I've only installed Barnes in the Gemfile production group

gem "barnes", groups: [:production]

I guess I'll need to account for that in the puma config

start_barnes = begin
                 require 'barnes'
               rescue LoadError
                 false
               else
                 true
               end
on_worker_boot do
  Barnes.start if start_barnes
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end

It doesn't look like I need to do this in sidekiq.