Adapter for easy exporting your collected metrics from your application to the Prometheus!
One more? Why not X?
- https://github.com/discourse/prometheus_exporter – built on assumption that various processes (web, jobs, etc) are able to communicate between them on single machine. But in containerized environments all your processes on different “machines”!
- https://github.com/getqujing/prome – actually inspired this all these gems but seems abandoned and lacks extensibility.
Add this lines to your application's Gemfile:
gem 'prometheus-client' # Or 'prometheus-client-mmap' if you need multi-process support gem 'yabeda-prometheus'
And then execute:
Exporting from running web servers:
Place following in your
config.rubefore running your application:
Metrics will be available on
/metricspath (configured by
Also you can mount it in Rails application routes as standalone Rack application.
Run web-server from long-running processes (delayed jobs, …):
WEBrick will be launched in separate thread and will serve metrics on
See yabeda-sidekiq for example.
Listening address is configured via
PROMETHEUS_EXPORTER_BINDenv variable (default is
Port is configured by
PORTvariables (default is
Use push gateway for short living things (rake tasks, cron jobs, …):
Address of push gateway is configured with
After checking out the repo, run
bin/setup to install dependencies. Then, run
rake spec to run the tests. You can also run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install. To release a new version, update the version number in
version.rb, and then run
bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-prometheus.
The gem is available as open source under the terms of the MIT License.