sidekiq-prometheus-exporter 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -3
  3. data/Appraisals +1 -2
  4. data/Gemfile +13 -0
  5. data/README.md +5 -1
  6. data/Rakefile +6 -3
  7. data/lib/sidekiq/prometheus/exporter/version.rb +1 -1
  8. data/lib/sidekiq/prometheus/exporter.rb +5 -4
  9. data/sidekiq-prometheus-exporter.gemspec +1 -14
  10. metadata +3 -210
  11. data/.github/FUNDING.yml +0 -12
  12. data/.github/workflows/ci.yaml +0 -70
  13. data/docker/Dockerfile +0 -24
  14. data/docker/README.md +0 -61
  15. data/docker/config.ru +0 -41
  16. data/examples/docker-compose.yml +0 -49
  17. data/examples/metrics/Dockerfile +0 -7
  18. data/examples/metrics/config.ru +0 -10
  19. data/examples/prometheus/prometheus.yml +0 -8
  20. data/examples/screenshot.png +0 -0
  21. data/examples/sidekiq/Dockerfile +0 -5
  22. data/examples/sidekiq/sidekiq.rb +0 -41
  23. data/examples/sidekiq/sidekiq.yml +0 -5
  24. data/examples/sidekiq-dashboard.grafana-6.json +0 -837
  25. data/examples/sidekiq-dashboard.grafana-7.json +0 -845
  26. data/gemfiles/sidekiq_4.1.0.Gemfile +0 -9
  27. data/gemfiles/sidekiq_4.1.0.Gemfile.lock +0 -117
  28. data/gemfiles/sidekiq_4.x.Gemfile +0 -8
  29. data/gemfiles/sidekiq_4.x.Gemfile.lock +0 -105
  30. data/gemfiles/sidekiq_5.x.Gemfile +0 -8
  31. data/gemfiles/sidekiq_5.x.Gemfile.lock +0 -104
  32. data/gemfiles/sidekiq_6.x.Gemfile +0 -8
  33. data/gemfiles/sidekiq_6.x.Gemfile.lock +0 -101
  34. data/gemfiles/sidekiq_7.x.Gemfile +0 -8
  35. data/gemfiles/sidekiq_7.x.Gemfile.lock +0 -109
  36. data/gemfiles/sidekiq_latest.Gemfile +0 -9
  37. data/gemfiles/sidekiq_latest.Gemfile.lock +0 -121
  38. data/helm/sidekiq-prometheus-exporter/.helmignore +0 -22
  39. data/helm/sidekiq-prometheus-exporter/Chart.yaml +0 -6
  40. data/helm/sidekiq-prometheus-exporter/README.md +0 -89
  41. data/helm/sidekiq-prometheus-exporter/templates/NOTES.txt +0 -15
  42. data/helm/sidekiq-prometheus-exporter/templates/_helpers.tpl +0 -109
  43. data/helm/sidekiq-prometheus-exporter/templates/clusterrole.yaml +0 -20
  44. data/helm/sidekiq-prometheus-exporter/templates/clusterrolebinding.yaml +0 -17
  45. data/helm/sidekiq-prometheus-exporter/templates/deployment.yaml +0 -65
  46. data/helm/sidekiq-prometheus-exporter/templates/service.yaml +0 -17
  47. data/helm/sidekiq-prometheus-exporter/templates/serviceaccount.yaml +0 -9
  48. data/helm/sidekiq-prometheus-exporter/templates/servicemonitor.yaml +0 -26
  49. data/helm/sidekiq-prometheus-exporter/values.yaml +0 -139
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 420aff1e44de33405644188fadfe166fe8b8b1f24994ad0035bc2f350e968718
4
- data.tar.gz: ec7e9d8fba8d9f56151a7c759ccc55202f8a5ef7a776cf5ce273aea834cea60e
3
+ metadata.gz: f39ddc3bdda39080a7b6a0b1051fb1dc90ad11be5a970b0c6f955ef50d99af66
4
+ data.tar.gz: b5abf1281d9d7afdc53a452f3a5eebb480cc6b7f9e631930f02bf9be52acf8c8
5
5
  SHA512:
6
- metadata.gz: 6fba09943f7bbb9c886ee10ad36ea9647e26411bbf378676ae99cdfc26b3adb9e41c9bf346dd496c3b087f119851267fa2a25d997b79117fcd9b88b9524ec8f4
7
- data.tar.gz: 8a2dbb2c61076fc58913f6c83eb27be187279d113fc1c1112eb0fbb051dbf1a56b5ce521e267afccda87aa7a9bfbde86d32ab3cd877f4e9bcbdadf761556d7d7
6
+ metadata.gz: 9db770f2ff366515f412235c4cad0abdc0a7e6331420d82e9a6e24446afce711daaa65449350ec1e23eb1128a47131065472d91a6643e1f20628de6249f55009
7
+ data.tar.gz: 4605aa418c294b245afae7e7201ecf0e558e778acac024f16ce173675ca70db4ae1a7a2858e43bcc26b26c91c10f0361025edf9127bc4c6a4d43515c079c7be6
data/.rubocop.yml CHANGED
@@ -105,9 +105,6 @@ RSpec/DescribeMethod:
105
105
  RSpec/ExampleWithoutDescription:
106
106
  EnforcedStyle: single_line_only
107
107
 
108
- RSpec/FilePath:
109
- Enabled: false
110
-
111
108
  RSpec/ImplicitExpect:
112
109
  Enabled: false
113
110
 
data/Appraisals CHANGED
@@ -25,7 +25,6 @@ appraise 'sidekiq-7.x' do
25
25
  end
26
26
 
27
27
  appraise 'sidekiq-latest' do
28
- gem 'rack', '>= 2', github: 'rack/rack'
29
28
  gem 'redis', '>= 4', github: 'redis/redis-rb'
30
- gem 'sidekiq', '>= 6', github: 'mperham/sidekiq'
29
+ gem 'sidekiq', '>= 7', github: 'mperham/sidekiq'
31
30
  end
data/Gemfile CHANGED
@@ -4,3 +4,16 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in sidekiq-prometheus-exporter.gemspec
6
6
  gemspec
7
+
8
+ gem 'appraisal', '~> 2.2'
9
+ gem 'bundler', '~> 2.1'
10
+ gem 'pry', '~> 0.14'
11
+ gem 'pry-byebug', '~> 3.6'
12
+ gem 'rack-test', '~> 1.1'
13
+ gem 'rake', '~> 13.0'
14
+ gem 'rspec', '~> 3.0'
15
+ gem 'rubocop', '~> 1.22'
16
+ gem 'rubocop-performance', '~> 1.12'
17
+ gem 'rubocop-rake', '~> 0.6'
18
+ gem 'rubocop-rspec', '~> 2.6'
19
+ gem 'timecop', '~> 0.9'
data/README.md CHANGED
@@ -100,8 +100,12 @@ run Sidekiq::Prometheus::Exporter.to_app
100
100
 
101
101
  Use your favorite server to start it up, like this
102
102
 
103
+ > [!IMPORTANT]
104
+ > `rackup` in non-production mode contains few unnecessary middlewares we want to
105
+ > disable, like `Rack::Lint`.
106
+
103
107
  ```console
104
- $ bundle exec rackup -p9292 -o0.0.0.0
108
+ $ bundle exec rackup -Eproduction -p9292 -o0.0.0.0
105
109
  ```
106
110
 
107
111
  and then `curl https://0.0.0.0:9292/metrics`
data/Rakefile CHANGED
@@ -44,7 +44,7 @@ namespace :docker do
44
44
  image = 'strech/sidekiq-prometheus-exporter'
45
45
 
46
46
  Dir.chdir(File.expand_path('./docker')) do
47
- execute("docker build -t #{image}:#{args.version} -t #{image}:latest .")
47
+ execute("docker buildx build --platform linux/amd64,linux/arm64 -t #{image}:#{args.version} -t #{image}:latest .")
48
48
  end
49
49
 
50
50
  puts "Successfully built strech/sidekiq-prometheus-exporter and tagged #{args.version} (latest)"
@@ -54,8 +54,11 @@ namespace :docker do
54
54
  args.with_defaults(version: docker_version)
55
55
  image = 'strech/sidekiq-prometheus-exporter'
56
56
 
57
- execute("docker push #{image}:#{args.version}")
58
- execute("docker push #{image}:latest")
57
+ # rubocop:disable Layout/LineLength
58
+ Dir.chdir(File.expand_path('./docker')) do
59
+ execute("docker buildx build --push --platform linux/amd64,linux/arm64 -t #{image}:#{args.version} -t #{image}:latest .")
60
+ end
61
+ # rubocop:enable Layout/LineLength
59
62
 
60
63
  puts "Successfully pushed strech/sidekiq-prometheus-exporter:#{args.version} (latest)"
61
64
  end
@@ -5,7 +5,7 @@ module Sidekiq
5
5
  module Exporter
6
6
  # NOTE: Every version update dropds Docker patch version to 0
7
7
  # and every adjustment in Docker setup bumps it to +1
8
- VERSION = '0.2.0'.freeze
8
+ VERSION = '0.2.1'.freeze
9
9
  DOCKER_PATCH_VERSION = '0'.freeze
10
10
  end
11
11
  end
@@ -11,9 +11,10 @@ module Sidekiq
11
11
  REQUEST_METHOD = 'REQUEST_METHOD'.freeze
12
12
  NOT_FOUND_TEXT = 'Not Found'.freeze
13
13
  MOUNT_PATH = '/metrics'.freeze
14
- # rubocop:disable Style/MutableConstant
15
- HEADERS = {Rack::CONTENT_TYPE => 'text/plain; version=0.0.4', Rack::CACHE_CONTROL => 'no-cache'}
16
- # rubocop:enable Style/MutableConstant
14
+ HEADERS = {
15
+ Rack::CONTENT_TYPE => 'text/plain; version=0.0.4',
16
+ Rack::CACHE_CONTROL => 'no-cache'
17
+ }.freeze
17
18
  EXPORTERS = Exporters.new
18
19
 
19
20
  class << self
@@ -47,7 +48,7 @@ module Sidekiq
47
48
  def call(env)
48
49
  return [404, HEADERS, [NOT_FOUND_TEXT]] if env[REQUEST_METHOD] != REQUEST_VERB
49
50
 
50
- [200, HEADERS, [EXPORTERS.to_s]]
51
+ [200, HEADERS.dup, [EXPORTERS.to_s]]
51
52
  end
52
53
  end
53
54
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  end
24
24
 
25
25
  spec.files = `git ls-files -z`.split("\x0").reject do |file|
26
- file.match(%r{^(test|spec|features)/})
26
+ file.match(%r{^(.github|docker|examples|gemfiles|helm|test|spec|features)/})
27
27
  end
28
28
  spec.bindir = 'exe'
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |file| File.basename(file) }
@@ -32,17 +32,4 @@ Gem::Specification.new do |spec|
32
32
  spec.required_ruby_version = '>= 2.3'
33
33
  spec.add_dependency 'rack', '>= 1.6.0'
34
34
  spec.add_dependency 'sidekiq', '>= 4.1.0'
35
-
36
- spec.add_development_dependency 'appraisal', '~> 2.2'
37
- spec.add_development_dependency 'bundler', '~> 2.1'
38
- spec.add_development_dependency 'pry', '~> 0.14'
39
- spec.add_development_dependency 'pry-byebug', '~> 3.6'
40
- spec.add_development_dependency 'rack-test', '~> 1.1'
41
- spec.add_development_dependency 'rake', '~> 13.0'
42
- spec.add_development_dependency 'rspec', '~> 3.0'
43
- spec.add_development_dependency 'rubocop', '~> 1.22'
44
- spec.add_development_dependency 'rubocop-performance', '~> 1.12'
45
- spec.add_development_dependency 'rubocop-rake', '~> 0.6'
46
- spec.add_development_dependency 'rubocop-rspec', '~> 2.6'
47
- spec.add_development_dependency 'timecop', '~> 0.9'
48
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-prometheus-exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Fedorov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-21 00:00:00.000000000 Z
11
+ date: 2024-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -38,174 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 4.1.0
41
- - !ruby/object:Gem::Dependency
42
- name: appraisal
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.2'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.2'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.1'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.1'
69
- - !ruby/object:Gem::Dependency
70
- name: pry
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.14'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.14'
83
- - !ruby/object:Gem::Dependency
84
- name: pry-byebug
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.6'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.6'
97
- - !ruby/object:Gem::Dependency
98
- name: rack-test
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.1'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.1'
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '13.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '13.0'
125
- - !ruby/object:Gem::Dependency
126
- name: rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.0'
139
- - !ruby/object:Gem::Dependency
140
- name: rubocop
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '1.22'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '1.22'
153
- - !ruby/object:Gem::Dependency
154
- name: rubocop-performance
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '1.12'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '1.12'
167
- - !ruby/object:Gem::Dependency
168
- name: rubocop-rake
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '0.6'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '0.6'
181
- - !ruby/object:Gem::Dependency
182
- name: rubocop-rspec
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: '2.6'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: '2.6'
195
- - !ruby/object:Gem::Dependency
196
- name: timecop
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '0.9'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '0.9'
209
41
  description: All the basic metrics prepared for Prometheus
210
42
  email:
211
43
  - oni.strech@gmail.com
@@ -213,8 +45,6 @@ executables: []
213
45
  extensions: []
214
46
  extra_rdoc_files: []
215
47
  files:
216
- - ".github/FUNDING.yml"
217
- - ".github/workflows/ci.yaml"
218
48
  - ".gitignore"
219
49
  - ".rspec"
220
50
  - ".rubocop.yml"
@@ -225,43 +55,6 @@ files:
225
55
  - Rakefile
226
56
  - bin/console
227
57
  - bin/setup
228
- - docker/Dockerfile
229
- - docker/README.md
230
- - docker/config.ru
231
- - examples/docker-compose.yml
232
- - examples/metrics/Dockerfile
233
- - examples/metrics/config.ru
234
- - examples/prometheus/prometheus.yml
235
- - examples/screenshot.png
236
- - examples/sidekiq-dashboard.grafana-6.json
237
- - examples/sidekiq-dashboard.grafana-7.json
238
- - examples/sidekiq/Dockerfile
239
- - examples/sidekiq/sidekiq.rb
240
- - examples/sidekiq/sidekiq.yml
241
- - gemfiles/sidekiq_4.1.0.Gemfile
242
- - gemfiles/sidekiq_4.1.0.Gemfile.lock
243
- - gemfiles/sidekiq_4.x.Gemfile
244
- - gemfiles/sidekiq_4.x.Gemfile.lock
245
- - gemfiles/sidekiq_5.x.Gemfile
246
- - gemfiles/sidekiq_5.x.Gemfile.lock
247
- - gemfiles/sidekiq_6.x.Gemfile
248
- - gemfiles/sidekiq_6.x.Gemfile.lock
249
- - gemfiles/sidekiq_7.x.Gemfile
250
- - gemfiles/sidekiq_7.x.Gemfile.lock
251
- - gemfiles/sidekiq_latest.Gemfile
252
- - gemfiles/sidekiq_latest.Gemfile.lock
253
- - helm/sidekiq-prometheus-exporter/.helmignore
254
- - helm/sidekiq-prometheus-exporter/Chart.yaml
255
- - helm/sidekiq-prometheus-exporter/README.md
256
- - helm/sidekiq-prometheus-exporter/templates/NOTES.txt
257
- - helm/sidekiq-prometheus-exporter/templates/_helpers.tpl
258
- - helm/sidekiq-prometheus-exporter/templates/clusterrole.yaml
259
- - helm/sidekiq-prometheus-exporter/templates/clusterrolebinding.yaml
260
- - helm/sidekiq-prometheus-exporter/templates/deployment.yaml
261
- - helm/sidekiq-prometheus-exporter/templates/service.yaml
262
- - helm/sidekiq-prometheus-exporter/templates/serviceaccount.yaml
263
- - helm/sidekiq-prometheus-exporter/templates/servicemonitor.yaml
264
- - helm/sidekiq-prometheus-exporter/values.yaml
265
58
  - lib/sidekiq/prometheus/exporter.rb
266
59
  - lib/sidekiq/prometheus/exporter/cron.rb
267
60
  - lib/sidekiq/prometheus/exporter/exporters.rb
@@ -292,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
85
  - !ruby/object:Gem::Version
293
86
  version: '0'
294
87
  requirements: []
295
- rubygems_version: 3.1.6
88
+ rubygems_version: 3.3.26
296
89
  signing_key:
297
90
  specification_version: 4
298
91
  summary: Prometheus exporter for the Sidekiq
data/.github/FUNDING.yml DELETED
@@ -1,12 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [Strech]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: strech
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- custom: ['https://paypal.me/onistrech/eur5.0']
@@ -1,70 +0,0 @@
1
- ---
2
- name: CI
3
- on:
4
- push:
5
- branches: ["master"]
6
- pull_request:
7
- branches: ["master"]
8
- schedule:
9
- # Run the workflow once per month
10
- - cron: "0 0 1 * *"
11
- jobs:
12
- rubocop:
13
- name: Rubocop
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/checkout@v2
17
- - uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: 2.7.8
20
- - name: rubocop
21
- uses: reviewdog/action-rubocop@v2
22
- with:
23
- rubocop_version: gemfile
24
- rubocop_extensions: rubocop-rake:gemfile rubocop-rspec:gemfile rubocop-performance:gemfile
25
- reporter: github-pr-review
26
- fail_on_error: true
27
-
28
- test:
29
- needs: rubocop
30
- runs-on: ubuntu-latest
31
- name: Ruby ${{ matrix.ruby }} / Sidekiq ${{ matrix.sidekiq }}
32
- strategy:
33
- matrix:
34
- # Always keep a window of "5 most recent" including (or on top with) HEAD
35
- ruby: ["2.7.8", "3.0.6", "3.1.4", "3.2.2", "latest"]
36
- sidekiq: ["4.1.0", "4.x", "5.x", "6.x", "7.x", "latest"]
37
- # Allow failures ... kind-a
38
- exclude:
39
- - ruby: "2.7.8"
40
- sidekiq: "latest"
41
- - ruby: "3.0.6"
42
- sidekiq: "latest"
43
- - ruby: "3.1.4"
44
- sidekiq: "latest"
45
- - ruby: "3.2.2"
46
- sidekiq: "latest"
47
-
48
- container:
49
- image: ruby:${{ matrix.ruby }}
50
-
51
- steps:
52
- - uses: actions/checkout@v2
53
-
54
- - uses: actions/cache@v2
55
- id: vendor-cache
56
- with:
57
- path: vendor
58
- key: bundle-${{ matrix.ruby }}-sidekiq-${{ matrix.sidekiq }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/.*Gemfile.lock') }}
59
-
60
- - name: Upgrade Bundler to 2.x (for older Ruby versions)
61
- run: gem install bundler -v '~> 2.1'
62
-
63
- - name: Bundle install
64
- run: |
65
- bundle config path vendor/bundle
66
- bundle config gemfile gemfiles/sidekiq_${{ matrix.sidekiq }}.Gemfile
67
- bundle install
68
-
69
- - name: Run RSpec
70
- run: bundle exec rake spec
data/docker/Dockerfile DELETED
@@ -1,24 +0,0 @@
1
- FROM ruby:2.7.7-alpine3.16
2
-
3
- LABEL maintainer="Sergey Fedorov <oni.strech@gmail.com>"
4
- LABEL repository="strech/sidekiq-prometheus-exporter"
5
-
6
- ENV RACK_VERSION 2.2.4
7
- ENV SIDEKIQ_VERSION 6.5.7
8
- ENV REDIS_NAMESPACE_VERSION 1.9
9
- ENV SIDEKIQ_PROMETHEUS_EXPORTER_VERSION 0.1.17
10
-
11
- RUN addgroup -S exporter \
12
- && adduser -s /bin/false -SDHg exporter exporter \
13
- && gem install "rack:$RACK_VERSION" \
14
- && gem install "sidekiq:$SIDEKIQ_VERSION" \
15
- && gem install "redis-namespace:$REDIS_NAMESPACE_VERSION" \
16
- && gem install "sidekiq-prometheus-exporter:$SIDEKIQ_PROMETHEUS_EXPORTER_VERSION"
17
-
18
- USER exporter
19
- WORKDIR /app
20
- COPY config.ru config.ru
21
-
22
- EXPOSE 9292
23
- ENTRYPOINT [ "rackup" ]
24
- CMD [ "-p", "9292", "-o", "0.0.0.0", "config.ru" ]
data/docker/README.md DELETED
@@ -1,61 +0,0 @@
1
- # Official Docker image
2
-
3
- [0]: https://github.com/Strech/sidekiq-prometheus-exporter
4
- [1]: https://www.iana.org/assignments/uri-schemes/prov/redis
5
- [2]: https://github.com/resque/redis-namespace
6
- [3]: https://github.com/redis/redis-rb/tree/v4.1.3#sentinel-support
7
- [4]: https://github.com/mperham/sidekiq/issues/4479
8
-
9
- This is an official Docker image for [sidekiq-prometheus-exporter][0]
10
- gem.
11
-
12
- It combines some approaches which were already published as images by other
13
- devs and at the same time brings more flexibility for the stock configuration
14
- and applies recommended Docker best practices.
15
-
16
- :warning: The Docker image currently supports **only** standards metrics.
17
-
18
- ## Supported ENVs
19
-
20
- Required
21
-
22
- - `REDIS_URL` - [RFC 3986 generic URI][1], exclusive with `REDIS_HOST`
23
- - `REDIS_HOST` - a Redis host, exclusive with `REDIS_URL` (default: `localhost`)
24
-
25
- Optional
26
-
27
- - `REDIS_SSL` - a flag to enable Redis SSL URL scheme (default: `false`)
28
- - `REDIS_PORT` - a Redis port (default: `6379`)
29
- - `REDIS_PASSWORD` - a Redis password (if you need one)
30
- - `REDIS_DB_NUMBER` - a Redis database number (default: `0`)
31
- - `REDIS_NAMESPACE` - a Redis [namespace][2] name (if you have separated sidekiq)
32
- - `REDIS_SENTINELS` - a list of comma separated Redis urls (like `REDIS_URL`, but for sentinels)
33
- - `REDIS_SENTINEL_ROLE` - a role within the [sentinel][3] to connect (default: `master`)
34
- - `REDIS_DISABLE_CLIENT_ID` - a flag to disable `CLIENT` command in [Sidekiq][4]
35
-
36
- :bulb: Note, that `REDIS_URL` and `REDIS_HOST` are exclusive. Since `REDIS_HOST` is more
37
- atomic value it will be checked after `REDIS_URL`.
38
-
39
- :bulb: `REDIS_SENTINELS` will be parsed with `URI`, because of that it's
40
- mandatory for them to be formatted with protocol `redis://...`.
41
-
42
- :bulb: `REDIS_DISABLE_CLIENT_ID` might be required if a SaaS Redis provider is being used.
43
-
44
- ## Examples
45
-
46
- If you don't have a running Redis instance, you can quickly spin an empty to
47
- practice.
48
-
49
- ```bash
50
- $ docker run -d --rm --name redis-instance redis
51
- ```
52
-
53
- and then run an exporter
54
-
55
- ```bash
56
- $ docker run -it --rm \
57
- --link redis-instance \
58
- -p 9292:9292 \
59
- -e REDIS_URL=redis://redis-instance \
60
- strech/sidekiq-prometheus-exporter
61
- ```
data/docker/config.ru DELETED
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'sidekiq'
4
- require 'sidekiq/prometheus/exporter'
5
-
6
- config = {}
7
- config[:url] = ENV['REDIS_URL'] if ENV.key?('REDIS_URL')
8
-
9
- unless config.key?(:url)
10
- scheme = (ENV.fetch('REDIS_SSL', 'false') == 'true') ? 'rediss' : 'redis'
11
- host = ENV.fetch('REDIS_HOST', 'localhost')
12
- port = ENV.fetch('REDIS_PORT', 6379)
13
- db_number = ENV.fetch('REDIS_DB_NUMBER', 0)
14
- password = ":#{ENV['REDIS_PASSWORD']}" if ENV.key?('REDIS_PASSWORD')
15
-
16
- config[:url] = "#{scheme}://#{password}@#{host}:#{port}/#{db_number}"
17
- end
18
-
19
- if ENV.key?('REDIS_NAMESPACE')
20
- require 'redis-namespace'
21
-
22
- config[:namespace] = ENV['REDIS_NAMESPACE']
23
- end
24
-
25
- if ENV.key?('REDIS_SENTINELS')
26
- require 'uri'
27
-
28
- config[:role] = ENV.fetch('REDIS_SENTINEL_ROLE', :master).to_sym
29
- config[:sentinels] = ENV['REDIS_SENTINELS'].split(',').map do |url|
30
- uri = URI.parse(url.strip)
31
- cfg = {host: uri.host || 'localhost', port: uri.port || 26379} # rubocop:disable Style/NumericLiterals
32
- cfg[:password] = ":#{uri.password}" if uri.password
33
- cfg
34
- end
35
- end
36
-
37
- config[:id] = nil if ENV.key?('REDIS_DISABLE_CLIENT_ID')
38
-
39
- Sidekiq.configure_client { |client| client.redis = config }
40
-
41
- run Sidekiq::Prometheus::Exporter.to_app
@@ -1,49 +0,0 @@
1
- ---
2
- version: "3.4"
3
-
4
- services:
5
- metrics:
6
- build: ./metrics
7
- volumes:
8
- - ./metrics/config.ru:/config.ru
9
- ports:
10
- - 9292:9292
11
- depends_on:
12
- - sidekiq
13
- - redis
14
-
15
- sidekiq:
16
- build: ./sidekiq
17
- volumes:
18
- - ./sidekiq/sidekiq.rb:/sidekiq.rb
19
- - ./sidekiq/sidekiq.yml:/sidekiq.yml
20
- depends_on:
21
- - redis
22
-
23
- prometheus:
24
- image: prom/prometheus
25
- volumes:
26
- - prometheus-data:/prometheus
27
- - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
28
- ports:
29
- - 9090:9090
30
- depends_on:
31
- - metrics
32
-
33
- grafana:
34
- image: grafana/grafana:7.1.1
35
- volumes:
36
- - grafana-data:/var/lib/grafana
37
- ports:
38
- - 3000:3000
39
- depends_on:
40
- - prometheus
41
-
42
- redis:
43
- image: redis:4.0.8-alpine
44
-
45
- volumes:
46
- grafana-data:
47
- driver: local
48
- prometheus-data:
49
- driver: local
@@ -1,7 +0,0 @@
1
- FROM ruby:2.3.6-alpine
2
-
3
- RUN gem install sidekiq -v "~> 5.0"
4
- RUN gem install sidekiq-prometheus-exporter -v "~> 0.1"
5
-
6
- ENTRYPOINT [ "rackup" ]
7
- CMD [ "-p", "9292", "-o", "0.0.0.0", "/config.ru" ]