Yabeda.configure! is not called when starting server via bundle exec puma
shouichi opened this issue · 3 comments
Hi,
If you're using Ruby on Rails then it will be configured automatically!
README claims that Yabeda.configure!
is automatically called when it comes to rails but when the server is booted via bundle exec puma
, Yabeda.configure!
is not called and leads to NoSuchMethod
error (e.g., undefined method
sidekiq_jobs_enqueued_total' for Yabeda:Module). Manually calling
Yabeda.configure!in
config/initializers/yabeda.rb` fixed the problem.
Thanks.
You are using yabeda-puma-plugin, right?
The problem here is that when you use start Puma directly it requires Yabeda very early in its configuration, before rails. And thus following line doesn't get executed as Rails
isn't defined yet:
Line 9 in 7b578d8
You can read more about differences between various startup methods here: https://blog.sqreen.com/fixing-a-critical-issue-a-journey-into-ruby-web-server-startup-sequences-part-two/
As a workaround you can require rails
gem before referencing yabeda in your Puma configuration file:
# config/puma.rb
+require 'rails'
+
activate_control_app
plugin :yabeda
plugin :yabeda_prometheus
I don't know how to fix it at yabeda
gem level yet. But most probably can do something in yabeda-rails
.
@shouichi or upgrade yabeda-rails
to version 0.7.1 which should fix this.
Updating yabeda-rails
to v0.7.1 did fix the problem thanks!