yabeda-sidekiq 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +9 -9
- data/CHANGELOG.md +20 -0
- data/lib/yabeda/sidekiq/config.rb +3 -0
- data/lib/yabeda/sidekiq/version.rb +1 -1
- data/lib/yabeda/sidekiq.rb +14 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f287f1d10d316b33e5d56ea36a9d8dbcc9b1f520b0d3d21d72f11dd5bc40e90f
|
4
|
+
data.tar.gz: a3809269e4d6011f7dab4ce89391fd2d14fc0775c1dac768a8105f1949a0205b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cb86100524d1b8457caad978f1fcaaf299f27e27c74f787f8b9059b02682f6c4fd04017ad60f9e2b22c46d7d64d18b18cac935fea2586a38f886bd47a31e40c
|
7
|
+
data.tar.gz: e536ccdca8b3a9e66eb6ebf3e3795e8083aa46295f9587f5d80e23bf3ab7634851719410d28518d843d44a9c68904e7b162258da1f94737892a6f38c5f69b5e3
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Lint
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- '**'
|
8
|
+
tags-ignore:
|
9
|
+
- 'v*'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rubocop:
|
13
|
+
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
|
14
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
|
15
|
+
name: RuboCop
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: "3.0"
|
22
|
+
bundler-cache: true
|
23
|
+
- name: Lint Ruby code with RuboCop
|
24
|
+
run: |
|
25
|
+
bundle exec rubocop
|
data/.github/workflows/test.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: Tests
|
2
2
|
|
3
3
|
on:
|
4
4
|
pull_request:
|
@@ -10,17 +10,19 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
test:
|
13
|
-
name:
|
14
|
-
|
13
|
+
name: 'Ruby ${{ matrix.ruby }}'
|
14
|
+
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
|
15
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
|
15
16
|
runs-on: ubuntu-latest
|
16
17
|
strategy:
|
17
18
|
fail-fast: false
|
18
19
|
matrix:
|
19
20
|
include:
|
20
|
-
- ruby: 3.
|
21
|
-
- ruby:
|
22
|
-
- ruby: 2.
|
23
|
-
- ruby: 2.
|
21
|
+
- ruby: '3.1'
|
22
|
+
- ruby: '3.0'
|
23
|
+
- ruby: '2.7'
|
24
|
+
- ruby: '2.6'
|
25
|
+
- ruby: '2.5'
|
24
26
|
container:
|
25
27
|
image: ruby:${{ matrix.ruby }}
|
26
28
|
env:
|
@@ -41,7 +43,5 @@ jobs:
|
|
41
43
|
bundle config path vendor/bundle
|
42
44
|
bundle install
|
43
45
|
bundle update
|
44
|
-
- name: Run Rubocop
|
45
|
-
run: bundle exec rubocop
|
46
46
|
- name: Run RSpec
|
47
47
|
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## 0.9.0 - 2022-09-26
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Configuration setting to declare worker in-process metrics outside workers.
|
15
|
+
|
16
|
+
It can be needed for official Prometheus client in multi-process mode where separate process expose metrics from Sidekiq worker processes.
|
17
|
+
|
18
|
+
- `most_recent` aggregation for all cluster-wide gauges.
|
19
|
+
|
20
|
+
It is also needed for official Prometheus client in multi-process mode to reduce number of time series.
|
21
|
+
|
22
|
+
## 0.8.2 - 2022-09-14
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
- Ability to programmatically change gem settings by calling writer methods on `Yabeda::Sidekiq.config`. [@Envek]
|
27
|
+
|
28
|
+
Usage is quite limited though as you need to do it before `Yabeda.configure!` is called.
|
29
|
+
|
10
30
|
## 0.8.1 - 2021-08-24
|
11
31
|
|
12
32
|
### Fixed
|
@@ -13,6 +13,9 @@ module Yabeda
|
|
13
13
|
# - force disable if you don't want multiple Sidekiq workers to report the same numbers (that causes excess load to both Redis and monitoring)
|
14
14
|
# - force enable if you want non-Sidekiq process to collect them (like dedicated metric exporter process)
|
15
15
|
attr_config collect_cluster_metrics: ::Sidekiq.server?
|
16
|
+
|
17
|
+
# Declare metrics that are only tracked inside worker process even outside them
|
18
|
+
attr_config declare_process_metrics: ::Sidekiq.server?
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
data/lib/yabeda/sidekiq.rb
CHANGED
@@ -16,14 +16,18 @@ module Yabeda
|
|
16
16
|
30, 60, 120, 300, 1800, 3600, 21_600, # Sidekiq tasks may be very long-running
|
17
17
|
].freeze
|
18
18
|
|
19
|
+
def self.config
|
20
|
+
@config ||= Config.new
|
21
|
+
end
|
22
|
+
|
19
23
|
Yabeda.configure do
|
20
|
-
config =
|
24
|
+
config = ::Yabeda::Sidekiq.config
|
21
25
|
|
22
26
|
group :sidekiq
|
23
27
|
|
24
28
|
counter :jobs_enqueued_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq enqueued."
|
25
29
|
|
26
|
-
if
|
30
|
+
if config.declare_process_metrics # defaults to +::Sidekiq.server?+
|
27
31
|
counter :jobs_executed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq executed."
|
28
32
|
counter :jobs_success_total, tags: %i[queue worker], comment: "A counter of the total number of jobs successfully processed by sidekiq."
|
29
33
|
counter :jobs_failed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs failed in sidekiq."
|
@@ -44,13 +48,13 @@ module Yabeda
|
|
44
48
|
# Metrics not specific for current Sidekiq process, but representing state of the whole Sidekiq installation (queues, processes, etc)
|
45
49
|
# You can opt-out from collecting these by setting YABEDA_SIDEKIQ_COLLECT_CLUSTER_METRICS to falsy value (+no+ or +false+)
|
46
50
|
if config.collect_cluster_metrics # defaults to +::Sidekiq.server?+
|
47
|
-
gauge :jobs_waiting_count, tags: %i[queue], comment: "The number of jobs waiting to process in sidekiq."
|
48
|
-
gauge :active_workers_count, tags: [], comment: "The number of currently running machines with sidekiq workers."
|
49
|
-
gauge :jobs_scheduled_count, tags: [], comment: "The number of jobs scheduled for later execution."
|
50
|
-
gauge :jobs_retry_count, tags: [], comment: "The number of failed jobs waiting to be retried"
|
51
|
-
gauge :jobs_dead_count, tags: [], comment: "The number of jobs exceeded their retry count."
|
52
|
-
gauge :active_processes, tags: [], comment: "The number of active Sidekiq worker processes."
|
53
|
-
gauge :queue_latency, tags: %i[queue], comment: "The queue latency, the difference in seconds since the oldest job in the queue was enqueued"
|
51
|
+
gauge :jobs_waiting_count, tags: %i[queue], aggregation: :most_recent, comment: "The number of jobs waiting to process in sidekiq."
|
52
|
+
gauge :active_workers_count, tags: [], aggregation: :most_recent, comment: "The number of currently running machines with sidekiq workers."
|
53
|
+
gauge :jobs_scheduled_count, tags: [], aggregation: :most_recent, comment: "The number of jobs scheduled for later execution."
|
54
|
+
gauge :jobs_retry_count, tags: [], aggregation: :most_recent, comment: "The number of failed jobs waiting to be retried"
|
55
|
+
gauge :jobs_dead_count, tags: [], aggregation: :most_recent, comment: "The number of jobs exceeded their retry count."
|
56
|
+
gauge :active_processes, tags: [], aggregation: :most_recent, comment: "The number of active Sidekiq worker processes."
|
57
|
+
gauge :queue_latency, tags: %i[queue], aggregation: :most_recent, comment: "The queue latency, the difference in seconds since the oldest job in the queue was enqueued"
|
54
58
|
end
|
55
59
|
|
56
60
|
collect do
|
@@ -135,6 +139,6 @@ module Yabeda
|
|
135
139
|
end
|
136
140
|
end
|
137
141
|
|
138
|
-
self.jobs_started_at = Concurrent::
|
142
|
+
self.jobs_started_at = Concurrent::Map.new { |hash, key| hash[key] = Concurrent::Map.new }
|
139
143
|
end
|
140
144
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -123,6 +123,7 @@ extensions: []
|
|
123
123
|
extra_rdoc_files: []
|
124
124
|
files:
|
125
125
|
- ".github/workflows/build-release.yml"
|
126
|
+
- ".github/workflows/lint.yml"
|
126
127
|
- ".github/workflows/test.yml"
|
127
128
|
- ".gitignore"
|
128
129
|
- ".rspec"
|