sidekiq-benchmark 0.7.1 → 0.7.3
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/ruby.yml +71 -0
- data/.gitignore +1 -0
- data/Appraisals +7 -0
- data/Gemfile +2 -0
- data/README.md +5 -13
- data/lib/sidekiq-benchmark/version.rb +1 -1
- data/lib/sidekiq-benchmark/worker.rb +7 -7
- data/sidekiq-benchmark.gemspec +1 -0
- data/test/lib/web_test.rb +4 -0
- data/test/test_helper.rb +9 -8
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05ca155712f4d25af211627b1d7676b41ddff6c34e29d2c396607508d7959aa7
|
4
|
+
data.tar.gz: 8d458d2b8642b44e45aea45ecca27dd5136f0436c43e3ce9097d705b6fd54254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aabb9212f2477a564a59b45eb73d4c8d59de726db640118615d99d6f30269e14912d55b7cb5d6890d3e16fadb8ceca675f568574d8f1c8c3e0d4dc37b259e0f3
|
7
|
+
data.tar.gz: 9b16419856878d0377e97413e0fdb18642c23fcdb84eaf35a081fe9b7a1e36535a69a99cc6102639ecf1dc457dc9d3e81e4fd8ec7365dea0eaaece158fbd695d
|
@@ -0,0 +1,71 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
ruby-latest:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
container: ruby:latest
|
16
|
+
services:
|
17
|
+
redis:
|
18
|
+
image: redis
|
19
|
+
options: >-
|
20
|
+
--health-cmd "redis-cli ping"
|
21
|
+
--health-interval 10s
|
22
|
+
--health-timeout 5s
|
23
|
+
--health-retries 5
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v3
|
26
|
+
- name: bundle install
|
27
|
+
run: bundle install
|
28
|
+
- name: run tests
|
29
|
+
run: bundle exec rake test
|
30
|
+
env:
|
31
|
+
REDIS_HOST: redis
|
32
|
+
ruby-latest-sidekiq-6:
|
33
|
+
runs-on: ubuntu-latest
|
34
|
+
container: ruby:latest
|
35
|
+
services:
|
36
|
+
redis:
|
37
|
+
image: redis
|
38
|
+
options: >-
|
39
|
+
--health-cmd "redis-cli ping"
|
40
|
+
--health-interval 10s
|
41
|
+
--health-timeout 5s
|
42
|
+
--health-retries 5
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@v3
|
45
|
+
- name: bundle install
|
46
|
+
run: bundle install
|
47
|
+
- name: appraisal install
|
48
|
+
run: bundle exec appraisal install
|
49
|
+
- name: run tests
|
50
|
+
run: bundle exec appraisal sidekiq-6 rake test
|
51
|
+
env:
|
52
|
+
REDIS_HOST: redis
|
53
|
+
ruby-2:
|
54
|
+
runs-on: ubuntu-latest
|
55
|
+
container: ruby:2
|
56
|
+
services:
|
57
|
+
redis:
|
58
|
+
image: redis
|
59
|
+
options: >-
|
60
|
+
--health-cmd "redis-cli ping"
|
61
|
+
--health-interval 10s
|
62
|
+
--health-timeout 5s
|
63
|
+
--health-retries 5
|
64
|
+
steps:
|
65
|
+
- uses: actions/checkout@v3
|
66
|
+
- name: bundle install
|
67
|
+
run: bundle install
|
68
|
+
- name: run tests
|
69
|
+
run: bundle exec rake test
|
70
|
+
env:
|
71
|
+
REDIS_HOST: redis
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Sidekiq::Benchmark
|
2
|
-
[](https://travis-ci.org/kosmatov/sidekiq-benchmark)
|
5
|
-
[](https://coveralls.io/r/kosmatov/sidekiq-benchmark)
|
2
|
+
[](https://badge.fury.io/rb/sidekiq-benchmark)
|
3
|
+
[](https://github.com/kosmatov/sidekiq-benchmark/actions/workflows/ruby.yml)
|
6
4
|
|
7
5
|
Adds benchmarking methods to
|
8
6
|
[Sidekiq](https://github.com/mperham/sidekiq) workers, keeps metrics and adds tab to Web UI to let you browse them.
|
@@ -15,11 +13,9 @@ Add this line to your application's Gemfile:
|
|
15
13
|
|
16
14
|
And then execute:
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
From version 0.5.0 works with Sidekiq 4.2 or newer
|
16
|
+
```shell
|
17
|
+
bundle
|
18
|
+
```
|
23
19
|
|
24
20
|
## Usage
|
25
21
|
|
@@ -71,10 +67,6 @@ end
|
|
71
67
|
|
72
68
|

|
73
69
|
|
74
|
-
### Sample Apps
|
75
|
-
|
76
|
-
[Heroku App](http://sidekiq-benchmark.herokuapp.com/benchmarks/generate)
|
77
|
-
|
78
70
|
## Testing sidekiq workers
|
79
71
|
|
80
72
|
When you use [Sidekiq::Testing](https://github.com/mperham/sidekiq/wiki/Testing) you
|
@@ -79,18 +79,18 @@ module Sidekiq
|
|
79
79
|
job_time_key = @metrics[:job_time].round(1)
|
80
80
|
|
81
81
|
Sidekiq.redis do |conn|
|
82
|
-
conn.multi do
|
82
|
+
conn.multi do |transaction|
|
83
83
|
@metrics.each do |key, value|
|
84
|
-
|
84
|
+
transaction.hincrbyfloat redis_keys[:total], key, value
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
transaction.hincrby redis_keys[:stats], job_time_key, 1
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
transaction.hsetnx redis_keys[:total], "start_time", start_time.to_s
|
90
|
+
transaction.hset redis_keys[:total], "finish_time", finish_time.to_s
|
91
91
|
|
92
|
-
|
93
|
-
|
92
|
+
transaction.expire redis_keys[:stats], REDIS_KEYS_TTL
|
93
|
+
transaction.expire redis_keys[:total], REDIS_KEYS_TTL
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/sidekiq-benchmark.gemspec
CHANGED
data/test/lib/web_test.rb
CHANGED
@@ -3,6 +3,8 @@ require 'test_helper'
|
|
3
3
|
module Sidekiq
|
4
4
|
module Benchmark
|
5
5
|
module Test
|
6
|
+
TOKEN = SecureRandom.base64(32).freeze
|
7
|
+
|
6
8
|
describe "Web extention" do
|
7
9
|
include Rack::Test::Methods
|
8
10
|
|
@@ -11,6 +13,8 @@ module Sidekiq
|
|
11
13
|
end
|
12
14
|
|
13
15
|
before do
|
16
|
+
env 'rack.session', { csrf: TOKEN }
|
17
|
+
env 'HTTP_X_CSRF_TOKEN', TOKEN
|
14
18
|
Test.flush_db
|
15
19
|
end
|
16
20
|
|
data/test/test_helper.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'minitest/pride'
|
3
3
|
|
4
|
-
require 'coveralls'
|
5
|
-
Coveralls.wear! do
|
6
|
-
add_filter '/test/'
|
7
|
-
end
|
8
|
-
|
9
4
|
ENV['RACK_ENV'] = 'test'
|
5
|
+
$TESTING = true
|
10
6
|
|
11
7
|
require 'bundler/setup'
|
12
8
|
require 'rack/test'
|
13
9
|
|
14
10
|
require 'sidekiq'
|
15
|
-
require 'sidekiq/util'
|
16
11
|
require 'sidekiq-benchmark'
|
17
12
|
|
18
13
|
require 'delorean'
|
19
14
|
require 'pry'
|
20
15
|
|
21
|
-
REDIS = Sidekiq::RedisConnection.create url: "redis://#{ENV['REDIS_HOST'] || 'localhost'}/15"
|
22
16
|
Bundler.require
|
23
17
|
|
18
|
+
Sidekiq.configure_server do |cfg|
|
19
|
+
cfg.redis = {url: "redis://#{ENV['REDIS_HOST'] || 'localhost'}/15"}
|
20
|
+
end
|
21
|
+
|
22
|
+
Sidekiq.configure_client do |cfg|
|
23
|
+
cfg.redis = {url: "redis://#{ENV['REDIS_HOST'] || 'localhost'}/15"}
|
24
|
+
end
|
25
|
+
|
24
26
|
module Sidekiq
|
25
27
|
module Benchmark
|
26
28
|
module Test
|
@@ -89,7 +91,6 @@ module Sidekiq
|
|
89
91
|
end
|
90
92
|
|
91
93
|
def self.flush_db
|
92
|
-
Sidekiq.redis = REDIS
|
93
94
|
Sidekiq.redis do |conn|
|
94
95
|
conn.flushdb
|
95
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-benchmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Kosmatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '2.1'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: appraisal
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Benchmarks for Sidekiq
|
126
140
|
email:
|
127
141
|
- key@kosmatov.ru
|
@@ -129,7 +143,9 @@ executables: []
|
|
129
143
|
extensions: []
|
130
144
|
extra_rdoc_files: []
|
131
145
|
files:
|
146
|
+
- ".github/workflows/ruby.yml"
|
132
147
|
- ".gitignore"
|
148
|
+
- Appraisals
|
133
149
|
- Gemfile
|
134
150
|
- LICENSE.txt
|
135
151
|
- README.md
|
@@ -165,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
181
|
- !ruby/object:Gem::Version
|
166
182
|
version: '0'
|
167
183
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
184
|
+
rubygems_version: 3.3.26
|
169
185
|
signing_key:
|
170
186
|
specification_version: 4
|
171
187
|
summary: Adds benchmarking methods to Sidekiq workers, keeps metrics and adds tab
|