yabeda-rb / yabeda-prometheus-mmap

Yabeda Prometheus exporter based on prometheus-client-mmap
MIT License
16 stars 6 forks source link

Rust required for `prometheus-client-mmap` #10

Closed chornbec closed 4 days ago

chornbec commented 5 days ago

About a year ago, prometheus-client-mmap replaced the C extension with Rust, so now Rust is required to install prometheus-client-mmap and hence this yabeda-prometheus-mmap gem seeing as prometheus-client-mmap is a dependency.

I'm using Docker, and if we follow the current setup for this gem, it will not work unless you're using an image that already includes Rust and libclang-dev. Is there a note or additional steps we can add for installing with Docker? Or possibly even better, can we pin the version of prometheus-client-mmap to the version before it requires Rust (version 0.28.1)?

Envek commented 4 days ago

I can see that prometheus-client-mmap has platform-specific gem versions (e.g. 1.1.1-x86_64-linux) that should be pre-built and hence shouldn't require Rust for installation.

Check that you don't have force_ruby_platform Bundler config set (e.g. BUNDLE_FORCE_RUBY_PLATFORM="true") as it forces native extensions to be compiled (see https://www.bundler.cn/man/bundle-config.1.html)

And yes, you can pin version of a dependency yourself right in your Gemfile, just place gem "prometheus-client-mmap", "~> 0.28.1" anywhere)

chornbec commented 4 days ago

Thank you, that's helpful as I'm not an expert with bundler. I noticed force_ruby_platform was enabled globally within my Dockerfile. After removing that and specifying the below in my Gemfile, installation worked.

gem 'prometheus-client-mmap', '~> 1.1.1'
gem 'yabeda-prometheus-mmap'