sidekiq-prometheus-exporter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ FROM ruby:2.3.6-alpine
2
+
3
+ RUN gem install sidekiq -v "~> 5.0"
4
+ ENTRYPOINT [ "sidekiq" ]
5
+ CMD [ "-r", "/sidekiq.rb", "-C", "/sidekiq.yml" ]
@@ -0,0 +1,39 @@
1
+ class SleepyWorker
2
+ include Sidekiq::Worker
3
+
4
+ sidekiq_options queue: :default
5
+
6
+ def perform
7
+ sleep rand(1...10)
8
+ end
9
+ end
10
+
11
+ class BrokenWorker
12
+ include Sidekiq::Worker
13
+
14
+ sidekiq_options queue: :critical,
15
+ retry: 5
16
+
17
+ def perform
18
+ raise RuntimeError, 'Ooooooops ...'
19
+ end
20
+ end
21
+
22
+ Sidekiq.configure_server do |config|
23
+ config.redis = {url: 'redis://redis:6379/0'}
24
+ end
25
+
26
+ Sidekiq.configure_client do |config|
27
+ config.redis = {url: 'redis://redis:6379/0'}
28
+ end
29
+
30
+ Thread.new do
31
+ sleep 5
32
+
33
+ loop do
34
+ SleepyWorker.perform_async
35
+ BrokenWorker.perform_async
36
+
37
+ sleep rand(1..5)
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ ---
2
+ :concurrency: 2
3
+ :queues:
4
+ - [critical, 2]
5
+ - default
@@ -3,7 +3,9 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "slim"
6
+ gem "redis", ">= 3.3.5"
6
7
  gem "sinatra"
8
+ gem "concurrent-ruby"
7
9
  gem "sidekiq", "= 3.3.1"
8
10
 
9
11
  gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.0)
4
+ sidekiq-prometheus-exporter (0.1.1)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -30,9 +30,13 @@ GEM
30
30
  timers (>= 4.1.1)
31
31
  celluloid-supervision (0.20.6)
32
32
  timers (>= 4.1.1)
33
+ codeclimate-test-reporter (1.0.8)
34
+ simplecov (<= 0.13)
33
35
  coderay (1.1.2)
36
+ concurrent-ruby (1.0.5)
34
37
  connection_pool (2.2.1)
35
38
  diff-lcs (1.3)
39
+ docile (1.1.5)
36
40
  hitimes (1.2.6)
37
41
  json (2.1.0)
38
42
  method_source (0.9.0)
@@ -84,6 +88,11 @@ GEM
84
88
  json
85
89
  redis (>= 3.0.6)
86
90
  redis-namespace (>= 1.3.1)
91
+ simplecov (0.13.0)
92
+ docile (~> 1.1.0)
93
+ json (>= 1.8, < 3)
94
+ simplecov-html (~> 0.10.0)
95
+ simplecov-html (0.10.2)
87
96
  sinatra (2.0.0)
88
97
  mustermann (~> 1.0)
89
98
  rack (~> 2.0)
@@ -105,9 +114,12 @@ PLATFORMS
105
114
  DEPENDENCIES
106
115
  appraisal (~> 2.2)
107
116
  bundler (~> 1.16)
117
+ codeclimate-test-reporter (~> 1.0)
118
+ concurrent-ruby
108
119
  pry-byebug (~> 3.6)
109
120
  rack-test (~> 0.8)
110
121
  rake (~> 10.0)
122
+ redis (>= 3.3.5)
111
123
  rspec (~> 3.0)
112
124
  rubocop (~> 0.52)
113
125
  sidekiq (= 3.3.1)
@@ -3,7 +3,9 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "slim"
6
+ gem "redis", ">= 3.3.5"
6
7
  gem "sinatra"
8
+ gem "concurrent-ruby"
7
9
  gem "sidekiq", "~> 3.0"
8
10
 
9
11
  gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.0)
4
+ sidekiq-prometheus-exporter (0.1.1)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -30,11 +30,15 @@ GEM
30
30
  timers (>= 4.1.1)
31
31
  celluloid-supervision (0.20.6)
32
32
  timers (>= 4.1.1)
33
+ codeclimate-test-reporter (1.0.8)
34
+ simplecov (<= 0.13)
33
35
  coderay (1.1.2)
36
+ concurrent-ruby (1.0.5)
34
37
  connection_pool (2.2.1)
35
38
  diff-lcs (1.3)
39
+ docile (1.1.5)
36
40
  hitimes (1.2.6)
37
- json (1.8.6)
41
+ json (2.1.0)
38
42
  method_source (0.9.0)
39
43
  mustermann (1.0.1)
40
44
  parallel (1.12.1)
@@ -54,7 +58,7 @@ GEM
54
58
  rack (>= 1.0, < 3)
55
59
  rainbow (3.0.0)
56
60
  rake (10.5.0)
57
- redis (3.3.5)
61
+ redis (4.0.1)
58
62
  redis-namespace (1.6.0)
59
63
  redis (>= 3.0.4)
60
64
  rspec (3.7.0)
@@ -78,12 +82,17 @@ GEM
78
82
  ruby-progressbar (~> 1.7)
79
83
  unicode-display_width (~> 1.0, >= 1.0.1)
80
84
  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)
85
+ sidekiq (3.3.1)
86
+ celluloid (>= 0.16.0)
87
+ connection_pool (>= 2.1.1)
88
+ json
89
+ redis (>= 3.0.6)
90
+ redis-namespace (>= 1.3.1)
91
+ simplecov (0.13.0)
92
+ docile (~> 1.1.0)
93
+ json (>= 1.8, < 3)
94
+ simplecov-html (~> 0.10.0)
95
+ simplecov-html (0.10.2)
87
96
  sinatra (2.0.0)
88
97
  mustermann (~> 1.0)
89
98
  rack (~> 2.0)
@@ -105,9 +114,12 @@ PLATFORMS
105
114
  DEPENDENCIES
106
115
  appraisal (~> 2.2)
107
116
  bundler (~> 1.16)
117
+ codeclimate-test-reporter (~> 1.0)
118
+ concurrent-ruby
108
119
  pry-byebug (~> 3.6)
109
120
  rack-test (~> 0.8)
110
121
  rake (~> 10.0)
122
+ redis (>= 3.3.5)
111
123
  rspec (~> 3.0)
112
124
  rubocop (~> 0.52)
113
125
  sidekiq (~> 3.0)
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "redis", ">= 3.3.5"
5
6
  gem "sidekiq", "~> 4.0"
6
7
 
7
8
  gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.0)
4
+ sidekiq-prometheus-exporter (0.1.1)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -13,10 +13,14 @@ GEM
13
13
  thor (>= 0.14.0)
14
14
  ast (2.4.0)
15
15
  byebug (10.0.0)
16
+ codeclimate-test-reporter (1.0.8)
17
+ simplecov (<= 0.13)
16
18
  coderay (1.1.2)
17
19
  concurrent-ruby (1.0.5)
18
20
  connection_pool (2.2.1)
19
21
  diff-lcs (1.3)
22
+ docile (1.1.5)
23
+ json (2.1.0)
20
24
  method_source (0.9.0)
21
25
  parallel (1.12.1)
22
26
  parser (2.4.0.2)
@@ -62,6 +66,11 @@ GEM
62
66
  connection_pool (~> 2.2, >= 2.2.0)
63
67
  rack-protection (>= 1.5.0)
64
68
  redis (~> 3.2, >= 3.2.1)
69
+ simplecov (0.13.0)
70
+ docile (~> 1.1.0)
71
+ json (>= 1.8, < 3)
72
+ simplecov-html (~> 0.10.0)
73
+ simplecov-html (0.10.2)
65
74
  thor (0.20.0)
66
75
  unicode-display_width (1.3.0)
67
76
 
@@ -71,9 +80,11 @@ PLATFORMS
71
80
  DEPENDENCIES
72
81
  appraisal (~> 2.2)
73
82
  bundler (~> 1.16)
83
+ codeclimate-test-reporter (~> 1.0)
74
84
  pry-byebug (~> 3.6)
75
85
  rack-test (~> 0.8)
76
86
  rake (~> 10.0)
87
+ redis (>= 3.3.5)
77
88
  rspec (~> 3.0)
78
89
  rubocop (~> 0.52)
79
90
  sidekiq (~> 4.0)
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "redis", ">= 3.3.5"
5
6
  gem "sidekiq", "~> 5.0"
6
7
 
7
8
  gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.0)
4
+ sidekiq-prometheus-exporter (0.1.1)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -13,10 +13,14 @@ GEM
13
13
  thor (>= 0.14.0)
14
14
  ast (2.4.0)
15
15
  byebug (10.0.0)
16
+ codeclimate-test-reporter (1.0.8)
17
+ simplecov (<= 0.13)
16
18
  coderay (1.1.2)
17
19
  concurrent-ruby (1.0.5)
18
20
  connection_pool (2.2.1)
19
21
  diff-lcs (1.3)
22
+ docile (1.1.5)
23
+ json (2.1.0)
20
24
  method_source (0.9.0)
21
25
  parallel (1.12.1)
22
26
  parser (2.4.0.2)
@@ -62,6 +66,11 @@ GEM
62
66
  connection_pool (~> 2.2, >= 2.2.0)
63
67
  rack-protection (>= 1.5.0)
64
68
  redis (>= 3.3.5, < 5)
69
+ simplecov (0.13.0)
70
+ docile (~> 1.1.0)
71
+ json (>= 1.8, < 3)
72
+ simplecov-html (~> 0.10.0)
73
+ simplecov-html (0.10.2)
65
74
  thor (0.20.0)
66
75
  unicode-display_width (1.3.0)
67
76
 
@@ -71,9 +80,11 @@ PLATFORMS
71
80
  DEPENDENCIES
72
81
  appraisal (~> 2.2)
73
82
  bundler (~> 1.16)
83
+ codeclimate-test-reporter (~> 1.0)
74
84
  pry-byebug (~> 3.6)
75
85
  rack-test (~> 0.8)
76
86
  rake (~> 10.0)
87
+ redis (>= 3.3.5)
77
88
  rspec (~> 3.0)
78
89
  rubocop (~> 0.52)
79
90
  sidekiq (~> 5.0)
@@ -8,6 +8,7 @@ module Sidekiq
8
8
  # Expose Prometheus metrics via Rack application or Sidekiq::Web application
9
9
  module Exporter
10
10
  HTTP_GET = 'GET'.freeze
11
+ NOT_FOUND_TEXT = 'Not Found'.freeze
11
12
  REQUEST_METHOD = 'REQUEST_METHOD'.freeze
12
13
  HEADERS = {
13
14
  'Content-Type' => 'text/plain; version=0.0.4',
@@ -57,7 +58,7 @@ module Sidekiq
57
58
  end
58
59
 
59
60
  def self.call(env)
60
- return [404, HEADERS, [NOT_FOUND]] if env[REQUEST_METHOD] != HTTP_GET
61
+ return [404, HEADERS, [NOT_FOUND_TEXT]] if env[REQUEST_METHOD] != HTTP_GET
61
62
 
62
63
  stats = Sidekiq::Stats.new
63
64
  queues_latency = Sidekiq::Queue.all.map do |queue|
@@ -1,7 +1,7 @@
1
1
  module Sidekiq
2
2
  module Prometheus
3
3
  module Exporter
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.1'
5
5
  end
6
6
  end
7
7
  end
@@ -30,11 +30,12 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_dependency 'sidekiq', '>= 3.3.1'
32
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'
33
+ spec.add_development_dependency 'appraisal', '~> 2.2'
34
+ spec.add_development_dependency 'bundler', '~> 1.16'
35
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
36
+ spec.add_development_dependency 'pry-byebug', '~> 3.6'
37
+ spec.add_development_dependency 'rack-test', '~> 0.8'
38
+ spec.add_development_dependency 'rake', '~> 10.0'
39
+ spec.add_development_dependency 'rspec', '~> 3.0'
40
+ spec.add_development_dependency 'rubocop', '~> 0.52'
40
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-prometheus-exporter
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
  - Sergey Fedorov
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pry-byebug
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +153,15 @@ files:
139
153
  - Rakefile
140
154
  - bin/console
141
155
  - bin/setup
156
+ - examples/docker-compose.yml
157
+ - examples/metrics/Dockerfile
158
+ - examples/metrics/config.ru
159
+ - examples/prometheus/prometheus.yml
160
+ - examples/screenshot.png
161
+ - examples/sidekiq.json
162
+ - examples/sidekiq/Dockerfile
163
+ - examples/sidekiq/sidekiq.rb
164
+ - examples/sidekiq/sidekiq.yml
142
165
  - gemfiles/sidekiq_3.3.1.gemfile
143
166
  - gemfiles/sidekiq_3.3.1.gemfile.lock
144
167
  - gemfiles/sidekiq_3.x.gemfile
@@ -170,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
193
  version: '0'
171
194
  requirements: []
172
195
  rubyforge_project:
173
- rubygems_version: 2.5.2
196
+ rubygems_version: 2.5.2.2
174
197
  signing_key:
175
198
  specification_version: 4
176
199
  summary: Prometheus exporter for the Sidekiq