yabeda-sidekiq 0.7.0 → 0.8.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/build-release.yml +82 -0
- data/.github/workflows/test.yml +47 -0
- data/CHANGELOG.md +19 -0
- data/README.md +56 -3
- data/lib/yabeda/sidekiq.rb +52 -22
- data/lib/yabeda/sidekiq/config.rb +18 -0
- data/lib/yabeda/sidekiq/server_middleware.rb +2 -0
- data/lib/yabeda/sidekiq/version.rb +1 -1
- data/yabeda-sidekiq.gemspec +1 -0
- metadata +26 -4
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68116758a02a4497a4eda56cac585a5afcfac8902e880d1c061c70f952898ed0
|
4
|
+
data.tar.gz: 599d85f03c0a5cc8ef87c78db670337263cc1eecb4dd14ee0925aa0862b07e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86db733e71ce0b21e1997714124d55cb97774d3076e9d2c5d7b2a014f741973d185b92bcd3fc7eb34e57d1ee5de6a696266129663557a327f424b8eda308d30
|
7
|
+
data.tar.gz: ebfb0e1814c4e9b31f0fb130028fb764b8014688a0c70add91e04282d57de545dd32de37bcfa42d266d7defb081e016060007e90ce61908443234fcdcff557ba
|
@@ -0,0 +1,82 @@
|
|
1
|
+
name: Build and release gem to RubyGems
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
with:
|
14
|
+
fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7
|
18
|
+
- name: "Extract data from tag: version, message, body"
|
19
|
+
id: tag
|
20
|
+
run: |
|
21
|
+
git fetch --tags --force # Really fetch annotated tag. See https://github.com/actions/checkout/issues/290#issuecomment-680260080
|
22
|
+
echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
|
23
|
+
echo ::set-output name=subject::$(git for-each-ref $GITHUB_REF --format='%(contents:subject)')
|
24
|
+
BODY="$(git for-each-ref $GITHUB_REF --format='%(contents:body)')"
|
25
|
+
# Extract changelog entries between this and previous version headers
|
26
|
+
escaped_version=$(echo ${GITHUB_REF#refs/tags/v} | sed -e 's/[]\/$*.^[]/\\&/g')
|
27
|
+
changelog=$(awk "BEGIN{inrelease=0} /## ${escaped_version}/{inrelease=1;next} /## [0-9]+\.[0-9]+\.[0-9]+/{inrelease=0;exit} {if (inrelease) print}" CHANGELOG.md)
|
28
|
+
# Multiline body for release. See https://github.community/t/set-output-truncates-multiline-strings/16852/5
|
29
|
+
BODY="${BODY}"$'\n'"${changelog}"
|
30
|
+
BODY="${BODY//'%'/'%25'}"
|
31
|
+
BODY="${BODY//$'\n'/'%0A'}"
|
32
|
+
BODY="${BODY//$'\r'/'%0D'}"
|
33
|
+
echo "::set-output name=body::$BODY"
|
34
|
+
# Add pre-release option if tag name has any suffix after vMAJOR.MINOR.PATCH
|
35
|
+
if [[ ${GITHUB_REF#refs/tags/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]]; then
|
36
|
+
echo ::set-output name=prerelease::true
|
37
|
+
fi
|
38
|
+
- name: Build gem
|
39
|
+
run: gem build
|
40
|
+
- name: Calculate checksums
|
41
|
+
run: sha256sum yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem > SHA256SUM
|
42
|
+
- name: Check version
|
43
|
+
run: ls -l yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
|
44
|
+
- name: Create Release
|
45
|
+
id: create_release
|
46
|
+
uses: actions/create-release@v1
|
47
|
+
env:
|
48
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
49
|
+
with:
|
50
|
+
tag_name: ${{ github.ref }}
|
51
|
+
release_name: ${{ steps.tag.outputs.subject }}
|
52
|
+
body: ${{ steps.tag.outputs.body }}
|
53
|
+
draft: false
|
54
|
+
prerelease: ${{ steps.tag.outputs.prerelease }}
|
55
|
+
- name: Upload built gem as release asset
|
56
|
+
uses: actions/upload-release-asset@v1
|
57
|
+
env:
|
58
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
59
|
+
with:
|
60
|
+
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
61
|
+
asset_path: yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
|
62
|
+
asset_name: yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
|
63
|
+
asset_content_type: application/x-tar
|
64
|
+
- name: Upload checksums as release asset
|
65
|
+
uses: actions/upload-release-asset@v1
|
66
|
+
env:
|
67
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
68
|
+
with:
|
69
|
+
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
70
|
+
asset_path: SHA256SUM
|
71
|
+
asset_name: SHA256SUM
|
72
|
+
asset_content_type: text/plain
|
73
|
+
- name: Publish to GitHub packages
|
74
|
+
env:
|
75
|
+
GEM_HOST_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }}
|
76
|
+
run: |
|
77
|
+
gem push yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem --host https://rubygems.pkg.github.com/${{ github.repository_owner }}
|
78
|
+
- name: Publish to RubyGems
|
79
|
+
env:
|
80
|
+
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}"
|
81
|
+
run: |
|
82
|
+
gem push yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
|
@@ -0,0 +1,47 @@
|
|
1
|
+
name: Run tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- '**'
|
8
|
+
tags-ignore:
|
9
|
+
- 'v*'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
name: "Run tests"
|
14
|
+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
include:
|
20
|
+
- ruby: 3.0
|
21
|
+
- ruby: 2.7
|
22
|
+
- ruby: 2.6
|
23
|
+
- ruby: 2.5
|
24
|
+
container:
|
25
|
+
image: ruby:${{ matrix.ruby }}
|
26
|
+
env:
|
27
|
+
CI: true
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v2
|
30
|
+
- uses: actions/cache@v2
|
31
|
+
with:
|
32
|
+
path: vendor/bundle
|
33
|
+
key: bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
34
|
+
restore-keys: |
|
35
|
+
bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
36
|
+
bundle-${{ matrix.ruby }}-
|
37
|
+
- name: Upgrade Bundler to 2.0 (for older Rubies)
|
38
|
+
run: gem install bundler -v '~> 2.0'
|
39
|
+
- name: Bundle install
|
40
|
+
run: |
|
41
|
+
bundle config path vendor/bundle
|
42
|
+
bundle install
|
43
|
+
bundle update
|
44
|
+
- name: Run Rubocop
|
45
|
+
run: bundle exec rubocop
|
46
|
+
- name: Run RSpec
|
47
|
+
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## Unreleased
|
9
|
+
|
10
|
+
## 0.8.0 - 2021-05-12
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- `sidekiq_running_job_runtime` metric that tracks maximum runtime of currently running jobs. It may be useful for detection of hung jobs. See [#17](https://github.com/yabeda-rb/yabeda-sidekiq/pull/17). [@dsalahutdinov], [@Envek]
|
15
|
+
|
16
|
+
- Setting `collect_cluster_metrics` allowing to force enable or disable collection of global (whole Sidekiq installaction-wide) metrics. See [#20](https://github.com/yabeda-rb/yabeda-sidekiq/pull/20). [@mrexox]
|
17
|
+
|
18
|
+
By default all sidekiq worker processes (servers) collects global metrics about whole Sidekiq installation.
|
19
|
+
Client processes (everything else that is not Sidekiq worker) by default doesn't.
|
20
|
+
|
21
|
+
With this config you can override this behavior:
|
22
|
+
- force disable if you don't want multiple Sidekiq workers to report the same numbers (that causes excess load to both Redis and monitoring)
|
23
|
+
- force enable if you want non-Sidekiq process to collect them (like dedicated metric exporter process)
|
24
|
+
|
8
25
|
## 0.7.0 - 2020-07-15
|
9
26
|
|
10
27
|
### Changed
|
@@ -61,5 +78,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
61
78
|
|
62
79
|
- Initial release of evil-metrics-sidekiq gem. @Envek
|
63
80
|
|
81
|
+
[@Envek]: https://github.com/Envek "Andrey Novikov"
|
64
82
|
[@dsalahutdinov]: https://github.com/dsalahutdinov "Salahutdinov Dmitry"
|
65
83
|
[@asusikov]: https://github.com/asusikov "Alexander Susikov"
|
84
|
+
[@mrexox]: https://github.com/mrexox "Valentine Kiselev"
|
data/README.md
CHANGED
@@ -37,18 +37,30 @@ end
|
|
37
37
|
|
38
38
|
## Metrics
|
39
39
|
|
40
|
+
### Local per-process metrics
|
41
|
+
|
42
|
+
Metrics representing state of current Sidekiq worker process and stats of executed or executing jobs:
|
43
|
+
|
40
44
|
- Total number of executed jobs: `sidekiq_jobs_executed_total` - (segmented by queue and class name)
|
41
45
|
- Number of jobs have been finished successfully: `sidekiq_jobs_success_total` (segmented by queue and class name)
|
42
46
|
- Number of jobs have been failed: `sidekiq_jobs_failed_total` (segmented by queue and class name)
|
43
47
|
- Time of job run: `sidekiq_job_runtime` (seconds per job execution, segmented by queue and class name)
|
44
|
-
- Time of the queue latency `sidekiq_queue_latency` (the difference in seconds since the oldest job in the queue was enqueued)
|
45
48
|
- Time of the job latency `sidekiq_job_latency` (the difference in seconds since the enqueuing until running job)
|
49
|
+
- Maximum runtime of currently executing jobs: `sidekiq_running_job_runtime` (useful for detection of hung jobs, segmented by queue and class name)
|
50
|
+
|
51
|
+
### Global cluster-wide metrics
|
52
|
+
|
53
|
+
Metrics representing state of the whole Sidekiq installation (queues, processes, etc):
|
54
|
+
|
46
55
|
- Number of jobs in queues: `sidekiq_jobs_waiting_count` (segmented by queue)
|
56
|
+
- Time of the queue latency `sidekiq_queue_latency` (the difference in seconds since the oldest job in the queue was enqueued)
|
47
57
|
- Number of scheduled jobs:`sidekiq_jobs_scheduled_count`
|
48
58
|
- Number of jobs in retry set: `sidekiq_jobs_retry_count`
|
49
59
|
- Number of jobs in dead set (“morgue”): `sidekiq_jobs_dead_count`
|
50
|
-
- Active
|
51
|
-
- Active
|
60
|
+
- Active processes count: `sidekiq_active_processes`
|
61
|
+
- Active servers count: `sidekiq_active_workers_count`
|
62
|
+
|
63
|
+
By default all sidekiq worker processes (servers) collects global metrics about whole Sidekiq installation. This can be overridden by setting `collect_cluster_metrics` config key to `true` for non-Sidekiq processes or to `false` for Sidekiq processes (e.g. by setting `YABEDA_SIDEKIQ_COLLECT_CLUSTER_METRICS` env variable to `no`, see other methods in [anyway_config] docs).
|
52
64
|
|
53
65
|
## Custom tags
|
54
66
|
|
@@ -73,6 +85,14 @@ class MyWorker
|
|
73
85
|
end
|
74
86
|
```
|
75
87
|
|
88
|
+
## Configuration
|
89
|
+
|
90
|
+
Configuration is handled by [anyway_config] gem. With it you can load settings from environment variables (upcased and prefixed with `YABEDA_SIDEKIQ_`), YAML files, and other sources. See [anyway_config] docs for details.
|
91
|
+
|
92
|
+
Config key | Type | Default | Description |
|
93
|
+
------------------------- | -------- | ------------------------------------------------------- | ----------- |
|
94
|
+
`collect_cluster_metrics` | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Defines whether this Ruby process should collect and expose metrics representing state of the whole Sidekiq installation (queues, processes, etc). |
|
95
|
+
|
76
96
|
# Roadmap (TODO or Help wanted)
|
77
97
|
|
78
98
|
- Implement optional segmentation of retry/schedule/dead sets
|
@@ -91,6 +111,38 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
91
111
|
|
92
112
|
Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-sidekiq.
|
93
113
|
|
114
|
+
### Releasing
|
115
|
+
|
116
|
+
1. Bump version number in `lib/yabeda/sidekiq/version.rb`
|
117
|
+
|
118
|
+
In case of pre-releases keep in mind [rubygems/rubygems#3086](https://github.com/rubygems/rubygems/issues/3086) and check version with command like `Gem::Version.new(Yabeda::Sidekiq::VERSION).to_s`
|
119
|
+
|
120
|
+
2. Fill `CHANGELOG.md` with missing changes, add header with version and date.
|
121
|
+
|
122
|
+
3. Make a commit:
|
123
|
+
|
124
|
+
```sh
|
125
|
+
git add lib/yabeda/sidekiq/version.rb CHANGELOG.md
|
126
|
+
version=$(ruby -r ./lib/yabeda/sidekiq/version.rb -e "puts Gem::Version.new(Yabeda::Sidekiq::VERSION)")
|
127
|
+
git commit --message="${version}: " --edit
|
128
|
+
```
|
129
|
+
|
130
|
+
4. Create annotated tag:
|
131
|
+
|
132
|
+
```sh
|
133
|
+
git tag v${version} --annotate --message="${version}: " --edit --sign
|
134
|
+
```
|
135
|
+
|
136
|
+
5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)
|
137
|
+
|
138
|
+
6. Push it:
|
139
|
+
|
140
|
+
```sh
|
141
|
+
git push --follow-tags
|
142
|
+
```
|
143
|
+
|
144
|
+
7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!
|
145
|
+
|
94
146
|
## License
|
95
147
|
|
96
148
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -98,3 +150,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
98
150
|
[Sidekiq]: https://github.com/mperham/sidekiq/ "Simple, efficient background processing for Ruby"
|
99
151
|
[yabeda]: https://github.com/yabeda-rb/yabeda
|
100
152
|
[yabeda-prometheus]: https://github.com/yabeda-rb/yabeda-prometheus
|
153
|
+
[anyway_config]: https://github.com/palkan/anyway_config "Configuration library for Ruby gems and applications"
|
data/lib/yabeda/sidekiq.rb
CHANGED
@@ -7,6 +7,7 @@ require "yabeda"
|
|
7
7
|
require "yabeda/sidekiq/version"
|
8
8
|
require "yabeda/sidekiq/client_middleware"
|
9
9
|
require "yabeda/sidekiq/server_middleware"
|
10
|
+
require "yabeda/sidekiq/config"
|
10
11
|
|
11
12
|
module Yabeda
|
12
13
|
module Sidekiq
|
@@ -16,34 +17,47 @@ module Yabeda
|
|
16
17
|
].freeze
|
17
18
|
|
18
19
|
Yabeda.configure do
|
20
|
+
config = Config.new
|
21
|
+
|
19
22
|
group :sidekiq
|
20
23
|
|
21
24
|
counter :jobs_enqueued_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq enqueued."
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
26
|
+
if ::Sidekiq.server?
|
27
|
+
counter :jobs_executed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq executed."
|
28
|
+
counter :jobs_success_total, tags: %i[queue worker], comment: "A counter of the total number of jobs successfully processed by sidekiq."
|
29
|
+
counter :jobs_failed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs failed in sidekiq."
|
30
|
+
|
31
|
+
gauge :running_job_runtime, tags: %i[queue worker], aggregation: :max, unit: :seconds,
|
32
|
+
comment: "How long currently running jobs are running (useful for detection of hung jobs)"
|
33
|
+
|
34
|
+
histogram :job_latency, comment: "The job latency, the difference in seconds between enqueued and running time",
|
35
|
+
unit: :seconds, per: :job,
|
36
|
+
tags: %i[queue worker],
|
37
|
+
buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS
|
38
|
+
histogram :job_runtime, comment: "A histogram of the job execution time.",
|
39
|
+
unit: :seconds, per: :job,
|
40
|
+
tags: %i[queue worker],
|
41
|
+
buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS
|
42
|
+
end
|
43
|
+
|
44
|
+
# Metrics not specific for current Sidekiq process, but representing state of the whole Sidekiq installation (queues, processes, etc)
|
45
|
+
# You can opt-out from collecting these by setting YABEDA_SIDEKIQ_COLLECT_CLUSTER_METRICS to falsy value (+no+ or +false+)
|
46
|
+
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"
|
54
|
+
end
|
45
55
|
|
46
56
|
collect do
|
57
|
+
Yabeda::Sidekiq.track_max_job_runtime if ::Sidekiq.server?
|
58
|
+
|
59
|
+
next unless config.collect_cluster_metrics
|
60
|
+
|
47
61
|
stats = ::Sidekiq::Stats.new
|
48
62
|
|
49
63
|
stats.queues.each do |k, v|
|
@@ -105,6 +119,22 @@ module Yabeda
|
|
105
119
|
|
106
120
|
worker.method(:yabeda_tags).arity.zero? ? worker.yabeda_tags : worker.yabeda_tags(*job["args"])
|
107
121
|
end
|
122
|
+
|
123
|
+
# Hash of hashes containing all currently running jobs' start timestamps
|
124
|
+
# to calculate maximum durations of currently running not yet completed jobs
|
125
|
+
# { { queue: "default", worker: "SomeJob" } => { "jid1" => 100500, "jid2" => 424242 } }
|
126
|
+
attr_accessor :jobs_started_at
|
127
|
+
|
128
|
+
def track_max_job_runtime
|
129
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
130
|
+
::Yabeda::Sidekiq.jobs_started_at.each do |labels, jobs|
|
131
|
+
oldest_job_started_at = jobs.values.min
|
132
|
+
oldest_job_duration = oldest_job_started_at ? (now - oldest_job_started_at).round(3) : 0
|
133
|
+
Yabeda.sidekiq.running_job_runtime.set(labels, oldest_job_duration)
|
134
|
+
end
|
135
|
+
end
|
108
136
|
end
|
137
|
+
|
138
|
+
self.jobs_started_at = Concurrent::Hash.new { |hash, key| hash[key] = Concurrent::Hash.new }
|
109
139
|
end
|
110
140
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "anyway"
|
4
|
+
|
5
|
+
module Yabeda
|
6
|
+
module Sidekiq
|
7
|
+
class Config < ::Anyway::Config
|
8
|
+
config_name :yabeda_sidekiq
|
9
|
+
|
10
|
+
# By default all sidekiq worker processes (servers) collects global metrics about whole Sidekiq installation.
|
11
|
+
# Client processes (everything else that is not Sidekiq worker) by default doesn't.
|
12
|
+
# With this config you can override this behavior:
|
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
|
+
# - force enable if you want non-Sidekiq process to collect them (like dedicated metric exporter process)
|
15
|
+
attr_config collect_cluster_metrics: ::Sidekiq.server?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -12,6 +12,7 @@ module Yabeda
|
|
12
12
|
begin
|
13
13
|
job_instance = ::Sidekiq::Job.new(job)
|
14
14
|
Yabeda.sidekiq_job_latency.measure(labels, job_instance.latency)
|
15
|
+
Yabeda::Sidekiq.jobs_started_at[labels][job["jid"]] = start
|
15
16
|
Yabeda.with_tags(**custom_tags) do
|
16
17
|
yield
|
17
18
|
end
|
@@ -22,6 +23,7 @@ module Yabeda
|
|
22
23
|
ensure
|
23
24
|
Yabeda.sidekiq_job_runtime.measure(labels, elapsed(start))
|
24
25
|
Yabeda.sidekiq_jobs_executed_total.increment(labels)
|
26
|
+
Yabeda::Sidekiq.jobs_started_at[labels].delete(job["jid"])
|
25
27
|
end
|
26
28
|
end
|
27
29
|
# rubocop: enable Metrics/AbcSize, Metrics/MethodLength:
|
data/yabeda-sidekiq.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
+
spec.add_dependency "anyway_config", ">= 1.3", "< 3"
|
25
26
|
spec.add_dependency "sidekiq"
|
26
27
|
spec.add_dependency "yabeda", "~> 0.6"
|
27
28
|
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.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: 2021-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: anyway_config
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: sidekiq
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,10 +122,11 @@ executables: []
|
|
102
122
|
extensions: []
|
103
123
|
extra_rdoc_files: []
|
104
124
|
files:
|
125
|
+
- ".github/workflows/build-release.yml"
|
126
|
+
- ".github/workflows/test.yml"
|
105
127
|
- ".gitignore"
|
106
128
|
- ".rspec"
|
107
129
|
- ".rubocop.yml"
|
108
|
-
- ".travis.yml"
|
109
130
|
- CHANGELOG.md
|
110
131
|
- Gemfile
|
111
132
|
- LICENSE.txt
|
@@ -115,6 +136,7 @@ files:
|
|
115
136
|
- bin/setup
|
116
137
|
- lib/yabeda/sidekiq.rb
|
117
138
|
- lib/yabeda/sidekiq/client_middleware.rb
|
139
|
+
- lib/yabeda/sidekiq/config.rb
|
118
140
|
- lib/yabeda/sidekiq/server_middleware.rb
|
119
141
|
- lib/yabeda/sidekiq/version.rb
|
120
142
|
- yabeda-sidekiq.gemspec
|
@@ -137,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
159
|
- !ruby/object:Gem::Version
|
138
160
|
version: '0'
|
139
161
|
requirements: []
|
140
|
-
rubygems_version: 3.1.
|
162
|
+
rubygems_version: 3.1.6
|
141
163
|
signing_key:
|
142
164
|
specification_version: 4
|
143
165
|
summary: Extensible Prometheus exporter for monitoring your Sidekiq
|