Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yabeda.configure! is not called when starting server via bundle exec puma #15

Closed
shouichi opened this issue Oct 2, 2020 · 3 comments
Closed

Comments

@shouichi
Copy link

shouichi commented Oct 2, 2020

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!inconfig/initializers/yabeda.rb` fixed the problem.

Thanks.

@Envek
Copy link
Member

Envek commented Oct 2, 2020

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:

require "yabeda/railtie" if defined?(Rails)

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.

Envek added a commit to yabeda-rb/yabeda-rails that referenced this issue Oct 2, 2020
@Envek
Copy link
Member

Envek commented Oct 2, 2020

@shouichi or upgrade yabeda-rails to version 0.7.1 which should fix this.

@shouichi
Copy link
Author

shouichi commented Oct 3, 2020

Updating yabeda-rails to v0.7.1 did fix the problem thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants