sidekiq-statistic 1.1.0 → 1.2.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/CHANGELOG.md +42 -110
- data/README.md +16 -4
- data/lib/sidekiq/statistic/base.rb +2 -2
- data/lib/sidekiq/statistic/middleware.rb +1 -1
- data/lib/sidekiq/statistic/statistic/charts.rb +1 -1
- data/lib/sidekiq/statistic/statistic/runtime.rb +1 -0
- data/lib/sidekiq/statistic/statistic/workers.rb +2 -2
- data/lib/sidekiq/statistic/version.rb +1 -1
- data/lib/sidekiq/statistic/views/statistic.js +5 -1
- data/sidekiq-statistic.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 204eadc3fb3cee1ccf67c444c6d605bcbf605071
|
|
4
|
+
data.tar.gz: 0fccef486519aa0e2d83768f799489cd84526401
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd21216040203ef9fbe3d119f246635e22b58a0593b35055ca4e6d26e9bbb553170710f76afd73cad262576ebef37d60ffcf6ec2e0480eebc5c6a60f4801d381
|
|
7
|
+
data.tar.gz: 7a84e030ce3dd3820e9b4c428c4f3a052b91409026eeb29d29513ff23ce5866af808d0d3c0cf88ab04ce685f42fde21908ce22b51b82ea5cb2b63f1d05f9f9da
|
data/CHANGELOG.md
CHANGED
|
@@ -1,115 +1,47 @@
|
|
|
1
1
|
## HEAD
|
|
2
2
|
|
|
3
|
-
## v1.
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
*Anton Davydov*
|
|
10
|
-
* 25.08.2015: Italian localization
|
|
11
|
-
|
|
12
|
-
*Fabio Napoleoni*
|
|
13
|
-
* 25.08.2015: Fix worker naming for AJ mailers (fix #59)
|
|
14
|
-
|
|
15
|
-
*Anton Davydov*
|
|
16
|
-
* 21.08.2015: Use dynamic path generation for json requests (fix #56)
|
|
3
|
+
## v1.2
|
|
4
|
+
* 15.11.2015: Update gemspec to allow usage with sidekiq 4 (#83) *Felix Bünemann*
|
|
5
|
+
* 21.10.2015: Fix charts initialize and Uncaught TypeError (#70, #79) *Anton Davydov*
|
|
6
|
+
* 17.10.2015: Fix worker's per day stats (#78) *Alexander Yunin*
|
|
7
|
+
* 28.09.2015: Use strftime to ensure date string format (#77) *@stan*
|
|
8
|
+
* 02.09.2015: Sort worker names in GUI (#69) *Anton Davydov*
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* 20.08.2015: Fix statistics display for nested worker classes (#48)
|
|
27
|
-
|
|
28
|
-
*Felix Bünemann*
|
|
10
|
+
## v1.1
|
|
11
|
+
* 29.08.2015: Create custom tooltip for charts on index page (fix #63) *Anton Davydov*
|
|
12
|
+
* 26.08.2015: Add queue to workers table in index page *Anton Davydov*
|
|
13
|
+
* 25.08.2015: Italian localization *Fabio Napoleoni*
|
|
14
|
+
* 25.08.2015: Fix worker naming for AJ mailers (fix #59) *Anton Davydov*
|
|
15
|
+
* 21.08.2015: Use dynamic path generation for json requests (fix #56) *Anton Davydov*
|
|
16
|
+
* 21.08.2015: Add button in log page for display only special job (#40) *Anton Davydov*
|
|
17
|
+
* 20.08.2015: Add German Localization (#54) *Felix Bünemann*
|
|
18
|
+
* 20.08.2015: Fix statistics display for nested worker classes (#48) *Felix Bünemann*
|
|
29
19
|
|
|
30
20
|
## v1.0
|
|
31
|
-
* 19.08.2015: Middleware refactoring (#45)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* 15.07.2015: Improve integration with active job
|
|
59
|
-
|
|
60
|
-
*Anton Davydov*
|
|
61
|
-
* 01.07.2015: New realisation for thread safe history middleware
|
|
62
|
-
|
|
63
|
-
*Anton Davydov*
|
|
64
|
-
* 13.05.2015: Add ability to change any date range on any history page
|
|
65
|
-
|
|
66
|
-
*Anton Davydov*
|
|
67
|
-
* 12.05.2015: Add last job status data parameter for each worker
|
|
68
|
-
|
|
69
|
-
*Anton Davydov*
|
|
70
|
-
* 11.05.2015: Add page woth worker data table for each day
|
|
71
|
-
|
|
72
|
-
*Anton Davydov*
|
|
73
|
-
* 28.04.2015: Formating worker date in web UI
|
|
74
|
-
|
|
75
|
-
*Anton Davydov*
|
|
76
|
-
* 27.04.2015: Set specific color for any worker
|
|
77
|
-
|
|
78
|
-
*Anton Davydov*
|
|
79
|
-
* 10.04.2015: Add search field on worker page
|
|
80
|
-
|
|
81
|
-
*Anton Davydov*
|
|
82
|
-
* 04.04.2015: Fix livereload button in index page
|
|
83
|
-
|
|
84
|
-
*Anton Davydov*
|
|
85
|
-
* 23.03.2015: Add max runtime column to worker web table
|
|
86
|
-
|
|
87
|
-
*Anton Davydov*
|
|
88
|
-
* 19.03.2015: Add functionality for adding custom css and js files to web page
|
|
89
|
-
|
|
90
|
-
*Anton Davydov*
|
|
91
|
-
* 18.03.2015: Add configuration class with log_file options
|
|
92
|
-
|
|
93
|
-
*Anton Davydov*
|
|
94
|
-
* 16.03.2015: Add worker page where user can see log for this worker
|
|
95
|
-
|
|
96
|
-
*Anton Davydov*
|
|
97
|
-
* 15.03.2015: Add worker statistic table to index history page
|
|
98
|
-
|
|
99
|
-
*Anton Davydov*
|
|
100
|
-
* 08.03.2015: Add charts for each passed and failed jobs for each worker.
|
|
101
|
-
|
|
102
|
-
*Anton Davydov*
|
|
103
|
-
* 08.03.2015: Add Statistic class which provide statistics
|
|
104
|
-
for each day and each worker.
|
|
105
|
-
|
|
106
|
-
Sidekiq::History::Statistic.new(0).workers_hash
|
|
107
|
-
# =>[{"2015-03-07"=>{"HistoryWorker"=>{:failed=>1, :passed=>1}}}]
|
|
108
|
-
|
|
109
|
-
*Anton Davydov*
|
|
110
|
-
* 08.03.2015: Save in redis json with failed and passed jobs for each worker.
|
|
111
|
-
|
|
112
|
-
*Anton Davydov*
|
|
113
|
-
* 04.03.2015: Created simple midelware and static page.
|
|
114
|
-
|
|
115
|
-
*Anton Davydov*
|
|
21
|
+
* 19.08.2015: Middleware refactoring (#45) *Mike Perham*
|
|
22
|
+
* 19.08.2015: Use redis lists for save all job runtimes *Anton Davydov*
|
|
23
|
+
* 12.08.2015: Add filters (by worker) for realtime charts *Anton Davydov*
|
|
24
|
+
* 11.08.2015: Realtime chart for each worker and job *Anton Davydov*
|
|
25
|
+
* 31.07.2015: Add JSON API *Anton Davydov*
|
|
26
|
+
* 29.07.2015: Add localizations for plugin *Anton Davydov*
|
|
27
|
+
* 28.07.2015: Read first 1_000 lines from changelog *Anton Davydov*
|
|
28
|
+
* 28.07.2015: Rename plugin to sidekiq-statistic *Anton Davydov*
|
|
29
|
+
* 23.07.2015: Use native redis hash instead json serialization *Anton Davydov*
|
|
30
|
+
* 15.07.2015: Improve integration with active job *Anton Davydov*
|
|
31
|
+
* 01.07.2015: New realisation for thread safe history middleware *Anton Davydov*
|
|
32
|
+
* 13.05.2015: Add ability to change any date range on any history page *Anton Davydov*
|
|
33
|
+
* 12.05.2015: Add last job status data parameter for each worker *Anton Davydov*
|
|
34
|
+
* 11.05.2015: Add page woth worker data table for each day *Anton Davydov*
|
|
35
|
+
* 28.04.2015: Formating worker date in web UI *Anton Davydov*
|
|
36
|
+
* 27.04.2015: Set specific color for any worker *Anton Davydov*
|
|
37
|
+
* 10.04.2015: Add search field on worker page *Anton Davydov*
|
|
38
|
+
* 04.04.2015: Fix livereload button in index page *Anton Davydov*
|
|
39
|
+
* 23.03.2015: Add max runtime column to worker web table *Anton Davydov*
|
|
40
|
+
* 19.03.2015: Add functionality for adding custom css and js files to web page *Anton Davydov*
|
|
41
|
+
* 18.03.2015: Add configuration class with log_file options *Anton Davydov*
|
|
42
|
+
* 16.03.2015: Add worker page where user can see log for this worker *Anton Davydov*
|
|
43
|
+
* 15.03.2015: Add worker statistic table to index history page *Anton Davydov*
|
|
44
|
+
* 08.03.2015: Add charts for each passed and failed jobs for each worker. *Anton Davydov*
|
|
45
|
+
* 08.03.2015: Add Statistic class which provide statistics for each day and each worker. *Anton Davydov*
|
|
46
|
+
* 08.03.2015: Save in redis json with failed and passed jobs for each worker. *Anton Davydov*
|
|
47
|
+
* 04.03.2015: Created simple midelware and static page. *Anton Davydov*
|
data/README.md
CHANGED
|
@@ -28,12 +28,11 @@ And then execute:
|
|
|
28
28
|
$ bundle
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
|
-
Open
|
|
31
|
+
Open Statistic tab on your sidekiq page.
|
|
32
32
|
|
|
33
33
|
### Not rails application
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Second step: add `require 'sidekiq-statistic'` to you `config.ru`. For example:
|
|
34
|
+
Read [sidekiq documentation](https://github.com/mperham/sidekiq/wiki/Monitoring#standalone).
|
|
35
|
+
After that add `require 'sidekiq-statistic'` to you `config.ru`. For example:
|
|
37
36
|
``` ruby
|
|
38
37
|
# config.ru
|
|
39
38
|
require 'sidekiq/web'
|
|
@@ -124,6 +123,19 @@ $ curl http://example.com/sidekiq/api/statistic/Worker.json?dateFrom=2015-07-30&
|
|
|
124
123
|
}
|
|
125
124
|
```
|
|
126
125
|
|
|
126
|
+
## Update statistic inside middleware
|
|
127
|
+
You can update your worker statistic inside middleware. For this you should to update `sidekiq:statistic` redis hash.
|
|
128
|
+
This hash has the following structure:
|
|
129
|
+
* `sideki:statistic` - redis hash with all statistic
|
|
130
|
+
- `yyyy-mm-dd:WorkerName:passed` - count of passed jobs for Worker name on yyyy-mm-dd
|
|
131
|
+
- `yyyy-mm-dd:WorkerName:failed` - count of failed jobs for Worker name on yyyy-mm-dd
|
|
132
|
+
- `yyyy-mm-dd:WorkerName:failed` - count of failed jobs for Worker name on yyyy-mm-dd
|
|
133
|
+
- `yyyy-mm-dd:WorkerName:last_job_status` - string with status (`passed` or `failed`) for last job
|
|
134
|
+
- `yyyy-mm-dd:WorkerName:last_time` - date of lact job performing
|
|
135
|
+
- `yyyy-mm-dd:WorkerName:queue` - name of job queue (`defauld` by default)
|
|
136
|
+
|
|
137
|
+
For time information you should push the runtime value to `yyyy-mm-dd:WorkerName:timeslist` redis list.
|
|
138
|
+
|
|
127
139
|
## How it works
|
|
128
140
|

|
|
129
141
|
|
|
@@ -13,7 +13,7 @@ module Sidekiq
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def worker_names
|
|
16
|
-
@worker_names ||= statistic_hash.flat_map{ |h| h.values.first.keys }.uniq
|
|
16
|
+
@worker_names ||= statistic_hash.flat_map{ |h| h.values.first.keys }.uniq.sort
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def statistic_hash
|
|
@@ -41,7 +41,7 @@ module Sidekiq
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def desired_dates
|
|
44
|
-
(@end_date..@start_date).map
|
|
44
|
+
(@end_date..@start_date).map { |date| date.strftime "%Y-%m-%d" }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def result_hash(redis_hash, key)
|
|
@@ -29,7 +29,7 @@ module Sidekiq
|
|
|
29
29
|
status = worker_status.dup
|
|
30
30
|
time = worker_status[:last_runtime]
|
|
31
31
|
realtime_hash = "#{REDIS_HASH}:realtime:#{time.sec}"
|
|
32
|
-
worker_key = "#{time.
|
|
32
|
+
worker_key = "#{time.strftime "%Y-%m-%d"}:#{status.delete :class}"
|
|
33
33
|
|
|
34
34
|
Sidekiq.redis do |redis|
|
|
35
35
|
redis.pipelined do
|
|
@@ -34,9 +34,9 @@ module Sidekiq
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def runtime_for_day(worker_name, worker_data)
|
|
37
|
-
runtime_statistic(worker_name, worker_data
|
|
37
|
+
runtime_statistic(worker_name, worker_data)
|
|
38
38
|
.values_hash
|
|
39
|
-
.merge!(last: worker_data[:
|
|
39
|
+
.merge!(last: worker_data[:last_time])
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def number_of_calls(worker)
|
|
@@ -61,7 +61,7 @@ $(function () {
|
|
|
61
61
|
|
|
62
62
|
var datePickerFrom, datePickerTo
|
|
63
63
|
initializeDatePickers()
|
|
64
|
-
initializeChars({})
|
|
64
|
+
if (isHaveCharts()) { initializeChars({}) }
|
|
65
65
|
|
|
66
66
|
$(document).on('click', '#live-poll', function (e) {
|
|
67
67
|
e.preventDefault()
|
|
@@ -174,6 +174,10 @@ $(function () {
|
|
|
174
174
|
})
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
function isHaveCharts() {
|
|
178
|
+
return document.getElementById("js-passed-chart") && document.getElementById("js-failed-chart")
|
|
179
|
+
}
|
|
180
|
+
|
|
177
181
|
function createChart(type, data, datasets) {
|
|
178
182
|
var ctxFailed = document.getElementById("js-" + type + "-chart").getContext("2d")
|
|
179
183
|
|
data/sidekiq-statistic.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
|
19
19
|
gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
20
|
gem.require_paths = ['lib']
|
|
21
21
|
|
|
22
|
-
gem.add_dependency 'sidekiq', '
|
|
22
|
+
gem.add_dependency 'sidekiq', '>= 3.3.4', '< 5'
|
|
23
23
|
|
|
24
24
|
gem.add_development_dependency 'rake', '~> 0'
|
|
25
25
|
gem.add_development_dependency 'sinatra', '~> 1.4.6'
|
metadata
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sidekiq-statistic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anton Davydov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sidekiq
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '3.3'
|
|
20
17
|
- - ">="
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
19
|
version: 3.3.4
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '5'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '3.3'
|
|
30
27
|
- - ">="
|
|
31
28
|
- !ruby/object:Gem::Version
|
|
32
29
|
version: 3.3.4
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: rake
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|