Open hanyueitaro opened 2 years ago
I also ran into this problem yesterday when setting up Yabeda w/the Puma and Prometheus plugins.
The issue occurs when you try to start the puma server directly: bundle exec puma -C config/puma.rb
What happens:
plugin :yabeda
and requires lib/puma/plugin/yabeda.rb
require 'yabeda/puma/plugin.rb'
require 'yabeda'
require "yabeda/railtie" if defined?(Rails)
https://github.com/yabeda-rb/yabeda/blob/00ebff7036d9adcee9790e7612c3894b26a712cf/lib/yabeda.rb#L11defined?(Rails)
returns nil
, so railtie is not loaded and Yabeda.configure!
will not be invoked: https://github.com/yabeda-rb/yabeda/blob/7b578d8cb9ff72a2c33f954344e37f9fdeff72d0/lib/yabeda/railtie.rb#L7
As a workaround, you can add require "yabeda/railtie"
into your config/initializers/yabeda.rb
.
Thanks a lot for your investigation, @zabolotnov87!
I didn't even think about railtie, but now it seems to be pretty obvious :facepalm:
Overview
Hello.
I use this gem integrating with rails. However,
bundle exec puma -C config/puma.rb
, I get empty response from metrics endpoint.bundle exec rails s
, I get valid response from metrics endpoint.This may be caused by the similar problem:
https://github.com/yabeda-rb/yabeda/issues/15
Reproduce
I reproduced this problem in puma single worker mode, and exposing metrics on different port from puma.