sidekiq-benchmark 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +50 -0
- data/.gitignore +1 -0
- data/README.md +2 -4
- data/lib/sidekiq-benchmark/version.rb +1 -1
- data/lib/sidekiq-benchmark/worker.rb +7 -7
- data/test/lib/web_test.rb +4 -0
- data/test/test_helper.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 902591a0561ae44fdb12cd92c03fccf1777efc778e40a03a3886c7ed6775b9dd
|
4
|
+
data.tar.gz: 1b4af01f66959214362dc300fa17bfa4280e9a4d587e389738e77812efe46a76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c3d5ea526654c822157e9a1a6cafc1c81d04066ba66454bbee9f408706dcb32bdc7246e52b8fb3741afc01985e774b633b9c808745b4427524757752a7ba33f
|
7
|
+
data.tar.gz: d2c362f685871a55ca3bae38014f74bc75bbdcc1f0b33a462692e0e1c40dc807743a3f6efe74ed2ecb6faca88e3efb55901f0407e611f248d281be838b2cb010
|
@@ -0,0 +1,50 @@
|
|
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-2:
|
33
|
+
runs-on: ubuntu-latest
|
34
|
+
container: ruby:2
|
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: run tests
|
48
|
+
run: bundle exec rake test
|
49
|
+
env:
|
50
|
+
REDIS_HOST: redis
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Sidekiq::Benchmark
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/sidekiq-benchmark.
|
3
|
-
[![
|
4
|
-
[![Build Status](https://travis-ci.org/kosmatov/sidekiq-benchmark.png)](https://travis-ci.org/kosmatov/sidekiq-benchmark)
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/kosmatov/sidekiq-benchmark/badge.png?branch=master)](https://coveralls.io/r/kosmatov/sidekiq-benchmark)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/sidekiq-benchmark.svg)](https://badge.fury.io/rb/sidekiq-benchmark)
|
3
|
+
[![Ruby](https://github.com/kosmatov/sidekiq-benchmark/actions/workflows/ruby.yml/badge.svg)](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.
|
@@ -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
|
90
|
+
transaction.hset redis_keys[:total], "finish_time", finish_time
|
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/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
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.2
|
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-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -129,6 +129,7 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".github/workflows/ruby.yml"
|
132
133
|
- ".gitignore"
|
133
134
|
- Gemfile
|
134
135
|
- LICENSE.txt
|
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
166
|
- !ruby/object:Gem::Version
|
166
167
|
version: '0'
|
167
168
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.3.7
|
169
170
|
signing_key:
|
170
171
|
specification_version: 4
|
171
172
|
summary: Adds benchmarking methods to Sidekiq workers, keeps metrics and adds tab
|