sidekiq-prometheus-exporter 0.1.10 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +12 -0
- data/.github/workflows/ci.yaml +76 -0
- data/.gitignore +3 -1
- data/.rubocop.yml +28 -28
- data/Appraisals +17 -4
- data/README.md +120 -37
- data/Rakefile +76 -0
- data/docker/Dockerfile +24 -0
- data/docker/README.md +60 -0
- data/docker/config.ru +40 -0
- data/examples/docker-compose.yml +2 -2
- data/examples/screenshot.png +0 -0
- 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 → sidekiq_3.3.1.Gemfile} +2 -1
- data/gemfiles/sidekiq_3.3.1.Gemfile.lock +124 -0
- data/gemfiles/{sidekiq_3.x.gemfile → sidekiq_3.x.Gemfile} +2 -1
- data/gemfiles/{sidekiq_3.x.gemfile.lock → sidekiq_3.x.Gemfile.lock} +47 -46
- data/gemfiles/{sidekiq_4.x.gemfile → sidekiq_4.x.Gemfile} +1 -1
- data/gemfiles/{sidekiq_4.x.gemfile.lock → sidekiq_4.x.Gemfile.lock} +38 -38
- data/gemfiles/{sidekiq_5.x.gemfile → sidekiq_5.x.Gemfile} +1 -1
- data/gemfiles/{sidekiq_5.x.gemfile.lock → sidekiq_5.x.Gemfile.lock} +41 -40
- data/gemfiles/sidekiq_6.x.Gemfile +8 -0
- data/gemfiles/sidekiq_6.x.Gemfile.lock +97 -0
- data/gemfiles/sidekiq_latest.Gemfile +9 -0
- data/gemfiles/sidekiq_latest.Gemfile.lock +113 -0
- 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 +134 -0
- data/lib/sidekiq/prometheus/exporter.rb +12 -1
- data/lib/sidekiq/prometheus/exporter/exporters.rb +4 -1
- data/lib/sidekiq/prometheus/exporter/standard.rb +1 -1
- data/lib/sidekiq/prometheus/exporter/version.rb +1 -1
- data/sidekiq-prometheus-exporter.gemspec +3 -3
- metadata +43 -23
- data/.travis.yml +0 -23
- data/gemfiles/sidekiq_3.3.1.gemfile.lock +0 -138
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e6abd894355205259e60c8804e17560ca107d88f0299aea7fae7c495130521dd
|
4
|
+
data.tar.gz: 5665a775e383a91b129d12e84128740904321da0e099fc1237c9381701bd2b91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a6c12a03307b5cd4651bb6190d1bf4659005554d1f42839f6f340f9bf55faab6a5335dc29ec49982f381312502ef10dec9fff2578e9120179d1f04350a980d
|
7
|
+
data.tar.gz: 1d4c635db97afde9d894c5294ef5d592fe2f3caf5cc72f0a33b7d1dd8ba70614eee1b54e4d3b2f54a744a03587bd669f1f7d442bfc7b803ed6f8e904b2c73edf
|
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']
|
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: ["master"]
|
6
|
+
pull_request:
|
7
|
+
branches: ["master"]
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-16.04
|
11
|
+
name: Ruby ${{ matrix.ruby }} / Sidekiq ${{ matrix.sidekiq }}
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby: ["2.3.8", "2.4.10", "2.5.8", "2.6.6", "2.7.2", "latest"]
|
15
|
+
sidekiq: ["3.3.1", "3.x", "4.x", "5.x", "6.x", "latest"]
|
16
|
+
include:
|
17
|
+
- ruby: "2.6.6"
|
18
|
+
sidekiq: "5.x"
|
19
|
+
codeclimate: "true"
|
20
|
+
exclude:
|
21
|
+
- ruby: "2.3.8"
|
22
|
+
sidekiq: "6.x"
|
23
|
+
- ruby: "2.4.10"
|
24
|
+
sidekiq: "6.x"
|
25
|
+
- ruby: "2.3.8"
|
26
|
+
sidekiq: "latest"
|
27
|
+
- ruby: "2.4.10"
|
28
|
+
sidekiq: "latest"
|
29
|
+
- ruby: "2.5.8"
|
30
|
+
sidekiq: "latest"
|
31
|
+
- ruby: "2.6.6"
|
32
|
+
sidekiq: "latest"
|
33
|
+
- ruby: "2.7.2"
|
34
|
+
sidekiq: "latest"
|
35
|
+
|
36
|
+
container:
|
37
|
+
image: ruby:${{ matrix.ruby }}
|
38
|
+
env:
|
39
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
40
|
+
|
41
|
+
steps:
|
42
|
+
- uses: actions/checkout@v2
|
43
|
+
|
44
|
+
- uses: actions/cache@v2
|
45
|
+
id: vendor-cache
|
46
|
+
with:
|
47
|
+
path: vendor
|
48
|
+
key: bundle-${{ matrix.ruby }}-sidekiq-${{ matrix.sidekiq }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/.*Gemfile.lock') }}
|
49
|
+
|
50
|
+
- name: Upgrade Bundler to 2.x (for older Ruby versions)
|
51
|
+
run: gem install bundler -v '~> 2.1'
|
52
|
+
|
53
|
+
- name: Install CodeClimate test reporter
|
54
|
+
if: steps.vendor-cache.outputs.cache-hit != 'true'
|
55
|
+
run: |
|
56
|
+
mkdir -p ./vendor
|
57
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \
|
58
|
+
> ./vendor/cc-test-reporter
|
59
|
+
chmod +x ./vendor/cc-test-reporter
|
60
|
+
|
61
|
+
- name: Bundle install
|
62
|
+
run: |
|
63
|
+
bundle config path vendor/bundle
|
64
|
+
bundle config gemfile gemfiles/sidekiq_${{ matrix.sidekiq }}.Gemfile
|
65
|
+
bundle install
|
66
|
+
|
67
|
+
- name: Start recording Codeclimate test coverage
|
68
|
+
if: matrix.codeclimate == 'true'
|
69
|
+
run: ./vendor/cc-test-reporter before-build
|
70
|
+
|
71
|
+
- name: Run RSpec
|
72
|
+
run: bundle exec rake spec
|
73
|
+
|
74
|
+
- name: Finish recording Codeclimate test coverage
|
75
|
+
if: matrix.codeclimate == 'true'
|
76
|
+
run: ./vendor/cc-test-reporter after-build
|
data/.gitignore
CHANGED
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/Appraisals
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
appraise 'sidekiq-3.3.1' do
|
2
2
|
gem 'slim'
|
3
|
-
gem 'redis', '
|
3
|
+
gem 'redis', '~> 3.3'
|
4
|
+
gem 'redis-namespace', '< 1.7.0'
|
4
5
|
gem 'sinatra'
|
5
6
|
gem 'concurrent-ruby'
|
6
7
|
gem 'sidekiq', '= 3.3.1'
|
@@ -8,18 +9,30 @@ end
|
|
8
9
|
|
9
10
|
appraise 'sidekiq-3.x' do
|
10
11
|
gem 'slim'
|
11
|
-
gem 'redis', '
|
12
|
+
gem 'redis', '~> 3.3'
|
13
|
+
gem 'redis-namespace', '< 1.7.0'
|
12
14
|
gem 'sinatra'
|
13
15
|
gem 'concurrent-ruby'
|
14
16
|
gem 'sidekiq', '~> 3.0'
|
15
17
|
end
|
16
18
|
|
17
19
|
appraise 'sidekiq-4.x' do
|
18
|
-
gem 'redis', '
|
20
|
+
gem 'redis', '~> 3.3'
|
19
21
|
gem 'sidekiq', '~> 4.0'
|
20
22
|
end
|
21
23
|
|
22
24
|
appraise 'sidekiq-5.x' do
|
23
|
-
gem 'redis', '
|
25
|
+
gem 'redis', '~> 3.3'
|
24
26
|
gem 'sidekiq', '~> 5.0'
|
25
27
|
end
|
28
|
+
|
29
|
+
appraise 'sidekiq-6.x' do
|
30
|
+
gem 'redis', '~> 4.1'
|
31
|
+
gem 'sidekiq', '~> 6.0'
|
32
|
+
end
|
33
|
+
|
34
|
+
appraise 'sidekiq-latest' do
|
35
|
+
gem 'rack', '>= 2', github: 'rack/rack'
|
36
|
+
gem 'redis', '>= 4', github: 'redis/redis-rb'
|
37
|
+
gem 'sidekiq', '>= 6', github: 'mperham/sidekiq'
|
38
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
![CI status](https://github.com/Strech/sidekiq-prometheus-exporter/workflows/CI/badge.svg)
|
2
2
|
[![Maintainability](https://api.codeclimate.com/v1/badges/bb1b30cd7aca8ecc9413/maintainability)](https://codeclimate.com/github/Strech/sidekiq-prometheus-exporter/maintainability)
|
3
3
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/bb1b30cd7aca8ecc9413/test_coverage)](https://codeclimate.com/github/Strech/sidekiq-prometheus-exporter/test_coverage)
|
4
4
|
|
@@ -10,66 +10,78 @@
|
|
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
|
|
52
64
|
Add this line to your application's Gemfile:
|
53
65
|
|
54
66
|
```ruby
|
55
|
-
gem 'sidekiq-prometheus-exporter'
|
67
|
+
gem 'sidekiq-prometheus-exporter', '~> 0.1'
|
56
68
|
```
|
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
|
-
For
|
84
|
+
For a fresh new application to expose metrics create `config.ru` file with
|
73
85
|
next code inside
|
74
86
|
|
75
87
|
```ruby
|
@@ -85,13 +97,37 @@ 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
|
107
|
+
|
108
|
+
When you have rails application, it's possible to mount exporter
|
109
|
+
as a rack application in your `routes.rb`
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
Rails.application.routes.draw do
|
113
|
+
# ... omitted ...
|
114
|
+
|
115
|
+
# For more information please check here
|
116
|
+
# https://api.rubyonrails.org/v5.1/classes/ActionDispatch/Routing/Mapper/Base.html#method-i-mount
|
117
|
+
require 'sidekiq/prometheus/exporter'
|
118
|
+
mount Sidekiq::Prometheus::Exporter => '/metrics'
|
119
|
+
end
|
120
|
+
```
|
121
|
+
|
122
|
+
Use rails server from `bin` folder to start it up, like this
|
123
|
+
|
124
|
+
```console
|
125
|
+
$ ./bin/rails s -p 9292 -b 0.0.0.0
|
126
|
+
```
|
127
|
+
|
128
|
+
and then `curl https://0.0.0.0:9292/metrics`
|
129
|
+
|
130
|
+
## Sidekiq Web (extream)
|
95
131
|
|
96
132
|
If you are ok with metrics being exposed via Sidekiq web dashboard because
|
97
133
|
you have it inside your private network or only Prometheus scraper will have access
|
@@ -106,7 +142,52 @@ Sidekiq::Web.register(Sidekiq::Prometheus::Exporter)
|
|
106
142
|
|
107
143
|
and then `curl https://<your-sidekiq-web-uri>/metrics`
|
108
144
|
|
109
|
-
|
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
|
110
191
|
|
111
192
|
By default we try to detect as many as possible [sidekiq contribs](https://github.com/mperham/sidekiq/wiki/Related-Projects)
|
112
193
|
and add their metrics to the output.
|
@@ -126,7 +207,9 @@ Sidekiq::Prometheus::Exporter.configure do |config|
|
|
126
207
|
end
|
127
208
|
```
|
128
209
|
|
129
|
-
|
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.
|
211
|
+
|
212
|
+
# Contributing
|
130
213
|
|
131
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.
|
132
215
|
|