Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
dsalahutdinov committed Mar 25, 2020
1 parent 103db8c commit f1ebc1d
Showing 1 changed file with 50 additions and 13 deletions.
63 changes: 50 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Yabeda::Prometheus::Mmap
<a href="https://amplifr.com/?utm_source=yabeda-prometheus-mmap">
<img width="100" height="140" align="right"
alt="Sponsored by Amplifr" src="https://amplifr-direct.s3-eu-west-1.amazonaws.com/social_images/image/37b580d9-3668-4005-8d5a-137de3a3e77c.png" />
</a>

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yabeda/prometheus/mmap`. To experiment with that code, run `bin/console` for an interactive prompt.
# Yabeda::[Prometheus]::Mmap


Adapter for easy exporting your collected metrics from your application to the [Prometheus]!
It is based on [Prometheus Ruby Mmap Client](https://gitlab.com/gitlab-org/prometheus-client-mmap), that uses mmap'ed files to share metrics from multiple processes.
This allows efficient metrics processing for Ruby web apps running in multiprocess setups like Unicorn or Puma (clustered mode).

TODO: Delete this and the text above, and describe your gem

## Installation

Expand All @@ -14,27 +21,57 @@ gem 'yabeda-prometheus-mmap'

And then execute:

$ bundle install
$ bundle

Or install it yourself as:
## Usage

$ gem install yabeda-prometheus-mmap
1. Exporting from running web servers:

## Usage
Place following in your `config.ru` _before_ running your application:

TODO: Write usage instructions here
```ruby
require 'yabeda/prometheus/mmap'

## Development
use Yabeda::Prometheus::Exporter
```

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.
Metrics will be available on `/metrics` path (configured by `:path` option).

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](https://rubygems.org).
Also you can mount it in Rails application routes as standalone Rack application.

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

```ruby
require 'yabeda/prometheus/mmap'
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.

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yabeda-prometheus-mmap.
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`).


## Development with Docker

Get local development environment working and tests running is very easy with docker-compose:
```bash
docker-compose run app bundle
docker-compose run app bundle exec rspec
```

## Contributing

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

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

[Prometheus]: https://prometheus.io/ "Open-source monitoring solution"
[yabeda-sidekiq]: https://github.com/yabeda-rb/yabeda-sidekiq

0 comments on commit f1ebc1d

Please sign in to comment.