sidekiq-prometheus-exporter 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.rubocop.yml +28 -28
- data/.travis.yml +23 -10
- data/README.md +93 -49
- data/Rakefile +73 -0
- data/docker/Dockerfile +24 -0
- data/docker/README.md +55 -0
- data/docker/config.ru +38 -0
- data/examples/docker-compose.yml +1 -1
- data/examples/{sidekiq.json → sidekiq-dashboard.grafana-6.json} +10 -52
- data/examples/sidekiq-dashboard.grafana-7.json +845 -0
- data/gemfiles/sidekiq_3.3.1.gemfile.lock +8 -6
- data/gemfiles/sidekiq_3.x.gemfile.lock +8 -6
- data/gemfiles/sidekiq_4.x.gemfile.lock +8 -6
- data/gemfiles/sidekiq_5.x.gemfile.lock +9 -7
- data/gemfiles/sidekiq_6.x.gemfile.lock +9 -7
- data/gemfiles/sidekiq_head.gemfile.lock +5 -5
- data/helm/sidekiq-prometheus-exporter/.helmignore +22 -0
- data/helm/sidekiq-prometheus-exporter/Chart.yaml +6 -0
- data/helm/sidekiq-prometheus-exporter/README.md +87 -0
- data/helm/sidekiq-prometheus-exporter/templates/NOTES.txt +15 -0
- data/helm/sidekiq-prometheus-exporter/templates/_helpers.tpl +109 -0
- data/helm/sidekiq-prometheus-exporter/templates/clusterrole.yaml +20 -0
- data/helm/sidekiq-prometheus-exporter/templates/clusterrolebinding.yaml +17 -0
- data/helm/sidekiq-prometheus-exporter/templates/deployment.yaml +62 -0
- data/helm/sidekiq-prometheus-exporter/templates/service.yaml +17 -0
- data/helm/sidekiq-prometheus-exporter/templates/serviceaccount.yaml +9 -0
- data/helm/sidekiq-prometheus-exporter/templates/servicemonitor.yaml +26 -0
- data/helm/sidekiq-prometheus-exporter/values.yaml +133 -0
- data/lib/sidekiq/prometheus/exporter/version.rb +1 -1
- data/sidekiq-prometheus-exporter.gemspec +1 -1
- metadata +25 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b765e7d2573199042fcb0bc816c07797ddc7cd629a8491df3eee217f09282883
|
4
|
+
data.tar.gz: 7db77dd139a068968b55a79c1cdf57f9bbb7684f739ad95044cfd6fd4cf22389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c83d7afd3fcf1a0dfe16bc9bc35f05ad84bad8a46656d4af313c309427682f6e4347f912c3f0daeb7594d12fc9914f9e2e4f5452a4925643eebe81224e2e736
|
7
|
+
data.tar.gz: 3be26fb67085e9dbebcd9eb9a377feb24acfbb075e1a67eebdf550ffa8e5c54716398e254fbf6cee9b4c92cf2b814bd1951dc13f9c13ded4c27c054020cc3828
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,12 @@
|
|
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']
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require: rubocop-rspec
|
3
3
|
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion:
|
5
|
+
TargetRubyVersion: ~
|
6
6
|
|
7
7
|
Style/Alias:
|
8
8
|
EnforcedStyle: prefer_alias_method
|
@@ -30,7 +30,7 @@ Style/Documentation:
|
|
30
30
|
Enabled: false
|
31
31
|
|
32
32
|
Style/FrozenStringLiteralComment:
|
33
|
-
EnforcedStyle:
|
33
|
+
EnforcedStyle: always
|
34
34
|
SupportedStyles:
|
35
35
|
# `when_needed` will add the frozen string literal comment to files
|
36
36
|
# only when the `TargetRubyVersion` is set to 2.3+.
|
@@ -89,25 +89,25 @@ Style/NumericPredicate:
|
|
89
89
|
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
90
90
|
# false positives.
|
91
91
|
Exclude:
|
92
|
-
-
|
92
|
+
- "spec/**/*"
|
93
93
|
|
94
94
|
Style/MethodCalledOnDoEndBlock:
|
95
|
-
Description:
|
96
|
-
StyleGuide:
|
95
|
+
Description: "Avoid chaining a method call on a do...end block."
|
96
|
+
StyleGuide: "#single-line-blocks"
|
97
97
|
Enabled: true
|
98
98
|
|
99
99
|
Style/PercentLiteralDelimiters:
|
100
100
|
PreferredDelimiters:
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
101
|
+
"%": ()
|
102
|
+
"%i": ()
|
103
|
+
"%I": ()
|
104
|
+
"%q": ()
|
105
|
+
"%Q": ()
|
106
|
+
"%r": "{}"
|
107
|
+
"%s": ()
|
108
|
+
"%w": ()
|
109
|
+
"%W": ()
|
110
|
+
"%x": "{}"
|
111
111
|
|
112
112
|
Style/SpecialGlobalVars:
|
113
113
|
EnforcedStyle: use_english_names
|
@@ -158,10 +158,10 @@ Style/TernaryParentheses:
|
|
158
158
|
|
159
159
|
Naming/AccessorMethodName:
|
160
160
|
Description: Check the naming of accessor methods for get_/set_.
|
161
|
-
StyleGuide:
|
161
|
+
StyleGuide: "#accessor_mutator_method_names"
|
162
162
|
|
163
163
|
# https://rubocop.readthedocs.io/en/latest/cops_naming/#naminguncommunicativemethodparamname
|
164
|
-
Naming/
|
164
|
+
Naming/MethodParameterName:
|
165
165
|
AllowedNames:
|
166
166
|
- _
|
167
167
|
- io
|
@@ -174,7 +174,11 @@ Naming/UncommunicativeMethodParamName:
|
|
174
174
|
|
175
175
|
#################### Layout ####################################
|
176
176
|
|
177
|
-
Layout/
|
177
|
+
Layout/LineLength:
|
178
|
+
# Default: 80
|
179
|
+
Max: 120
|
180
|
+
|
181
|
+
Layout/ParameterAlignment:
|
178
182
|
# Alignment of parameters in multi-line method calls.
|
179
183
|
#
|
180
184
|
# The `with_first_parameter` style aligns the following lines along the same
|
@@ -194,7 +198,7 @@ Layout/AlignParameters:
|
|
194
198
|
- with_fixed_indentation
|
195
199
|
|
196
200
|
# Checks the indentation of the first element in an array literal.
|
197
|
-
Layout/
|
201
|
+
Layout/FirstArrayElementIndentation:
|
198
202
|
# The value `special_inside_parentheses` means that array literals with
|
199
203
|
# brackets that have their opening bracket on the same line as a surrounding
|
200
204
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -216,7 +220,7 @@ Layout/IndentArray:
|
|
216
220
|
IndentationWidth: ~
|
217
221
|
|
218
222
|
# Checks the indentation of the first key in a hash literal.
|
219
|
-
Layout/
|
223
|
+
Layout/FirstHashElementIndentation:
|
220
224
|
# The value `special_inside_parentheses` means that hash literals with braces
|
221
225
|
# that have their opening brace on the same line as a surrounding opening
|
222
226
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -277,20 +281,16 @@ Layout/MultilineOperationIndentation:
|
|
277
281
|
|
278
282
|
##################### Metrics ##################################
|
279
283
|
|
280
|
-
Metrics/LineLength:
|
281
|
-
# Default: 80
|
282
|
-
Max: 120
|
283
|
-
|
284
284
|
Metrics/MethodLength:
|
285
285
|
# Default: 10
|
286
286
|
Max: 15
|
287
287
|
|
288
288
|
Metrics/BlockLength:
|
289
289
|
Exclude:
|
290
|
-
-
|
291
|
-
-
|
292
|
-
-
|
293
|
-
-
|
290
|
+
- "Rakefile"
|
291
|
+
- "**/*.gemspec"
|
292
|
+
- "**/*.rake"
|
293
|
+
- "spec/**/*.rb"
|
294
294
|
|
295
295
|
##################### Lint ##################################
|
296
296
|
|
data/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
os: linux
|
2
|
+
dist: xenial
|
2
3
|
language: ruby
|
3
4
|
rvm:
|
4
5
|
- 2.3.8
|
5
|
-
- 2.4.
|
6
|
-
- 2.5.
|
7
|
-
- 2.6.
|
8
|
-
- 2.7.
|
6
|
+
- 2.4.10
|
7
|
+
- 2.5.8
|
8
|
+
- 2.6.6
|
9
|
+
- 2.7.1
|
9
10
|
- ruby-head
|
10
11
|
notifications:
|
11
12
|
email: false
|
@@ -20,26 +21,36 @@ gemfile:
|
|
20
21
|
|
21
22
|
jobs:
|
22
23
|
include:
|
23
|
-
- rvm: "2.6.
|
24
|
+
- rvm: "2.6.6"
|
24
25
|
gemfile: "gemfiles/sidekiq_5.x.gemfile"
|
25
26
|
env:
|
26
27
|
- CODECLIMATE_REPORT=true
|
27
28
|
exclude:
|
28
29
|
- rvm: "2.3.8"
|
29
30
|
gemfile: "gemfiles/sidekiq_6.x.gemfile"
|
30
|
-
- rvm: "2.4.
|
31
|
+
- rvm: "2.4.10"
|
31
32
|
gemfile: "gemfiles/sidekiq_6.x.gemfile"
|
32
33
|
- rvm: "2.3.8"
|
33
34
|
gemfile: "gemfiles/sidekiq_head.gemfile"
|
34
|
-
- rvm: "2.4.
|
35
|
+
- rvm: "2.4.10"
|
35
36
|
gemfile: "gemfiles/sidekiq_head.gemfile"
|
36
|
-
- rvm: "2.5.
|
37
|
+
- rvm: "2.5.8"
|
37
38
|
gemfile: "gemfiles/sidekiq_head.gemfile"
|
38
|
-
- rvm: "2.6.
|
39
|
+
- rvm: "2.6.6"
|
39
40
|
gemfile: "gemfiles/sidekiq_head.gemfile"
|
40
|
-
- rvm: "2.7.
|
41
|
+
- rvm: "2.7.1"
|
41
42
|
gemfile: "gemfiles/sidekiq_head.gemfile"
|
42
43
|
allow_failures:
|
44
|
+
- rvm: "ruby-head"
|
45
|
+
gemfile: "gemfiles/sidekiq_3.3.1.gemfile"
|
46
|
+
- rvm: "ruby-head"
|
47
|
+
gemfile: "gemfiles/sidekiq_3.x.gemfile"
|
48
|
+
- rvm: "ruby-head"
|
49
|
+
gemfile: "gemfiles/sidekiq_4.x.gemfile"
|
50
|
+
- rvm: "ruby-head"
|
51
|
+
gemfile: "gemfiles/sidekiq_5.x.gemfile"
|
52
|
+
- rvm: "ruby-head"
|
53
|
+
gemfile: "gemfiles/sidekiq_6.x.gemfile"
|
43
54
|
- rvm: "ruby-head"
|
44
55
|
gemfile: "gemfiles/sidekiq_head.gemfile"
|
45
56
|
|
@@ -63,8 +74,10 @@ before_script:
|
|
63
74
|
echo "Start recording Codeclimate test coverage";
|
64
75
|
./vendor/cc-test-reporter before-build;
|
65
76
|
fi
|
77
|
+
|
66
78
|
script:
|
67
79
|
- bundle exec rake spec
|
80
|
+
|
68
81
|
after_success:
|
69
82
|
- if [ ! -z "$CODECLIMATE_REPORT" ]; then
|
70
83
|
echo "Finish recording Codeclimate test coverage";
|
data/README.md
CHANGED
@@ -10,42 +10,54 @@
|
|
10
10
|
|
11
11
|
![Grafana dashboard example](/examples/screenshot.png)
|
12
12
|
|
13
|
-
Open [dashboard example file](/examples/sidekiq.json), then open `https://<your grafana-url>/dashboard/import` and paste the content of the file.
|
13
|
+
Open [dashboard example file](/examples/sidekiq-dashboard.grafana-7.json) (grafana 7), then open `https://<your grafana-url>/dashboard/import` and paste the content of the file.
|
14
14
|
|
15
15
|
# Available metrics
|
16
16
|
|
17
|
-
|
17
|
+
_(starting Sidekiq `v3.3.1`)_
|
18
18
|
|
19
|
-
|
19
|
+
## Standard
|
20
20
|
|
21
|
-
| Name | Type | Description
|
22
|
-
|
23
|
-
| sidekiq_processed_jobs_total | counter | The total number of processed jobs
|
24
|
-
| sidekiq_failed_jobs_total | counter | The total number of failed jobs
|
25
|
-
| sidekiq_workers | gauge | The number of workers across all the processes
|
26
|
-
| sidekiq_processes | gauge | The number of processes
|
27
|
-
| sidekiq_busy_workers | gauge | The number of workers performing the job
|
28
|
-
| sidekiq_enqueued_jobs | gauge | The number of enqueued jobs
|
29
|
-
| sidekiq_scheduled_jobs | gauge | The number of jobs scheduled for a future execution
|
30
|
-
| sidekiq_retry_jobs | gauge | The number of jobs scheduled for the next try
|
31
|
-
| sidekiq_dead_jobs | gauge | The number of jobs being dead
|
32
|
-
| sidekiq_queue_latency_seconds | gauge | The number of seconds between oldest job being pushed to the queue and current time (labels: `name`)
|
33
|
-
| sidekiq_queue_max_processing_time_seconds | gauge | The number of seconds between oldest job of the queue being executed and current time (labels: `name`)
|
34
|
-
| sidekiq_queue_enqueued_jobs | gauge | The number of enqueued jobs in the queue (labels: `name`)
|
21
|
+
| Name | Type | Description |
|
22
|
+
| ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------ |
|
23
|
+
| sidekiq_processed_jobs_total | counter | The total number of processed jobs |
|
24
|
+
| sidekiq_failed_jobs_total | counter | The total number of failed jobs |
|
25
|
+
| sidekiq_workers | gauge | The number of workers across all the processes |
|
26
|
+
| sidekiq_processes | gauge | The number of processes |
|
27
|
+
| sidekiq_busy_workers | gauge | The number of workers performing the job |
|
28
|
+
| sidekiq_enqueued_jobs | gauge | The number of enqueued jobs |
|
29
|
+
| sidekiq_scheduled_jobs | gauge | The number of jobs scheduled for a future execution |
|
30
|
+
| sidekiq_retry_jobs | gauge | The number of jobs scheduled for the next try |
|
31
|
+
| sidekiq_dead_jobs | gauge | The number of jobs being dead |
|
32
|
+
| sidekiq_queue_latency_seconds | gauge | The number of seconds between oldest job being pushed to the queue and current time (labels: `name`) |
|
33
|
+
| sidekiq_queue_max_processing_time_seconds | gauge | The number of seconds between oldest job of the queue being executed and current time (labels: `name`) |
|
34
|
+
| sidekiq_queue_enqueued_jobs | gauge | The number of enqueued jobs in the queue (labels: `name`) |
|
35
35
|
|
36
|
-
|
36
|
+
<details>
|
37
|
+
<summary>Click to expand for all available contribs</summary>
|
37
38
|
|
38
|
-
|
39
|
-
|-----------------------------------------------|-------|-----------------------|
|
40
|
-
| sidekiq_scheduler_jobs | gauge | The number of recurring jobs
|
41
|
-
| sidekiq_scheduler_enabled_jobs | gauge | The number of enabled recurring jobs
|
42
|
-
| sidekiq_scheduler_time_since_last_run_minutes | gauge | The number of minutes since the last recurring job was executed and current time (labels: `name`)
|
39
|
+
## [Scheduler](https://github.com/moove-it/sidekiq-scheduler)
|
43
40
|
|
44
|
-
|
41
|
+
| Name | Type | Description |
|
42
|
+
| --------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------- |
|
43
|
+
| sidekiq_scheduler_jobs | gauge | The number of recurring jobs |
|
44
|
+
| sidekiq_scheduler_enabled_jobs | gauge | The number of enabled recurring jobs |
|
45
|
+
| sidekiq_scheduler_time_since_last_run_minutes | gauge | The number of minutes since the last recurring job was executed and current time (labels: `name`) |
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
|
47
|
+
## [Cron](https://github.com/ondrejbartas/sidekiq-cron)
|
48
|
+
|
49
|
+
| Name | Type | Description |
|
50
|
+
| ----------------- | ----- | ----------------------- |
|
51
|
+
| sidekiq_cron_jobs | gauge | The number of cron jobs |
|
52
|
+
|
53
|
+
</details>
|
54
|
+
|
55
|
+
## Sponsorship
|
56
|
+
|
57
|
+
If you like the project and want to support me on my sleepless nights, you can
|
58
|
+
|
59
|
+
[![Support via PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.com/paypalme/onistrech/eur5.0)
|
60
|
+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W7W8367XJ)
|
49
61
|
|
50
62
|
# Installation
|
51
63
|
|
@@ -57,17 +69,17 @@ gem 'sidekiq-prometheus-exporter', '~> 0.1'
|
|
57
69
|
|
58
70
|
And then execute:
|
59
71
|
|
60
|
-
```
|
72
|
+
```console
|
61
73
|
$ bundle
|
62
74
|
```
|
63
75
|
|
64
76
|
Or install it yourself as:
|
65
77
|
|
66
|
-
```
|
78
|
+
```console
|
67
79
|
$ gem install sidekiq-prometheus-exporter -v '~> 0.1'
|
68
80
|
```
|
69
81
|
|
70
|
-
|
82
|
+
## Rack application
|
71
83
|
|
72
84
|
For a fresh new application to expose metrics create `config.ru` file with
|
73
85
|
next code inside
|
@@ -85,13 +97,13 @@ run Sidekiq::Prometheus::Exporter.to_app
|
|
85
97
|
|
86
98
|
Use your favorite server to start it up, like this
|
87
99
|
|
88
|
-
```
|
100
|
+
```console
|
89
101
|
$ bundle exec rackup -p9292 -o0.0.0.0
|
90
102
|
```
|
91
103
|
|
92
104
|
and then `curl https://0.0.0.0:9292/metrics`
|
93
105
|
|
94
|
-
|
106
|
+
## Rails application
|
95
107
|
|
96
108
|
When you have rails application, it's possible to mount exporter
|
97
109
|
as a rack application in your `routes.rb`
|
@@ -109,13 +121,13 @@ end
|
|
109
121
|
|
110
122
|
Use rails server from `bin` folder to start it up, like this
|
111
123
|
|
112
|
-
```
|
124
|
+
```console
|
113
125
|
$ ./bin/rails s -p 9292 -b 0.0.0.0
|
114
126
|
```
|
115
127
|
|
116
128
|
and then `curl https://0.0.0.0:9292/metrics`
|
117
129
|
|
118
|
-
|
130
|
+
## Sidekiq Web (extream)
|
119
131
|
|
120
132
|
If you are ok with metrics being exposed via Sidekiq web dashboard because
|
121
133
|
you have it inside your private network or only Prometheus scraper will have access
|
@@ -130,7 +142,52 @@ Sidekiq::Web.register(Sidekiq::Prometheus::Exporter)
|
|
130
142
|
|
131
143
|
and then `curl https://<your-sidekiq-web-uri>/metrics`
|
132
144
|
|
133
|
-
|
145
|
+
## Docker
|
146
|
+
|
147
|
+
If we are talking about isolation you can run already prepared official
|
148
|
+
rack application in the Docker container by using the [public image](https://hub.docker.com/r/strech/sidekiq-prometheus-exporter)
|
149
|
+
(check out this [README](/blob/master/docker/README.md) for more)
|
150
|
+
|
151
|
+
```bash
|
152
|
+
$ docker run -it --rm \
|
153
|
+
-p 9292:9292 \
|
154
|
+
-e REDIS_URL=redis://<your-redis-host>:6379/0 \
|
155
|
+
strech/sidekiq-prometheus-exporter
|
156
|
+
```
|
157
|
+
|
158
|
+
and then `curl https://0.0.0.0:9292/metrics`
|
159
|
+
|
160
|
+
## Helm
|
161
|
+
|
162
|
+
And finally the cloud solution _(who don't these days)_. Easy to install, easy
|
163
|
+
to use. A fully-functioning Helm-package based on official [Docker
|
164
|
+
image](https://hub.docker.com/r/strech/sidekiq-prometheus-exporter), comes with lots of [configuration
|
165
|
+
options](https://github.com/Strech/sidekiq-prometheus-exporter/blob/master/helm/sidekiq-prometheus-exporter/README.md)
|
166
|
+
|
167
|
+
```console
|
168
|
+
$ helm repo add strech https://strech.github.io/sidekiq-prometheus-exporter
|
169
|
+
"strech" has been added to your repositories
|
170
|
+
|
171
|
+
$ helm install strech/sidekiq-prometheus-exporter --name sidekiq-metrics
|
172
|
+
```
|
173
|
+
|
174
|
+
to `curl` your metrics, please follow the post-installation guide
|
175
|
+
|
176
|
+
# Tips&Tricks
|
177
|
+
|
178
|
+
If you want to see at the exporter startup time a banner about which exporters
|
179
|
+
are enabled add this call to your `config.ru` (but after exporter `configure` statement)
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
require 'sidekiq/prometheus/exporter'
|
183
|
+
|
184
|
+
puts Sidekiq::Prometheus::Exporter.banner
|
185
|
+
```
|
186
|
+
|
187
|
+
:anger: if you don't see your banner try to output into `STDERR` instead of
|
188
|
+
`STDOUT`
|
189
|
+
|
190
|
+
## Sidekiq Contribs
|
134
191
|
|
135
192
|
By default we try to detect as many as possible [sidekiq contribs](https://github.com/mperham/sidekiq/wiki/Related-Projects)
|
136
193
|
and add their metrics to the output.
|
@@ -152,20 +209,7 @@ end
|
|
152
209
|
|
153
210
|
:bulb: if you did't find the contrib you would like to see, don't hesitate to [open an issue](https://github.com/Strech/sidekiq-prometheus-exporter/issues/new) and describe what do you think we should export.
|
154
211
|
|
155
|
-
#
|
156
|
-
|
157
|
-
If you want to see at the exporter startup time a banner about which exporters
|
158
|
-
are enabled add this call to your `config.ru` (but after exporter `configure` statement)
|
159
|
-
|
160
|
-
```ruby
|
161
|
-
require 'sidekiq/prometheus/exporter'
|
162
|
-
|
163
|
-
puts Sidekiq::Prometheus::Exporter.banner
|
164
|
-
```
|
165
|
-
|
166
|
-
:anger: if you don't see your banner try to output into `STDERR` instead of `STDOUT`
|
167
|
-
|
168
|
-
## Contributing
|
212
|
+
# Contributing
|
169
213
|
|
170
214
|
Bug reports and pull requests to support earlier versions of Sidekiq are welcome on GitHub at https://github.com/Strech/sidekiq-prometheus-exporter/issues.
|
171
215
|
|
data/Rakefile
CHANGED
@@ -4,3 +4,76 @@ require 'rspec/core/rake_task'
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
6
|
task default: :spec
|
7
|
+
|
8
|
+
# ==============================================================================
|
9
|
+
|
10
|
+
require 'English'
|
11
|
+
require 'fileutils'
|
12
|
+
require_relative 'lib/sidekiq/prometheus/exporter/version'
|
13
|
+
|
14
|
+
def execute(command)
|
15
|
+
output = `#{command}`
|
16
|
+
|
17
|
+
unless $CHILD_STATUS.success?
|
18
|
+
warn output
|
19
|
+
exit 1
|
20
|
+
end
|
21
|
+
|
22
|
+
output
|
23
|
+
end
|
24
|
+
|
25
|
+
namespace :docker do
|
26
|
+
task :release do
|
27
|
+
Rake::Task['docker:build'].invoke
|
28
|
+
Rake::Task['docker:push'].invoke
|
29
|
+
end
|
30
|
+
|
31
|
+
task :build do
|
32
|
+
image = 'strech/sidekiq-prometheus-exporter'
|
33
|
+
|
34
|
+
Dir.chdir(File.expand_path('./docker')) do
|
35
|
+
execute("docker build -t #{image}:#{Sidekiq::Prometheus::Exporter::VERSION} -t #{image}:latest .")
|
36
|
+
end
|
37
|
+
|
38
|
+
puts "Successfully built strech/sidekiq-prometheus-exporter and tagged #{Sidekiq::Prometheus::Exporter::VERSION}, latest"
|
39
|
+
end
|
40
|
+
|
41
|
+
task :push do
|
42
|
+
image = 'strech/sidekiq-prometheus-exporter'
|
43
|
+
|
44
|
+
execute("docker push #{image}:#{Sidekiq::Prometheus::Exporter::VERSION}")
|
45
|
+
execute("docker push #{image}:latest")
|
46
|
+
|
47
|
+
puts "Successfully pushed strech/sidekiq-prometheus-exporter #{Sidekiq::Prometheus::Exporter::VERSION}, latest"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
namespace :helm do
|
52
|
+
desc 'Generate new Helm repo index'
|
53
|
+
task :generate do
|
54
|
+
archive_dir = File.expand_path("./tmp/archive-#{Time.now.to_i}")
|
55
|
+
|
56
|
+
Rake::Task['helm:package'].invoke(archive_dir)
|
57
|
+
Rake::Task['helm:index'].invoke(archive_dir)
|
58
|
+
|
59
|
+
puts "New index generated: #{File.join(archive_dir, 'index.yaml')}"
|
60
|
+
end
|
61
|
+
|
62
|
+
task :package, [:directory] do |_, args|
|
63
|
+
chart_dir = File.expand_path('./helm/sidekiq-prometheus-exporter')
|
64
|
+
archive_dir = args.fetch(:directory) { File.expand_path("./tmp/archive-#{Time.now.to_i}") }
|
65
|
+
|
66
|
+
FileUtils.mkdir_p(archive_dir)
|
67
|
+
|
68
|
+
execute("helm package #{chart_dir} -d #{archive_dir}")
|
69
|
+
end
|
70
|
+
|
71
|
+
task :index, [:directory] do |_, args|
|
72
|
+
Dir.chdir(args.fetch(:directory)) do
|
73
|
+
url = "https://github.com/Strech/sidekiq-prometheus-exporter/releases/download/v#{Sidekiq::Prometheus::Exporter::VERSION}"
|
74
|
+
|
75
|
+
execute('git show gh-pages:index.yaml > existing-index.yaml')
|
76
|
+
execute("helm repo index . --url #{url} --merge existing-index.yaml")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|