yabeda-rb / yabeda-prometheus

Adapter to expose metrics collected by Yabeda plugins to Prometheus
MIT License
112 stars 18 forks source link

Ruby 3 support (missing WEBrick dependency?) #15

Closed dgsangoma closed 3 years ago

dgsangoma commented 3 years ago

I'm not 100% certain whether this is an issue in yabeda-prometheus vs yabeda-sidekiq, but I ran into the following error when trying to run sidekiq locally after adding yabeda-sidekiq on a Rails 6.1.3.2 app running ruby 3.0.1:

$HOME/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- webrick (LoadError)
...
    from $HOME/.rvm/gems/ruby-3.0.1/gems/yabeda-prometheus-0.6.2/lib/yabeda/prometheus/exporter.rb:24:in `block in start_metrics_server!'

Based on https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/, I think this is due to webrick no longer being included as part of the standard lib / default gems. Add webrick to my Gemfile solves the problem, so I wanted to bring it to your attention so it could be added as an explicit dependency for the yabeda-* gems that may assume webrick is available.

Envek commented 3 years ago

Hey! Thanks for pointing that out! You're right, we need at least add a note about it to readme. Not sure whether we should add it as a fependency to yabeda-prometheus, but at least we can throw some exception with more detailed error message.

Envek commented 3 years ago

I tried to use Rack built-in detection of available application servers, but faced problem that if puma is being used with yabeda-puma-plugin exporter, then it tries to run both main and auxiliary pumas on the same port. So I decided to keep explicitly use WEBRick and just added a note to the README.

antonengelhardt commented 1 year ago

@Envek Thanks for updating the README. I almost gave up 😄

I followed this article and there it was not mentioned to include webrick. Works for me now 👏🏼