Prometheus integration to export evil metrics
Switch branches/tags
Nothing to show
Clone or download
Envek 0.1.4: Add support for using prometheus-client-mmap gem as backend
This will allow to expose metrics from forking servers.

See #4
Latest commit 2f6e9a6 Nov 6, 2018

README.md

Yabeda::Prometheus

Gem Version

Adapter for easy exporting your collected metrics from your application to the Prometheus!

Sponsored by Evil Martians

One more? Why not X?

Installation

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:

$ bundle

Usage

  1. Exporting from running web servers:

    Place following in your config.ru before running your application:

    use Yabeda::Prometheus::Exporter

    Metrics will be available on /metrics path (configured by :path option).

    Also you can mount it in Rails application routes as standalone Rack application.

  2. Run web-server from long-running processes (delayed jobs, …):

    Yabeda::Prometheus::Exporter.start_metrics_server!

    WEBrick will be launched in separate thread and will serve metrics on /metrics path.

    See yabeda-sidekiq for example.

    Listening address is configured via PROMETHEUS_EXPORTER_BIND env variable (default is 0.0.0.0).

    Port is configured by PROMETHEUS_EXPORTER_PORT or PORT variables (default is 9394).

  3. Use push gateway for short living things (rake tasks, cron jobs, …):

    Yabeda::Prometheus.push_gateway.add(Yabeda::Prometheus.registry)

    Address of push gateway is configured with PROMETHEUS_PUSH_GATEWAY env variable.

Development

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-prometheus.

License

The gem is available as open source under the terms of the MIT License.