sidekiq 5.2.10 → 6.5.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes.md +422 -1
- data/LICENSE +3 -3
- data/README.md +24 -35
- data/bin/sidekiq +27 -3
- data/bin/sidekiqload +79 -67
- data/bin/sidekiqmon +8 -0
- data/lib/generators/sidekiq/job_generator.rb +57 -0
- data/lib/generators/sidekiq/templates/{worker.rb.erb → job.rb.erb} +2 -2
- data/lib/generators/sidekiq/templates/{worker_spec.rb.erb → job_spec.rb.erb} +1 -1
- data/lib/generators/sidekiq/templates/{worker_test.rb.erb → job_test.rb.erb} +1 -1
- data/lib/sidekiq/api.rb +527 -310
- data/lib/sidekiq/cli.rb +204 -208
- data/lib/sidekiq/client.rb +78 -82
- data/lib/sidekiq/component.rb +65 -0
- data/lib/sidekiq/delay.rb +8 -7
- data/lib/sidekiq/extensions/action_mailer.rb +13 -22
- data/lib/sidekiq/extensions/active_record.rb +13 -10
- data/lib/sidekiq/extensions/class_methods.rb +14 -11
- data/lib/sidekiq/extensions/generic_proxy.rb +7 -5
- data/lib/sidekiq/fetch.rb +50 -40
- data/lib/sidekiq/job.rb +13 -0
- data/lib/sidekiq/job_logger.rb +33 -7
- data/lib/sidekiq/job_retry.rb +126 -106
- data/lib/sidekiq/job_util.rb +71 -0
- data/lib/sidekiq/launcher.rb +177 -83
- data/lib/sidekiq/logger.rb +156 -0
- data/lib/sidekiq/manager.rb +40 -41
- data/lib/sidekiq/metrics/deploy.rb +47 -0
- data/lib/sidekiq/metrics/query.rb +153 -0
- data/lib/sidekiq/metrics/shared.rb +94 -0
- data/lib/sidekiq/metrics/tracking.rb +134 -0
- data/lib/sidekiq/middleware/chain.rb +102 -46
- data/lib/sidekiq/middleware/current_attributes.rb +63 -0
- data/lib/sidekiq/middleware/i18n.rb +7 -7
- data/lib/sidekiq/middleware/modules.rb +21 -0
- data/lib/sidekiq/monitor.rb +133 -0
- data/lib/sidekiq/paginator.rb +28 -16
- data/lib/sidekiq/processor.rb +104 -97
- data/lib/sidekiq/rails.rb +46 -37
- data/lib/sidekiq/redis_client_adapter.rb +154 -0
- data/lib/sidekiq/redis_connection.rb +108 -77
- data/lib/sidekiq/ring_buffer.rb +29 -0
- data/lib/sidekiq/scheduled.rb +105 -42
- data/lib/sidekiq/sd_notify.rb +149 -0
- data/lib/sidekiq/systemd.rb +24 -0
- data/lib/sidekiq/testing/inline.rb +6 -5
- data/lib/sidekiq/testing.rb +68 -58
- data/lib/sidekiq/transaction_aware_client.rb +45 -0
- data/lib/sidekiq/version.rb +2 -1
- data/lib/sidekiq/web/action.rb +15 -11
- data/lib/sidekiq/web/application.rb +103 -77
- data/lib/sidekiq/web/csrf_protection.rb +180 -0
- data/lib/sidekiq/web/helpers.rb +125 -95
- data/lib/sidekiq/web/router.rb +23 -19
- data/lib/sidekiq/web.rb +65 -105
- data/lib/sidekiq/worker.rb +259 -109
- data/lib/sidekiq.rb +170 -62
- data/sidekiq.gemspec +23 -16
- data/web/assets/images/apple-touch-icon.png +0 -0
- data/web/assets/javascripts/application.js +113 -61
- data/web/assets/javascripts/chart.min.js +13 -0
- data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
- data/web/assets/javascripts/dashboard.js +53 -89
- data/web/assets/javascripts/graph.js +16 -0
- data/web/assets/javascripts/metrics.js +262 -0
- data/web/assets/stylesheets/application-dark.css +143 -0
- data/web/assets/stylesheets/application-rtl.css +0 -4
- data/web/assets/stylesheets/application.css +88 -233
- data/web/locales/ar.yml +8 -2
- data/web/locales/de.yml +14 -2
- data/web/locales/el.yml +43 -19
- data/web/locales/en.yml +13 -1
- data/web/locales/es.yml +18 -2
- data/web/locales/fr.yml +10 -3
- data/web/locales/ja.yml +14 -1
- data/web/locales/lt.yml +83 -0
- data/web/locales/pl.yml +4 -4
- data/web/locales/pt-br.yml +27 -9
- data/web/locales/ru.yml +4 -0
- data/web/locales/vi.yml +83 -0
- data/web/locales/zh-cn.yml +36 -11
- data/web/locales/zh-tw.yml +32 -7
- data/web/views/_footer.erb +1 -1
- data/web/views/_job_info.erb +3 -2
- data/web/views/_nav.erb +1 -1
- data/web/views/_poll_link.erb +2 -5
- data/web/views/_summary.erb +7 -7
- data/web/views/busy.erb +61 -22
- data/web/views/dashboard.erb +23 -14
- data/web/views/dead.erb +3 -3
- data/web/views/layout.erb +3 -1
- data/web/views/metrics.erb +69 -0
- data/web/views/metrics_for_job.erb +87 -0
- data/web/views/morgue.erb +9 -6
- data/web/views/queue.erb +23 -10
- data/web/views/queues.erb +10 -2
- data/web/views/retries.erb +11 -8
- data/web/views/retry.erb +3 -3
- data/web/views/scheduled.erb +5 -2
- metadata +58 -63
- data/.circleci/config.yml +0 -61
- data/.github/contributing.md +0 -32
- data/.github/issue_template.md +0 -11
- data/.gitignore +0 -15
- data/.travis.yml +0 -11
- data/3.0-Upgrade.md +0 -70
- data/4.0-Upgrade.md +0 -53
- data/5.0-Upgrade.md +0 -56
- data/COMM-LICENSE +0 -97
- data/Ent-Changes.md +0 -238
- data/Gemfile +0 -19
- data/Pro-2.0-Upgrade.md +0 -138
- data/Pro-3.0-Upgrade.md +0 -44
- data/Pro-4.0-Upgrade.md +0 -35
- data/Pro-Changes.md +0 -759
- data/Rakefile +0 -9
- data/bin/sidekiqctl +0 -20
- data/code_of_conduct.md +0 -50
- data/lib/generators/sidekiq/worker_generator.rb +0 -49
- data/lib/sidekiq/core_ext.rb +0 -1
- data/lib/sidekiq/ctl.rb +0 -221
- data/lib/sidekiq/exception_handler.rb +0 -29
- data/lib/sidekiq/logging.rb +0 -122
- data/lib/sidekiq/middleware/server/active_record.rb +0 -23
- data/lib/sidekiq/util.rb +0 -66
@@ -0,0 +1,262 @@
|
|
1
|
+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
2
|
+
Chart.defaults.borderColor = "#333"
|
3
|
+
Chart.defaults.color = "#aaa"
|
4
|
+
}
|
5
|
+
|
6
|
+
class BaseChart {
|
7
|
+
constructor(id, options) {
|
8
|
+
this.ctx = document.getElementById(id);
|
9
|
+
this.options = options
|
10
|
+
this.fallbackColor = "#999";
|
11
|
+
this.colors = [
|
12
|
+
// Colors taken from https://www.chartjs.org/docs/latest/samples/utils.html
|
13
|
+
"#537bc4",
|
14
|
+
"#4dc9f6",
|
15
|
+
"#f67019",
|
16
|
+
"#f53794",
|
17
|
+
"#acc236",
|
18
|
+
"#166a8f",
|
19
|
+
"#00a950",
|
20
|
+
"#58595b",
|
21
|
+
"#8549ba",
|
22
|
+
"#991b1b",
|
23
|
+
];
|
24
|
+
|
25
|
+
this.chart = new Chart(this.ctx, {
|
26
|
+
type: this.options.chartType,
|
27
|
+
data: { labels: this.options.labels, datasets: this.datasets },
|
28
|
+
options: this.chartOptions,
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
addMarksToChart() {
|
33
|
+
this.options.marks.forEach(([bucket, label], i) => {
|
34
|
+
this.chart.options.plugins.annotation.annotations[`deploy-${i}`] = {
|
35
|
+
type: "line",
|
36
|
+
xMin: bucket,
|
37
|
+
xMax: bucket,
|
38
|
+
borderColor: "rgba(220, 38, 38, 0.4)",
|
39
|
+
borderWidth: 2,
|
40
|
+
};
|
41
|
+
});
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
class JobMetricsOverviewChart extends BaseChart {
|
46
|
+
constructor(id, options) {
|
47
|
+
super(id, { ...options, chartType: "line" });
|
48
|
+
this.swatches = [];
|
49
|
+
|
50
|
+
this.addMarksToChart();
|
51
|
+
this.chart.update();
|
52
|
+
}
|
53
|
+
|
54
|
+
registerSwatch(id) {
|
55
|
+
const el = document.getElementById(id);
|
56
|
+
el.onchange = () => this.toggle(el.value, el.checked);
|
57
|
+
this.swatches[el.value] = el;
|
58
|
+
this.updateSwatch(el.value);
|
59
|
+
}
|
60
|
+
|
61
|
+
updateSwatch(kls) {
|
62
|
+
const el = this.swatches[kls];
|
63
|
+
const ds = this.chart.data.datasets.find((ds) => ds.label == kls);
|
64
|
+
el.checked = !!ds;
|
65
|
+
el.style.color = ds ? ds.borderColor : null;
|
66
|
+
}
|
67
|
+
|
68
|
+
toggle(kls, visible) {
|
69
|
+
if (visible) {
|
70
|
+
this.chart.data.datasets.push(this.dataset(kls));
|
71
|
+
} else {
|
72
|
+
const i = this.chart.data.datasets.findIndex((ds) => ds.label == kls);
|
73
|
+
this.colors.unshift(this.chart.data.datasets[i].borderColor);
|
74
|
+
this.chart.data.datasets.splice(i, 1);
|
75
|
+
}
|
76
|
+
|
77
|
+
this.updateSwatch(kls);
|
78
|
+
this.chart.update();
|
79
|
+
}
|
80
|
+
|
81
|
+
dataset(kls) {
|
82
|
+
const color = this.colors.shift() || this.fallbackColor;
|
83
|
+
|
84
|
+
return {
|
85
|
+
label: kls,
|
86
|
+
data: this.options.series[kls],
|
87
|
+
borderColor: color,
|
88
|
+
backgroundColor: color,
|
89
|
+
borderWidth: 2,
|
90
|
+
pointRadius: 2,
|
91
|
+
};
|
92
|
+
}
|
93
|
+
|
94
|
+
get datasets() {
|
95
|
+
return Object.entries(this.options.series)
|
96
|
+
.filter(([kls, _]) => this.options.visible.includes(kls))
|
97
|
+
.map(([kls, _]) => this.dataset(kls));
|
98
|
+
}
|
99
|
+
|
100
|
+
get chartOptions() {
|
101
|
+
return {
|
102
|
+
aspectRatio: 4,
|
103
|
+
scales: {
|
104
|
+
y: {
|
105
|
+
beginAtZero: true,
|
106
|
+
title: {
|
107
|
+
text: "Total execution time (sec)",
|
108
|
+
display: true,
|
109
|
+
},
|
110
|
+
},
|
111
|
+
},
|
112
|
+
interaction: {
|
113
|
+
mode: "x",
|
114
|
+
},
|
115
|
+
plugins: {
|
116
|
+
legend: {
|
117
|
+
display: false,
|
118
|
+
},
|
119
|
+
tooltip: {
|
120
|
+
callbacks: {
|
121
|
+
title: (items) => `${items[0].label} UTC`,
|
122
|
+
label: (item) =>
|
123
|
+
`${item.dataset.label}: ${item.parsed.y.toFixed(1)} seconds`,
|
124
|
+
footer: (items) => {
|
125
|
+
const bucket = items[0].label;
|
126
|
+
const marks = this.options.marks.filter(([b, _]) => b == bucket);
|
127
|
+
return marks.map(([b, msg]) => `Deploy: ${msg}`);
|
128
|
+
},
|
129
|
+
},
|
130
|
+
},
|
131
|
+
},
|
132
|
+
};
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
class HistTotalsChart extends BaseChart {
|
137
|
+
constructor(id, options) {
|
138
|
+
super(id, { ...options, chartType: "bar" });
|
139
|
+
}
|
140
|
+
|
141
|
+
get datasets() {
|
142
|
+
return [{
|
143
|
+
data: this.options.series,
|
144
|
+
backgroundColor: this.colors[0],
|
145
|
+
borderWidth: 0,
|
146
|
+
}];
|
147
|
+
}
|
148
|
+
|
149
|
+
get chartOptions() {
|
150
|
+
return {
|
151
|
+
aspectRatio: 6,
|
152
|
+
scales: {
|
153
|
+
y: {
|
154
|
+
beginAtZero: true,
|
155
|
+
title: {
|
156
|
+
text: "Total jobs",
|
157
|
+
display: true,
|
158
|
+
},
|
159
|
+
},
|
160
|
+
},
|
161
|
+
interaction: {
|
162
|
+
mode: "x",
|
163
|
+
},
|
164
|
+
plugins: {
|
165
|
+
legend: {
|
166
|
+
display: false,
|
167
|
+
},
|
168
|
+
tooltip: {
|
169
|
+
callbacks: {
|
170
|
+
label: (item) => `${item.parsed.y} jobs`,
|
171
|
+
},
|
172
|
+
},
|
173
|
+
},
|
174
|
+
};
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
class HistBubbleChart extends BaseChart {
|
179
|
+
constructor(id, options) {
|
180
|
+
super(id, { ...options, chartType: "bubble" });
|
181
|
+
|
182
|
+
this.addMarksToChart();
|
183
|
+
this.chart.update();
|
184
|
+
}
|
185
|
+
|
186
|
+
get datasets() {
|
187
|
+
const data = [];
|
188
|
+
let maxCount = 0;
|
189
|
+
|
190
|
+
Object.entries(this.options.hist).forEach(([bucket, hist]) => {
|
191
|
+
hist.forEach((count, histBucket) => {
|
192
|
+
if (count > 0) {
|
193
|
+
data.push({
|
194
|
+
x: bucket,
|
195
|
+
// histogram data is ordered fastest to slowest, but this.histIntervals is
|
196
|
+
// slowest to fastest (so it displays correctly on the chart).
|
197
|
+
y:
|
198
|
+
this.options.histIntervals[this.options.histIntervals.length - 1 - histBucket] /
|
199
|
+
1000,
|
200
|
+
count: count,
|
201
|
+
});
|
202
|
+
|
203
|
+
if (count > maxCount) maxCount = count;
|
204
|
+
}
|
205
|
+
});
|
206
|
+
});
|
207
|
+
|
208
|
+
// Chart.js will not calculate the bubble size. We have to do that.
|
209
|
+
const maxRadius = this.ctx.offsetWidth / this.options.labels.length;
|
210
|
+
const minRadius = 1
|
211
|
+
const multiplier = (maxRadius / maxCount) * 1.5;
|
212
|
+
data.forEach((entry) => {
|
213
|
+
entry.r = entry.count * multiplier + minRadius;
|
214
|
+
});
|
215
|
+
|
216
|
+
return [{
|
217
|
+
data: data,
|
218
|
+
backgroundColor: "#537bc4",
|
219
|
+
borderColor: "#537bc4",
|
220
|
+
}];
|
221
|
+
}
|
222
|
+
|
223
|
+
get chartOptions() {
|
224
|
+
return {
|
225
|
+
aspectRatio: 3,
|
226
|
+
scales: {
|
227
|
+
x: {
|
228
|
+
type: "category",
|
229
|
+
labels: this.options.labels,
|
230
|
+
},
|
231
|
+
y: {
|
232
|
+
title: {
|
233
|
+
text: "Execution time (sec)",
|
234
|
+
display: true,
|
235
|
+
},
|
236
|
+
},
|
237
|
+
},
|
238
|
+
interaction: {
|
239
|
+
mode: "x",
|
240
|
+
},
|
241
|
+
plugins: {
|
242
|
+
legend: {
|
243
|
+
display: false,
|
244
|
+
},
|
245
|
+
tooltip: {
|
246
|
+
callbacks: {
|
247
|
+
title: (items) => `${items[0].raw.x} UTC`,
|
248
|
+
label: (item) =>
|
249
|
+
`${item.parsed.y} seconds: ${item.raw.count} job${
|
250
|
+
item.raw.count == 1 ? "" : "s"
|
251
|
+
}`,
|
252
|
+
footer: (items) => {
|
253
|
+
const bucket = items[0].raw.x;
|
254
|
+
const marks = this.options.marks.filter(([b, _]) => b == bucket);
|
255
|
+
return marks.map(([b, msg]) => `Deploy: ${msg}`);
|
256
|
+
},
|
257
|
+
},
|
258
|
+
},
|
259
|
+
},
|
260
|
+
};
|
261
|
+
}
|
262
|
+
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
html, body {
|
2
|
+
background-color: #171717 !important;
|
3
|
+
color: #DEDEDE;
|
4
|
+
}
|
5
|
+
|
6
|
+
a,
|
7
|
+
.title,
|
8
|
+
.summary_bar ul .count,
|
9
|
+
span.current-interval,
|
10
|
+
.navbar .navbar-brand {
|
11
|
+
color: #d04;
|
12
|
+
}
|
13
|
+
|
14
|
+
.history-graph.active,
|
15
|
+
.beacon .dot {
|
16
|
+
background-color: #d04;
|
17
|
+
}
|
18
|
+
|
19
|
+
.navbar .navbar-brand:hover {
|
20
|
+
color: #ddd;
|
21
|
+
}
|
22
|
+
|
23
|
+
.navbar .navbar-brand .status {
|
24
|
+
color: #ddd;
|
25
|
+
}
|
26
|
+
|
27
|
+
.navbar-default .navbar-nav > li > a {
|
28
|
+
color: #ddd;
|
29
|
+
}
|
30
|
+
|
31
|
+
.navbar-inverse {
|
32
|
+
background-color: #222;
|
33
|
+
border-color: #444;
|
34
|
+
}
|
35
|
+
|
36
|
+
table {
|
37
|
+
background-color: #1D1D1D;
|
38
|
+
}
|
39
|
+
|
40
|
+
.table-striped > tbody > tr:nth-of-type(odd) {
|
41
|
+
background-color: #2E2E2E;
|
42
|
+
}
|
43
|
+
|
44
|
+
.table-bordered,
|
45
|
+
.table-bordered > tbody > tr > td,
|
46
|
+
.table-bordered > tbody > tr > th,
|
47
|
+
.table-bordered > tfoot > tr > td,
|
48
|
+
.table-bordered > tfoot > tr > th,
|
49
|
+
.table-bordered > thead > tr > td,
|
50
|
+
.table-bordered > thead > tr > th {
|
51
|
+
border: 1px solid #444;
|
52
|
+
}
|
53
|
+
|
54
|
+
.table-hover > tbody > tr:hover {
|
55
|
+
background-color: #444;
|
56
|
+
}
|
57
|
+
|
58
|
+
.alert {
|
59
|
+
border: none;
|
60
|
+
color: #ddd;
|
61
|
+
}
|
62
|
+
|
63
|
+
.alert-success {
|
64
|
+
background-color: #484;
|
65
|
+
}
|
66
|
+
|
67
|
+
.alert-danger {
|
68
|
+
background-color: #980035;
|
69
|
+
}
|
70
|
+
|
71
|
+
.alert-info {
|
72
|
+
background-color: #31708f;
|
73
|
+
}
|
74
|
+
|
75
|
+
a:link, a:active, a:hover, a:visited {
|
76
|
+
color: #ddd;
|
77
|
+
}
|
78
|
+
|
79
|
+
input {
|
80
|
+
background-color: #444;
|
81
|
+
color: #ccc;
|
82
|
+
padding: 3px;
|
83
|
+
}
|
84
|
+
|
85
|
+
.summary_bar .summary {
|
86
|
+
background-color: #232323;
|
87
|
+
border: 1px solid #444;
|
88
|
+
}
|
89
|
+
|
90
|
+
.navbar-default {
|
91
|
+
background-color: #0F0F0F;
|
92
|
+
border-color: #444;
|
93
|
+
}
|
94
|
+
|
95
|
+
.navbar-default .navbar-nav > .active > a,
|
96
|
+
.navbar-default .navbar-nav > .active > a:focus,
|
97
|
+
.navbar-default .navbar-nav > .active > a:hover {
|
98
|
+
color: #ddd;
|
99
|
+
background-color: #333;
|
100
|
+
}
|
101
|
+
|
102
|
+
.navbar-default .navbar-nav > li > a:hover {
|
103
|
+
color: #ddd;
|
104
|
+
}
|
105
|
+
|
106
|
+
.pagination > li > a,
|
107
|
+
.pagination > li > a:hover,
|
108
|
+
.pagination > li > span {
|
109
|
+
color: #ddd;
|
110
|
+
background-color: #333;
|
111
|
+
border-color: #444;
|
112
|
+
}
|
113
|
+
.pagination > .disabled > a,
|
114
|
+
.pagination > .disabled > a:focus,
|
115
|
+
.pagination > .disabled > a:hover,
|
116
|
+
.pagination > .disabled > span,
|
117
|
+
.pagination > .disabled > span:focus,
|
118
|
+
.pagination > .disabled > span:hover {
|
119
|
+
color: #ddd;
|
120
|
+
background-color: #333;
|
121
|
+
border-color: #444;
|
122
|
+
}
|
123
|
+
|
124
|
+
.stat {
|
125
|
+
border: 1px solid #888;
|
126
|
+
}
|
127
|
+
|
128
|
+
.rickshaw_graph .detail {
|
129
|
+
background: #888;
|
130
|
+
}
|
131
|
+
.rickshaw_graph .x_tick {
|
132
|
+
border-color: #888;
|
133
|
+
}
|
134
|
+
|
135
|
+
.rickshaw_graph .y_ticks.glow text {
|
136
|
+
fill: #ddd;
|
137
|
+
color: #ddd;
|
138
|
+
}
|
139
|
+
|
140
|
+
.info-circle {
|
141
|
+
color: #222;
|
142
|
+
background-color: #888;
|
143
|
+
}
|