sidekiq-retry-summary 0.0.2
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 +7 -0
- data/lib/sidekiq_retry_summary.rb +101 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b06e59ea18f2484364cf33b659efb4f74576ad5e
|
4
|
+
data.tar.gz: 4ff8b546ed46bf0be74f3fbd3b6750f32b8c9114
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1386b347e2f84105bcbd8c404c6f1ccaef15749a1d999c5ba503cc082faa47588efc25210fa58605c744878f37f0178208dbd210fcc0930d452da3b416301dc6
|
7
|
+
data.tar.gz: 27c63d8f12b2d139017876c9a80735fd8214d3f0a5a3ef0c16560f104b62879159a264e7cfa6dd705ef1e7f808a5fe9d1644bf47e25ce119532966fa663367f7
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sidekiq
|
4
|
+
class WebApplication
|
5
|
+
get '/retry_summary' do
|
6
|
+
@retry_groups = Sidekiq::RetrySet.new.inject(Hash.new(0)) do |hash,job|
|
7
|
+
general_error_message =
|
8
|
+
job['error_message'].gsub(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,'<ID>').
|
9
|
+
gsub(/\d+/, '<ID>')
|
10
|
+
|
11
|
+
hash[[job['class'], general_error_message]] += 1
|
12
|
+
|
13
|
+
hash
|
14
|
+
end.to_a.sort_by(&:last).reverse.map do |retry_group|
|
15
|
+
OpenStruct.new(
|
16
|
+
job_name: retry_group[0][0],
|
17
|
+
error_message: retry_group[0][1],
|
18
|
+
count: retry_group[1]
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
template = <<-TEMPLATE
|
23
|
+
<header class="row">
|
24
|
+
<div class="col-sm-5">
|
25
|
+
<h3><%= t('Retry Summary') %></h3>
|
26
|
+
</div>
|
27
|
+
</header>
|
28
|
+
|
29
|
+
<form action="<%= root_path %>retries" method="post">
|
30
|
+
<%= csrf_tag %>
|
31
|
+
<div class="table_container">
|
32
|
+
<table class="table table-striped table-bordered table-white">
|
33
|
+
<thead>
|
34
|
+
<tr>
|
35
|
+
<th>Count Rank</th>
|
36
|
+
<th><%= t('Job') %></th>
|
37
|
+
<th><%= t('Error') %></th>
|
38
|
+
<th><%= t('Count') %></th>
|
39
|
+
<% if defined?(Sidekiq::Pro) %>
|
40
|
+
<th><%= t('View') %></th>
|
41
|
+
<th><%= t('Jira Ticket') %></th>
|
42
|
+
<% end %>
|
43
|
+
</tr>
|
44
|
+
</thead>
|
45
|
+
<% @retry_groups.each_with_index do |group, i| %>
|
46
|
+
<tr>
|
47
|
+
<td><%= i + 1 %></td>
|
48
|
+
<td><%= group.job_name %></td>
|
49
|
+
<td>
|
50
|
+
<div><%= h message=truncate(group.error_message, 200) %></div>
|
51
|
+
</td>
|
52
|
+
<td><%= group.count %></td>
|
53
|
+
<% if defined?(Sidekiq::Pro) %>
|
54
|
+
<td>
|
55
|
+
<%view_url = "\#{root_path}filter/retries?substr=\#{CGI.escape(group.error_message.split(/<ID>|"|'|,|:/).sort_by(&:length).last)}" %>
|
56
|
+
<a href= "<%=view_url%>" target='_blank'>View</a>
|
57
|
+
</td>
|
58
|
+
<% end %>
|
59
|
+
<td>
|
60
|
+
<a href="https://jira.groupondev.com/secure/CreateIssueDetails!init.jspa?pid=17949&issuetype=1&summary=Failed Jobs(<%=group.count%>): <%=CGI.escape message%>&description=<%=CGI.escape "https://cloadmin.groupondev.com\#{view_url}" %>&customfield_12000=key:CLO-3991&priority=4" target='_blank'>Create</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
<% end %>
|
64
|
+
</table>
|
65
|
+
</div>
|
66
|
+
</form>
|
67
|
+
TEMPLATE
|
68
|
+
|
69
|
+
render(:erb, template)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
module Sidekiq
|
75
|
+
class Web
|
76
|
+
DEFAULT_TABS = {
|
77
|
+
"Dashboard" => '',
|
78
|
+
"Busy" => 'busy',
|
79
|
+
"Queues" => 'queues',
|
80
|
+
"Retries" => 'retries',
|
81
|
+
"Retry Summary" => 'retry_summary',
|
82
|
+
"Scheduled" => 'scheduled',
|
83
|
+
"Dead" => 'morgue'
|
84
|
+
}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
module Sidekiq
|
89
|
+
class WebApplication
|
90
|
+
if defined?(Sidekiq::Pro)
|
91
|
+
get '/filter/retries' do
|
92
|
+
x = params[:substr]
|
93
|
+
return redirect "#{root_path}retries" unless x && x != ''
|
94
|
+
|
95
|
+
@retries = search(Sidekiq::RetrySet.new, params[:substr])[0..100]
|
96
|
+
|
97
|
+
erb :retries
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sidekiq-retry-summary
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Zhang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sidekiq
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
description: You get break down of retry queue by error messages and also direct link
|
28
|
+
to view a list of identical errors
|
29
|
+
email: benzhangpro@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/sidekiq_retry_summary.rb
|
35
|
+
homepage: http://rubygems.org/gems/sidekiq-retry-summary
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.6.12
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Adds summary page for retry queue to give you error count break down.
|
59
|
+
test_files: []
|