sidekiq-prometheus-exporter 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +4 -0
- data/.travis.yml +14 -0
- data/Appraisals +19 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +85 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gemfiles/sidekiq_3.3.1.gemfile +9 -0
- data/gemfiles/sidekiq_3.3.1.gemfile.lock +119 -0
- data/gemfiles/sidekiq_3.x.gemfile +9 -0
- data/gemfiles/sidekiq_3.x.gemfile.lock +119 -0
- data/gemfiles/sidekiq_4.x.gemfile +7 -0
- data/gemfiles/sidekiq_4.x.gemfile.lock +83 -0
- data/gemfiles/sidekiq_5.x.gemfile +7 -0
- data/gemfiles/sidekiq_5.x.gemfile.lock +83 -0
- data/lib/sidekiq/prometheus/exporter.rb +88 -0
- data/lib/sidekiq/prometheus/exporter/version.rb +7 -0
- data/sidekiq-prometheus-exporter.gemspec +40 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8944a3fac4369c68e5b07fd4a76c6bb90d685d5a
|
4
|
+
data.tar.gz: c0a289be0c91753b95895a5bf16376dff30b27c2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db38b1581e5aa75adf94a8d01674152736f61dcb0f53b91a579902c9e4a52e9c89dc88a385e0a39b8aa2a0b98d7c90257f7f7e89d6e1a24c28788558ae1f1a02
|
7
|
+
data.tar.gz: cbefbbeccba5343650001770f20ae952cf124339c67a27e584198520f35022ad9b0324f3fd7cc1cff57a3799df5a5cf2c500515e9f86866ac7fdc7ac6ac152b7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.2.9
|
5
|
+
- 2.3.6
|
6
|
+
- 2.4.3
|
7
|
+
- 2.5.0
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/sidekiq_3.3.1.gemfile
|
10
|
+
- gemfiles/sidekiq_3.x.gemfile
|
11
|
+
- gemfiles/sidekiq_4.x.gemfile
|
12
|
+
- gemfiles/sidekiq_5.x.gemfile
|
13
|
+
before_install: gem install bundler -v 1.16.1
|
14
|
+
script: bundle exec appraisal rake spec
|
data/Appraisals
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
appraise 'sidekiq-3.3.1' do
|
2
|
+
gem 'slim'
|
3
|
+
gem 'sinatra'
|
4
|
+
gem 'sidekiq', '= 3.3.1'
|
5
|
+
end
|
6
|
+
|
7
|
+
appraise 'sidekiq-3.x' do
|
8
|
+
gem 'slim'
|
9
|
+
gem 'sinatra'
|
10
|
+
gem 'sidekiq', '~> 3.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise 'sidekiq-4.x' do
|
14
|
+
gem 'sidekiq', '~> 4.0'
|
15
|
+
end
|
16
|
+
|
17
|
+
appraise 'sidekiq-5.x' do
|
18
|
+
gem 'sidekiq', '~> 5.0'
|
19
|
+
end
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Sergey Fedorov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/Strech/sidekiq-prometheus-exporter.svg?branch=master)](https://travis-ci.org/Strech/sidekiq-prometheus-exporter)
|
2
|
+
|
3
|
+
# Sidekiq Prometheus Exporter
|
4
|
+
|
5
|
+
> — Hey! Sidekiq dashboard stats looks like a Prometheus metrics!?
|
6
|
+
>
|
7
|
+
> — Indeed ... :thinking:
|
8
|
+
|
9
|
+
# Available metrics
|
10
|
+
|
11
|
+
(starting Sidekiq `v3.3.1`)
|
12
|
+
|
13
|
+
```text
|
14
|
+
sidekiq_processed_jobs_total counter The total number of processed jobs.
|
15
|
+
sidekiq_failed_jobs_total counter The total number of failed jobs.
|
16
|
+
sidekiq_busy_workers gauge The number of workers performing the job.
|
17
|
+
sidekiq_enqueued_jobs gauge The number of enqueued jobs.
|
18
|
+
sidekiq_scheduled_jobs gauge The number of jobs scheduled for a future execution.
|
19
|
+
sidekiq_retry_jobs gauge The number of jobs scheduled for the next try.
|
20
|
+
sidekiq_dead_jobs gauge The number of jobs being dead.
|
21
|
+
sidekiq_queue_latency_seconds gauge The amount of seconds between oldest job being pushed
|
22
|
+
to the queue and current time (labels: name).
|
23
|
+
```
|
24
|
+
|
25
|
+
# Installation
|
26
|
+
|
27
|
+
Add this line to your application's Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'sidekiq-prometheus-exporter'
|
31
|
+
```
|
32
|
+
|
33
|
+
And then execute:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
$ bundle
|
37
|
+
```
|
38
|
+
|
39
|
+
Or install it yourself as:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
$ gem install test
|
43
|
+
```
|
44
|
+
|
45
|
+
# Rack application
|
46
|
+
|
47
|
+
For a fresh new application to expose metrics create `config.ru` file with
|
48
|
+
next code inside
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'sidekiq/prometheus/exporter'
|
52
|
+
|
53
|
+
run Sidekiq::Prometheus::Exporter.to_app
|
54
|
+
```
|
55
|
+
|
56
|
+
use your favorite server to start it up, like this
|
57
|
+
|
58
|
+
```
|
59
|
+
$ bundle exec rackup -p9292 -o0.0.0.0
|
60
|
+
```
|
61
|
+
|
62
|
+
and then `curl https://0.0.0.0:9292/metrics`
|
63
|
+
|
64
|
+
# Sidekiq Web (extream)
|
65
|
+
|
66
|
+
If you are fine, that metrics will be exposed via Sidekiq web dashboard because
|
67
|
+
you have it inside your private network or only Prometheus scraper will have an
|
68
|
+
access to a machine/port/etc, then add a few lines into your web `config.ru`
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
require 'sidekiq/web'
|
72
|
+
require 'sidekiq/prometheus/exporter'
|
73
|
+
|
74
|
+
Sidekiq::Web.register(Sidekiq::Prometheus::Exporter)
|
75
|
+
```
|
76
|
+
|
77
|
+
and then `curl https://<your-sidekiq-web-uri>/metrics`
|
78
|
+
|
79
|
+
## Contributing
|
80
|
+
|
81
|
+
Bug reports and pull requests to support earlier versions of Sidekiq are welcome on GitHub at https://github.com/Strech/sidekiq-prometheus-exporter/issues.
|
82
|
+
|
83
|
+
# License
|
84
|
+
|
85
|
+
Please see [LICENSE](https://github.com/mperham/sidekiq/blob/master/LICENSE) for licensing details.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sidekiq/prometheus/exporter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
sidekiq-prometheus-exporter (0.1.0)
|
5
|
+
sidekiq (>= 3.3.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.2.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
ast (2.4.0)
|
15
|
+
byebug (10.0.0)
|
16
|
+
celluloid (0.17.3)
|
17
|
+
celluloid-essentials
|
18
|
+
celluloid-extras
|
19
|
+
celluloid-fsm
|
20
|
+
celluloid-pool
|
21
|
+
celluloid-supervision
|
22
|
+
timers (>= 4.1.1)
|
23
|
+
celluloid-essentials (0.20.5)
|
24
|
+
timers (>= 4.1.1)
|
25
|
+
celluloid-extras (0.20.5)
|
26
|
+
timers (>= 4.1.1)
|
27
|
+
celluloid-fsm (0.20.5)
|
28
|
+
timers (>= 4.1.1)
|
29
|
+
celluloid-pool (0.20.5)
|
30
|
+
timers (>= 4.1.1)
|
31
|
+
celluloid-supervision (0.20.6)
|
32
|
+
timers (>= 4.1.1)
|
33
|
+
coderay (1.1.2)
|
34
|
+
connection_pool (2.2.1)
|
35
|
+
diff-lcs (1.3)
|
36
|
+
hitimes (1.2.6)
|
37
|
+
json (2.1.0)
|
38
|
+
method_source (0.9.0)
|
39
|
+
mustermann (1.0.1)
|
40
|
+
parallel (1.12.1)
|
41
|
+
parser (2.4.0.2)
|
42
|
+
ast (~> 2.3)
|
43
|
+
powerpack (0.1.1)
|
44
|
+
pry (0.11.3)
|
45
|
+
coderay (~> 1.1.0)
|
46
|
+
method_source (~> 0.9.0)
|
47
|
+
pry-byebug (3.6.0)
|
48
|
+
byebug (~> 10.0)
|
49
|
+
pry (~> 0.10)
|
50
|
+
rack (2.0.4)
|
51
|
+
rack-protection (2.0.0)
|
52
|
+
rack
|
53
|
+
rack-test (0.8.2)
|
54
|
+
rack (>= 1.0, < 3)
|
55
|
+
rainbow (3.0.0)
|
56
|
+
rake (10.5.0)
|
57
|
+
redis (4.0.1)
|
58
|
+
redis-namespace (1.6.0)
|
59
|
+
redis (>= 3.0.4)
|
60
|
+
rspec (3.7.0)
|
61
|
+
rspec-core (~> 3.7.0)
|
62
|
+
rspec-expectations (~> 3.7.0)
|
63
|
+
rspec-mocks (~> 3.7.0)
|
64
|
+
rspec-core (3.7.1)
|
65
|
+
rspec-support (~> 3.7.0)
|
66
|
+
rspec-expectations (3.7.0)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.7.0)
|
69
|
+
rspec-mocks (3.7.0)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.7.0)
|
72
|
+
rspec-support (3.7.1)
|
73
|
+
rubocop (0.52.1)
|
74
|
+
parallel (~> 1.10)
|
75
|
+
parser (>= 2.4.0.2, < 3.0)
|
76
|
+
powerpack (~> 0.1)
|
77
|
+
rainbow (>= 2.2.2, < 4.0)
|
78
|
+
ruby-progressbar (~> 1.7)
|
79
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
80
|
+
ruby-progressbar (1.9.0)
|
81
|
+
sidekiq (3.3.1)
|
82
|
+
celluloid (>= 0.16.0)
|
83
|
+
connection_pool (>= 2.1.1)
|
84
|
+
json
|
85
|
+
redis (>= 3.0.6)
|
86
|
+
redis-namespace (>= 1.3.1)
|
87
|
+
sinatra (2.0.0)
|
88
|
+
mustermann (~> 1.0)
|
89
|
+
rack (~> 2.0)
|
90
|
+
rack-protection (= 2.0.0)
|
91
|
+
tilt (~> 2.0)
|
92
|
+
slim (3.0.9)
|
93
|
+
temple (>= 0.7.6, < 0.9)
|
94
|
+
tilt (>= 1.3.3, < 2.1)
|
95
|
+
temple (0.8.0)
|
96
|
+
thor (0.20.0)
|
97
|
+
tilt (2.0.8)
|
98
|
+
timers (4.1.2)
|
99
|
+
hitimes
|
100
|
+
unicode-display_width (1.3.0)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
ruby
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
appraisal (~> 2.2)
|
107
|
+
bundler (~> 1.16)
|
108
|
+
pry-byebug (~> 3.6)
|
109
|
+
rack-test (~> 0.8)
|
110
|
+
rake (~> 10.0)
|
111
|
+
rspec (~> 3.0)
|
112
|
+
rubocop (~> 0.52)
|
113
|
+
sidekiq (= 3.3.1)
|
114
|
+
sidekiq-prometheus-exporter!
|
115
|
+
sinatra
|
116
|
+
slim
|
117
|
+
|
118
|
+
BUNDLED WITH
|
119
|
+
1.16.1
|
@@ -0,0 +1,119 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
sidekiq-prometheus-exporter (0.1.0)
|
5
|
+
sidekiq (>= 3.3.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.2.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
ast (2.4.0)
|
15
|
+
byebug (10.0.0)
|
16
|
+
celluloid (0.17.3)
|
17
|
+
celluloid-essentials
|
18
|
+
celluloid-extras
|
19
|
+
celluloid-fsm
|
20
|
+
celluloid-pool
|
21
|
+
celluloid-supervision
|
22
|
+
timers (>= 4.1.1)
|
23
|
+
celluloid-essentials (0.20.5)
|
24
|
+
timers (>= 4.1.1)
|
25
|
+
celluloid-extras (0.20.5)
|
26
|
+
timers (>= 4.1.1)
|
27
|
+
celluloid-fsm (0.20.5)
|
28
|
+
timers (>= 4.1.1)
|
29
|
+
celluloid-pool (0.20.5)
|
30
|
+
timers (>= 4.1.1)
|
31
|
+
celluloid-supervision (0.20.6)
|
32
|
+
timers (>= 4.1.1)
|
33
|
+
coderay (1.1.2)
|
34
|
+
connection_pool (2.2.1)
|
35
|
+
diff-lcs (1.3)
|
36
|
+
hitimes (1.2.6)
|
37
|
+
json (1.8.6)
|
38
|
+
method_source (0.9.0)
|
39
|
+
mustermann (1.0.1)
|
40
|
+
parallel (1.12.1)
|
41
|
+
parser (2.4.0.2)
|
42
|
+
ast (~> 2.3)
|
43
|
+
powerpack (0.1.1)
|
44
|
+
pry (0.11.3)
|
45
|
+
coderay (~> 1.1.0)
|
46
|
+
method_source (~> 0.9.0)
|
47
|
+
pry-byebug (3.6.0)
|
48
|
+
byebug (~> 10.0)
|
49
|
+
pry (~> 0.10)
|
50
|
+
rack (2.0.4)
|
51
|
+
rack-protection (2.0.0)
|
52
|
+
rack
|
53
|
+
rack-test (0.8.2)
|
54
|
+
rack (>= 1.0, < 3)
|
55
|
+
rainbow (3.0.0)
|
56
|
+
rake (10.5.0)
|
57
|
+
redis (3.3.5)
|
58
|
+
redis-namespace (1.6.0)
|
59
|
+
redis (>= 3.0.4)
|
60
|
+
rspec (3.7.0)
|
61
|
+
rspec-core (~> 3.7.0)
|
62
|
+
rspec-expectations (~> 3.7.0)
|
63
|
+
rspec-mocks (~> 3.7.0)
|
64
|
+
rspec-core (3.7.1)
|
65
|
+
rspec-support (~> 3.7.0)
|
66
|
+
rspec-expectations (3.7.0)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.7.0)
|
69
|
+
rspec-mocks (3.7.0)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.7.0)
|
72
|
+
rspec-support (3.7.1)
|
73
|
+
rubocop (0.52.1)
|
74
|
+
parallel (~> 1.10)
|
75
|
+
parser (>= 2.4.0.2, < 3.0)
|
76
|
+
powerpack (~> 0.1)
|
77
|
+
rainbow (>= 2.2.2, < 4.0)
|
78
|
+
ruby-progressbar (~> 1.7)
|
79
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
80
|
+
ruby-progressbar (1.9.0)
|
81
|
+
sidekiq (3.5.4)
|
82
|
+
celluloid (~> 0.17.2)
|
83
|
+
connection_pool (~> 2.2, >= 2.2.0)
|
84
|
+
json (~> 1.0)
|
85
|
+
redis (~> 3.2, >= 3.2.1)
|
86
|
+
redis-namespace (~> 1.5, >= 1.5.2)
|
87
|
+
sinatra (2.0.0)
|
88
|
+
mustermann (~> 1.0)
|
89
|
+
rack (~> 2.0)
|
90
|
+
rack-protection (= 2.0.0)
|
91
|
+
tilt (~> 2.0)
|
92
|
+
slim (3.0.9)
|
93
|
+
temple (>= 0.7.6, < 0.9)
|
94
|
+
tilt (>= 1.3.3, < 2.1)
|
95
|
+
temple (0.8.0)
|
96
|
+
thor (0.20.0)
|
97
|
+
tilt (2.0.8)
|
98
|
+
timers (4.1.2)
|
99
|
+
hitimes
|
100
|
+
unicode-display_width (1.3.0)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
ruby
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
appraisal (~> 2.2)
|
107
|
+
bundler (~> 1.16)
|
108
|
+
pry-byebug (~> 3.6)
|
109
|
+
rack-test (~> 0.8)
|
110
|
+
rake (~> 10.0)
|
111
|
+
rspec (~> 3.0)
|
112
|
+
rubocop (~> 0.52)
|
113
|
+
sidekiq (~> 3.0)
|
114
|
+
sidekiq-prometheus-exporter!
|
115
|
+
sinatra
|
116
|
+
slim
|
117
|
+
|
118
|
+
BUNDLED WITH
|
119
|
+
1.16.1
|
@@ -0,0 +1,83 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
sidekiq-prometheus-exporter (0.1.0)
|
5
|
+
sidekiq (>= 3.3.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.2.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
ast (2.4.0)
|
15
|
+
byebug (10.0.0)
|
16
|
+
coderay (1.1.2)
|
17
|
+
concurrent-ruby (1.0.5)
|
18
|
+
connection_pool (2.2.1)
|
19
|
+
diff-lcs (1.3)
|
20
|
+
method_source (0.9.0)
|
21
|
+
parallel (1.12.1)
|
22
|
+
parser (2.4.0.2)
|
23
|
+
ast (~> 2.3)
|
24
|
+
powerpack (0.1.1)
|
25
|
+
pry (0.11.3)
|
26
|
+
coderay (~> 1.1.0)
|
27
|
+
method_source (~> 0.9.0)
|
28
|
+
pry-byebug (3.6.0)
|
29
|
+
byebug (~> 10.0)
|
30
|
+
pry (~> 0.10)
|
31
|
+
rack (2.0.4)
|
32
|
+
rack-protection (2.0.0)
|
33
|
+
rack
|
34
|
+
rack-test (0.8.2)
|
35
|
+
rack (>= 1.0, < 3)
|
36
|
+
rainbow (3.0.0)
|
37
|
+
rake (10.5.0)
|
38
|
+
redis (3.3.5)
|
39
|
+
rspec (3.7.0)
|
40
|
+
rspec-core (~> 3.7.0)
|
41
|
+
rspec-expectations (~> 3.7.0)
|
42
|
+
rspec-mocks (~> 3.7.0)
|
43
|
+
rspec-core (3.7.1)
|
44
|
+
rspec-support (~> 3.7.0)
|
45
|
+
rspec-expectations (3.7.0)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.7.0)
|
48
|
+
rspec-mocks (3.7.0)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.7.0)
|
51
|
+
rspec-support (3.7.1)
|
52
|
+
rubocop (0.52.1)
|
53
|
+
parallel (~> 1.10)
|
54
|
+
parser (>= 2.4.0.2, < 3.0)
|
55
|
+
powerpack (~> 0.1)
|
56
|
+
rainbow (>= 2.2.2, < 4.0)
|
57
|
+
ruby-progressbar (~> 1.7)
|
58
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
59
|
+
ruby-progressbar (1.9.0)
|
60
|
+
sidekiq (4.2.10)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
connection_pool (~> 2.2, >= 2.2.0)
|
63
|
+
rack-protection (>= 1.5.0)
|
64
|
+
redis (~> 3.2, >= 3.2.1)
|
65
|
+
thor (0.20.0)
|
66
|
+
unicode-display_width (1.3.0)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
ruby
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
appraisal (~> 2.2)
|
73
|
+
bundler (~> 1.16)
|
74
|
+
pry-byebug (~> 3.6)
|
75
|
+
rack-test (~> 0.8)
|
76
|
+
rake (~> 10.0)
|
77
|
+
rspec (~> 3.0)
|
78
|
+
rubocop (~> 0.52)
|
79
|
+
sidekiq (~> 4.0)
|
80
|
+
sidekiq-prometheus-exporter!
|
81
|
+
|
82
|
+
BUNDLED WITH
|
83
|
+
1.16.1
|
@@ -0,0 +1,83 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
sidekiq-prometheus-exporter (0.1.0)
|
5
|
+
sidekiq (>= 3.3.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.2.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
ast (2.4.0)
|
15
|
+
byebug (10.0.0)
|
16
|
+
coderay (1.1.2)
|
17
|
+
concurrent-ruby (1.0.5)
|
18
|
+
connection_pool (2.2.1)
|
19
|
+
diff-lcs (1.3)
|
20
|
+
method_source (0.9.0)
|
21
|
+
parallel (1.12.1)
|
22
|
+
parser (2.4.0.2)
|
23
|
+
ast (~> 2.3)
|
24
|
+
powerpack (0.1.1)
|
25
|
+
pry (0.11.3)
|
26
|
+
coderay (~> 1.1.0)
|
27
|
+
method_source (~> 0.9.0)
|
28
|
+
pry-byebug (3.6.0)
|
29
|
+
byebug (~> 10.0)
|
30
|
+
pry (~> 0.10)
|
31
|
+
rack (2.0.4)
|
32
|
+
rack-protection (2.0.0)
|
33
|
+
rack
|
34
|
+
rack-test (0.8.2)
|
35
|
+
rack (>= 1.0, < 3)
|
36
|
+
rainbow (3.0.0)
|
37
|
+
rake (10.5.0)
|
38
|
+
redis (4.0.1)
|
39
|
+
rspec (3.7.0)
|
40
|
+
rspec-core (~> 3.7.0)
|
41
|
+
rspec-expectations (~> 3.7.0)
|
42
|
+
rspec-mocks (~> 3.7.0)
|
43
|
+
rspec-core (3.7.1)
|
44
|
+
rspec-support (~> 3.7.0)
|
45
|
+
rspec-expectations (3.7.0)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.7.0)
|
48
|
+
rspec-mocks (3.7.0)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.7.0)
|
51
|
+
rspec-support (3.7.1)
|
52
|
+
rubocop (0.52.1)
|
53
|
+
parallel (~> 1.10)
|
54
|
+
parser (>= 2.4.0.2, < 3.0)
|
55
|
+
powerpack (~> 0.1)
|
56
|
+
rainbow (>= 2.2.2, < 4.0)
|
57
|
+
ruby-progressbar (~> 1.7)
|
58
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
59
|
+
ruby-progressbar (1.9.0)
|
60
|
+
sidekiq (5.1.1)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
connection_pool (~> 2.2, >= 2.2.0)
|
63
|
+
rack-protection (>= 1.5.0)
|
64
|
+
redis (>= 3.3.5, < 5)
|
65
|
+
thor (0.20.0)
|
66
|
+
unicode-display_width (1.3.0)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
ruby
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
appraisal (~> 2.2)
|
73
|
+
bundler (~> 1.16)
|
74
|
+
pry-byebug (~> 3.6)
|
75
|
+
rack-test (~> 0.8)
|
76
|
+
rake (~> 10.0)
|
77
|
+
rspec (~> 3.0)
|
78
|
+
rubocop (~> 0.52)
|
79
|
+
sidekiq (~> 5.0)
|
80
|
+
sidekiq-prometheus-exporter!
|
81
|
+
|
82
|
+
BUNDLED WITH
|
83
|
+
1.16.1
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sidekiq/prometheus/exporter/version'
|
4
|
+
require 'sidekiq/api'
|
5
|
+
|
6
|
+
module Sidekiq
|
7
|
+
module Prometheus
|
8
|
+
# Expose Prometheus metrics via Rack application or Sidekiq::Web application
|
9
|
+
module Exporter
|
10
|
+
HTTP_GET = 'GET'.freeze
|
11
|
+
REQUEST_METHOD = 'REQUEST_METHOD'.freeze
|
12
|
+
HEADERS = {
|
13
|
+
'Content-Type' => 'text/plain; version=0.0.4',
|
14
|
+
'Cache-Control' => 'no-cache'
|
15
|
+
}.freeze
|
16
|
+
LATENCY_TEMPLATE = 'sidekiq_queue_latency_seconds{name="%<name>s"} %<latency>.3f'.freeze
|
17
|
+
METRICS_TEMPLATE = <<-TEXT.gsub(/^[^\r\n][[:space:]]{2,}/, '').freeze
|
18
|
+
# HELP sidekiq_processed_jobs_total The total number of processed jobs.
|
19
|
+
# TYPE sidekiq_processed_jobs_total counter
|
20
|
+
sidekiq_processed_jobs_total %<processed_jobs>d
|
21
|
+
|
22
|
+
# HELP sidekiq_failed_jobs_total The total number of failed jobs.
|
23
|
+
# TYPE sidekiq_failed_jobs_total counter
|
24
|
+
sidekiq_failed_jobs_total %<failed_jobs>d
|
25
|
+
|
26
|
+
# HELP sidekiq_busy_workers The number of workers performing the job.
|
27
|
+
# TYPE sidekiq_busy_workers gauge
|
28
|
+
sidekiq_busy_workers %<busy_workers>d
|
29
|
+
|
30
|
+
# HELP sidekiq_enqueued_jobs The number of enqueued jobs.
|
31
|
+
# TYPE sidekiq_enqueued_jobs gauge
|
32
|
+
sidekiq_enqueued_jobs %<enqueued_jobs>d
|
33
|
+
|
34
|
+
# HELP sidekiq_scheduled_jobs The number of jobs scheduled for a future execution.
|
35
|
+
# TYPE sidekiq_scheduled_jobs gauge
|
36
|
+
sidekiq_scheduled_jobs %<scheduled_jobs>d
|
37
|
+
|
38
|
+
# HELP sidekiq_retry_jobs The number of jobs scheduled for the next try.
|
39
|
+
# TYPE sidekiq_retry_jobs gauge
|
40
|
+
sidekiq_retry_jobs %<retry_jobs>d
|
41
|
+
|
42
|
+
# HELP sidekiq_dead_jobs The number of jobs being dead.
|
43
|
+
# TYPE sidekiq_dead_jobs gauge
|
44
|
+
sidekiq_dead_jobs %<dead_jobs>d
|
45
|
+
|
46
|
+
# HELP sidekiq_queue_latency_seconds The amount of seconds between oldest job being pushed to the queue and current time.
|
47
|
+
# TYPE sidekiq_queue_latency_seconds gauge
|
48
|
+
%<queues_latency>s
|
49
|
+
TEXT
|
50
|
+
|
51
|
+
def self.to_app
|
52
|
+
Rack::Builder.app do
|
53
|
+
map('/metrics') do
|
54
|
+
run Sidekiq::Prometheus::Exporter
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.call(env)
|
60
|
+
return [404, HEADERS, [NOT_FOUND]] if env[REQUEST_METHOD] != HTTP_GET
|
61
|
+
|
62
|
+
stats = Sidekiq::Stats.new
|
63
|
+
queues_latency = Sidekiq::Queue.all.map do |queue|
|
64
|
+
format(LATENCY_TEMPLATE, name: queue.name, latency: queue.latency)
|
65
|
+
end
|
66
|
+
body = format(
|
67
|
+
METRICS_TEMPLATE,
|
68
|
+
processed_jobs: stats.processed,
|
69
|
+
scheduled_jobs: stats.scheduled_size,
|
70
|
+
enqueued_jobs: stats.enqueued,
|
71
|
+
failed_jobs: stats.failed,
|
72
|
+
retry_jobs: stats.retry_size,
|
73
|
+
dead_jobs: stats.dead_size,
|
74
|
+
busy_workers: stats.workers_size,
|
75
|
+
queues_latency: queues_latency * "\n"
|
76
|
+
)
|
77
|
+
|
78
|
+
[200, HEADERS, [body]]
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.registered(app)
|
82
|
+
app.get('/metrics') do
|
83
|
+
Sidekiq::Prometheus::Exporter.call(REQUEST_METHOD => HTTP_GET)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'sidekiq/prometheus/exporter/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'sidekiq-prometheus-exporter'
|
9
|
+
spec.version = Sidekiq::Prometheus::Exporter::VERSION
|
10
|
+
spec.authors = ['Sergey Fedorov']
|
11
|
+
spec.email = %w[oni.strech@gmail.com]
|
12
|
+
|
13
|
+
spec.summary = 'Prometheus exporter for the Sidekiq'
|
14
|
+
spec.description = 'All the basic metrics prepared for Prometheus'
|
15
|
+
spec.homepage = 'https://github.com/Strech/sidekiq-prometheus-exporter'
|
16
|
+
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
19
|
+
else
|
20
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
21
|
+
'public gem pushes.'
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |file|
|
25
|
+
file.match(%r{^(test|spec|features)/})
|
26
|
+
end
|
27
|
+
spec.bindir = 'exe'
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |file| File.basename(file) }
|
29
|
+
spec.require_paths = %w[lib]
|
30
|
+
|
31
|
+
spec.add_dependency 'sidekiq', '>= 3.3.1'
|
32
|
+
|
33
|
+
spec.add_development_dependency 'appraisal', '~> 2.2'
|
34
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
35
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.6'
|
36
|
+
spec.add_development_dependency 'rack-test', '~> 0.8'
|
37
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
|
+
spec.add_development_dependency 'rubocop', '~> 0.52'
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sidekiq-prometheus-exporter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergey Fedorov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sidekiq
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.3.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.3.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: appraisal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.52'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.52'
|
125
|
+
description: All the basic metrics prepared for Prometheus
|
126
|
+
email:
|
127
|
+
- oni.strech@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".travis.yml"
|
135
|
+
- Appraisals
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- bin/console
|
141
|
+
- bin/setup
|
142
|
+
- gemfiles/sidekiq_3.3.1.gemfile
|
143
|
+
- gemfiles/sidekiq_3.3.1.gemfile.lock
|
144
|
+
- gemfiles/sidekiq_3.x.gemfile
|
145
|
+
- gemfiles/sidekiq_3.x.gemfile.lock
|
146
|
+
- gemfiles/sidekiq_4.x.gemfile
|
147
|
+
- gemfiles/sidekiq_4.x.gemfile.lock
|
148
|
+
- gemfiles/sidekiq_5.x.gemfile
|
149
|
+
- gemfiles/sidekiq_5.x.gemfile.lock
|
150
|
+
- lib/sidekiq/prometheus/exporter.rb
|
151
|
+
- lib/sidekiq/prometheus/exporter/version.rb
|
152
|
+
- sidekiq-prometheus-exporter.gemspec
|
153
|
+
homepage: https://github.com/Strech/sidekiq-prometheus-exporter
|
154
|
+
licenses: []
|
155
|
+
metadata:
|
156
|
+
allowed_push_host: https://rubygems.org
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.5.2
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Prometheus exporter for the Sidekiq
|
177
|
+
test_files: []
|