yabeda-prometheus-mmap 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f0ebd6b2f081245c79f4d97b2e00e51897b26015bf96217f77236e3c0020279
4
- data.tar.gz: 0f44b6533da9d8106ea693d932da4dccc38d9360a2a81af211bef93eb838e154
3
+ metadata.gz: 3a4b12a39360e1ca4b9f1d849bee55f6022f904f444197e3e11776d3c35d10e5
4
+ data.tar.gz: 443b04248da339a56b1e37476e52a11ac6a1240cd1216102e994142902304cf0
5
5
  SHA512:
6
- metadata.gz: c73cb144636f784778ccde67f7f9f6f48d47544ca145a63c2425714fb76efe40940e4a4b9f593054eb4723699244310fdb567e3423ecebc55744695952b5976c
7
- data.tar.gz: e2f9adf3f4ce17dbf4552a8922378b06ddda1a22ec4b987d8c0bdb5f5d0632e9c88083fd7daf81229e26cab7cfa528909fc6817a13d0635e4fb873153ddebe1c
6
+ metadata.gz: f72aa5a161e28a3a050a605ea39db45cd903fd5d24306a1fff778fffe829f304240b92e9e838258bbe9b1a90301dabc7f4c730f73f77845c5424116d87de0afb
7
+ data.tar.gz: 2f52032cc8f4dad25227d18a88184622a6b7d3c902a7bf823a189ef28791369473cd5e5dcbf6694bdcc0a7e14ba2e07518ede35e197e6d65ba10d634f3076986
data/README.md CHANGED
@@ -1,8 +1,15 @@
1
- # Yabeda::Prometheus::Mmap
1
+ <a href="https://amplifr.com/?utm_source=yabeda-prometheus-mmap">
2
+ <img width="100" height="140" align="right"
3
+ alt="Sponsored by Amplifr" src="https://amplifr-direct.s3-eu-west-1.amazonaws.com/social_images/image/37b580d9-3668-4005-8d5a-137de3a3e77c.png" />
4
+ </a>
2
5
 
3
- 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.
6
+ # Yabeda::[Prometheus]::Mmap
7
+
8
+
9
+ Adapter for easy exporting your collected metrics from your application to the [Prometheus]!
10
+ 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.
11
+ This allows efficient metrics processing for Ruby web apps running in multiprocess setups like Unicorn or Puma (clustered mode).
4
12
 
5
- TODO: Delete this and the text above, and describe your gem
6
13
 
7
14
  ## Installation
8
15
 
@@ -14,27 +21,57 @@ gem 'yabeda-prometheus-mmap'
14
21
 
15
22
  And then execute:
16
23
 
17
- $ bundle install
24
+ $ bundle
18
25
 
19
- Or install it yourself as:
26
+ ## Usage
20
27
 
21
- $ gem install yabeda-prometheus-mmap
28
+ 1. Exporting from running web servers:
22
29
 
23
- ## Usage
30
+ Place following in your `config.ru` _before_ running your application:
24
31
 
25
- TODO: Write usage instructions here
32
+ ```ruby
33
+ require 'yabeda/prometheus/mmap'
26
34
 
27
- ## Development
35
+ use Yabeda::Prometheus::Exporter
36
+ ```
28
37
 
29
- 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.
38
+ Metrics will be available on `/metrics` path (configured by `:path` option).
30
39
 
31
- 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).
40
+ Also you can mount it in Rails application routes as standalone Rack application.
32
41
 
33
- ## Contributing
42
+ 2. Run web-server from long-running processes (delayed jobs, …):
43
+
44
+ ```ruby
45
+ require 'yabeda/prometheus/mmap'
46
+
47
+ Yabeda::Prometheus::Exporter.start_metrics_server!
48
+ ```
49
+
50
+ WEBrick will be launched in separate thread and will serve metrics on `/metrics` path.
51
+
52
+ See [yabeda-sidekiq] for example.
34
53
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yabeda-prometheus-mmap.
54
+ Listening address is configured via `PROMETHEUS_EXPORTER_BIND` env variable (default is `0.0.0.0`).
36
55
 
56
+ Port is configured by `PROMETHEUS_EXPORTER_PORT` or `PORT` variables (default is `9394`).
57
+
58
+
59
+ ## Development with Docker
60
+
61
+ Get local development environment working and tests running is very easy with docker-compose:
62
+ ```bash
63
+ docker-compose run app bundle
64
+ docker-compose run app bundle exec rspec
65
+ ```
66
+
67
+ ## Contributing
68
+
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-prometheus-mmap.
37
70
 
38
71
  ## License
39
72
 
40
73
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
74
+
75
+ [Prometheus]: https://prometheus.io/ "Open-source monitoring solution"
76
+ [yabeda-sidekiq]: https://github.com/yabeda-rb/yabeda-sidekiq
77
+
@@ -16,7 +16,7 @@ module Yabeda
16
16
  class << self
17
17
  # Allows to use middleware as standalone rack application
18
18
  def call(env)
19
- @app ||= new(NOT_FOUND_HANDLER, path: '/metrics')
19
+ @app ||= new(NOT_FOUND_HANDLER, path: '/')
20
20
  @app.call(env)
21
21
  end
22
22
 
@@ -3,7 +3,7 @@
3
3
  module Yabeda
4
4
  module Prometheus
5
5
  module Mmap
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-prometheus-mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Salahutdinov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prometheus-client-mmap