sidekiq 5.2.7 → 8.0.5
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/Changes.md +845 -8
- data/LICENSE.txt +9 -0
- data/README.md +54 -54
- data/bin/multi_queue_bench +271 -0
- data/bin/sidekiq +22 -3
- data/bin/sidekiqload +219 -112
- data/bin/sidekiqmon +11 -0
- data/bin/webload +69 -0
- data/lib/active_job/queue_adapters/sidekiq_adapter.rb +120 -0
- data/lib/generators/sidekiq/job_generator.rb +59 -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 +757 -373
- data/lib/sidekiq/capsule.rb +132 -0
- data/lib/sidekiq/cli.rb +210 -233
- data/lib/sidekiq/client.rb +145 -103
- data/lib/sidekiq/component.rb +128 -0
- data/lib/sidekiq/config.rb +315 -0
- data/lib/sidekiq/deploy.rb +64 -0
- data/lib/sidekiq/embedded.rb +64 -0
- data/lib/sidekiq/fetch.rb +49 -42
- data/lib/sidekiq/iterable_job.rb +56 -0
- data/lib/sidekiq/job/interrupt_handler.rb +24 -0
- data/lib/sidekiq/job/iterable/active_record_enumerator.rb +53 -0
- data/lib/sidekiq/job/iterable/csv_enumerator.rb +47 -0
- data/lib/sidekiq/job/iterable/enumerators.rb +135 -0
- data/lib/sidekiq/job/iterable.rb +306 -0
- data/lib/sidekiq/job.rb +385 -0
- data/lib/sidekiq/job_logger.rb +34 -7
- data/lib/sidekiq/job_retry.rb +164 -109
- data/lib/sidekiq/job_util.rb +113 -0
- data/lib/sidekiq/launcher.rb +208 -107
- data/lib/sidekiq/logger.rb +80 -0
- data/lib/sidekiq/manager.rb +42 -46
- data/lib/sidekiq/metrics/query.rb +184 -0
- data/lib/sidekiq/metrics/shared.rb +109 -0
- data/lib/sidekiq/metrics/tracking.rb +150 -0
- data/lib/sidekiq/middleware/chain.rb +113 -56
- data/lib/sidekiq/middleware/current_attributes.rb +119 -0
- data/lib/sidekiq/middleware/i18n.rb +7 -7
- data/lib/sidekiq/middleware/modules.rb +23 -0
- data/lib/sidekiq/monitor.rb +147 -0
- data/lib/sidekiq/paginator.rb +41 -16
- data/lib/sidekiq/processor.rb +146 -127
- data/lib/sidekiq/profiler.rb +72 -0
- data/lib/sidekiq/rails.rb +46 -43
- data/lib/sidekiq/redis_client_adapter.rb +113 -0
- data/lib/sidekiq/redis_connection.rb +79 -108
- data/lib/sidekiq/ring_buffer.rb +31 -0
- data/lib/sidekiq/scheduled.rb +112 -50
- data/lib/sidekiq/sd_notify.rb +149 -0
- data/lib/sidekiq/systemd.rb +26 -0
- data/lib/sidekiq/testing/inline.rb +6 -5
- data/lib/sidekiq/testing.rb +91 -90
- data/lib/sidekiq/transaction_aware_client.rb +51 -0
- data/lib/sidekiq/version.rb +7 -1
- data/lib/sidekiq/web/action.rb +125 -60
- data/lib/sidekiq/web/application.rb +363 -259
- data/lib/sidekiq/web/config.rb +120 -0
- data/lib/sidekiq/web/csrf_protection.rb +183 -0
- data/lib/sidekiq/web/helpers.rb +241 -120
- data/lib/sidekiq/web/router.rb +62 -71
- data/lib/sidekiq/web.rb +69 -161
- data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
- data/lib/sidekiq.rb +94 -182
- data/sidekiq.gemspec +26 -16
- data/web/assets/images/apple-touch-icon.png +0 -0
- data/web/assets/javascripts/application.js +150 -61
- data/web/assets/javascripts/base-charts.js +120 -0
- data/web/assets/javascripts/chart.min.js +13 -0
- data/web/assets/javascripts/chartjs-adapter-date-fns.min.js +7 -0
- data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
- data/web/assets/javascripts/dashboard-charts.js +194 -0
- data/web/assets/javascripts/dashboard.js +41 -293
- data/web/assets/javascripts/metrics.js +280 -0
- data/web/assets/stylesheets/style.css +766 -0
- data/web/locales/ar.yml +72 -65
- data/web/locales/cs.yml +63 -62
- data/web/locales/da.yml +61 -53
- data/web/locales/de.yml +66 -53
- data/web/locales/el.yml +44 -24
- data/web/locales/en.yml +94 -66
- data/web/locales/es.yml +92 -54
- data/web/locales/fa.yml +66 -65
- data/web/locales/fr.yml +83 -62
- data/web/locales/gd.yml +99 -0
- data/web/locales/he.yml +66 -64
- data/web/locales/hi.yml +60 -59
- data/web/locales/it.yml +93 -54
- data/web/locales/ja.yml +75 -64
- data/web/locales/ko.yml +53 -52
- data/web/locales/lt.yml +84 -0
- data/web/locales/nb.yml +62 -61
- data/web/locales/nl.yml +53 -52
- data/web/locales/pl.yml +46 -45
- data/web/locales/{pt-br.yml → pt-BR.yml} +84 -56
- data/web/locales/pt.yml +52 -51
- data/web/locales/ru.yml +69 -63
- data/web/locales/sv.yml +54 -53
- data/web/locales/ta.yml +61 -60
- data/web/locales/tr.yml +101 -0
- data/web/locales/uk.yml +86 -61
- data/web/locales/ur.yml +65 -64
- data/web/locales/vi.yml +84 -0
- data/web/locales/zh-CN.yml +106 -0
- data/web/locales/{zh-tw.yml → zh-TW.yml} +43 -9
- data/web/views/_footer.erb +31 -19
- data/web/views/_job_info.erb +94 -75
- data/web/views/_metrics_period_select.erb +15 -0
- data/web/views/_nav.erb +14 -21
- data/web/views/_paging.erb +23 -19
- data/web/views/_poll_link.erb +3 -6
- data/web/views/_summary.erb +23 -23
- data/web/views/busy.erb +139 -87
- data/web/views/dashboard.erb +82 -53
- data/web/views/dead.erb +31 -27
- data/web/views/filtering.erb +6 -0
- data/web/views/layout.erb +15 -29
- data/web/views/metrics.erb +84 -0
- data/web/views/metrics_for_job.erb +58 -0
- data/web/views/morgue.erb +60 -70
- data/web/views/profiles.erb +43 -0
- data/web/views/queue.erb +50 -39
- data/web/views/queues.erb +45 -29
- data/web/views/retries.erb +65 -75
- data/web/views/retry.erb +32 -27
- data/web/views/scheduled.erb +58 -52
- data/web/views/scheduled_job_info.erb +1 -1
- metadata +96 -76
- 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 -23
- data/LICENSE +0 -9
- 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/delay.rb +0 -42
- data/lib/sidekiq/exception_handler.rb +0 -29
- data/lib/sidekiq/extensions/action_mailer.rb +0 -57
- data/lib/sidekiq/extensions/active_record.rb +0 -40
- data/lib/sidekiq/extensions/class_methods.rb +0 -40
- data/lib/sidekiq/extensions/generic_proxy.rb +0 -31
- data/lib/sidekiq/logging.rb +0 -122
- data/lib/sidekiq/middleware/server/active_record.rb +0 -23
- data/lib/sidekiq/util.rb +0 -66
- data/lib/sidekiq/worker.rb +0 -220
- data/web/assets/stylesheets/application-rtl.css +0 -246
- data/web/assets/stylesheets/application.css +0 -1144
- data/web/assets/stylesheets/bootstrap-rtl.min.css +0 -9
- data/web/assets/stylesheets/bootstrap.css +0 -5
- data/web/locales/zh-cn.yml +0 -68
- data/web/views/_status.erb +0 -4
@@ -0,0 +1,280 @@
|
|
1
|
+
class JobMetricsOverviewChart extends BaseChart {
|
2
|
+
constructor(el, options) {
|
3
|
+
super(el, { ...options, chartType: "line" });
|
4
|
+
this.swatches = [];
|
5
|
+
this.visibleKls = options.visibleKls;
|
6
|
+
|
7
|
+
this.init();
|
8
|
+
}
|
9
|
+
|
10
|
+
get datasets() {
|
11
|
+
return Object.entries(this.options.series)
|
12
|
+
.filter(([kls, _]) => this.visibleKls.includes(kls))
|
13
|
+
.map(([kls, _]) => this.buildDataset(kls));
|
14
|
+
}
|
15
|
+
|
16
|
+
get metric() {
|
17
|
+
return this._metric || this.options.initialMetric;
|
18
|
+
}
|
19
|
+
|
20
|
+
set metric(m) {
|
21
|
+
this._metric = m;
|
22
|
+
}
|
23
|
+
|
24
|
+
registerSwatch(id) {
|
25
|
+
const el = document.getElementById(id);
|
26
|
+
el.addEventListener("change", () => this.toggleKls(el.value, el.checked));
|
27
|
+
this.swatches[el.value] = el;
|
28
|
+
this.updateSwatch(el.value, el.checked);
|
29
|
+
}
|
30
|
+
|
31
|
+
updateSwatch(kls, checked) {
|
32
|
+
const el = this.swatches[kls];
|
33
|
+
el.checked = checked;
|
34
|
+
el.style.accentColor = this.colors.assignments[kls] || "";
|
35
|
+
}
|
36
|
+
|
37
|
+
toggleKls(kls, visible) {
|
38
|
+
if (visible) {
|
39
|
+
this.chart.data.datasets.push(this.buildDataset(kls));
|
40
|
+
} else {
|
41
|
+
const i = this.chart.data.datasets.findIndex((ds) => ds.label == kls);
|
42
|
+
this.colors.checkIn(kls);
|
43
|
+
this.chart.data.datasets.splice(i, 1);
|
44
|
+
}
|
45
|
+
|
46
|
+
this.updateSwatch(kls, visible);
|
47
|
+
this.update();
|
48
|
+
}
|
49
|
+
|
50
|
+
buildDataset(kls) {
|
51
|
+
const color = this.colors.checkOut(kls);
|
52
|
+
|
53
|
+
return {
|
54
|
+
label: kls,
|
55
|
+
data: this.dataFromSeries(this.options.series[kls]),
|
56
|
+
borderColor: color,
|
57
|
+
backgroundColor: color,
|
58
|
+
borderWidth: 2,
|
59
|
+
pointRadius: 2,
|
60
|
+
};
|
61
|
+
}
|
62
|
+
|
63
|
+
dataFromSeries(series) {
|
64
|
+
// Chart.js expects `data` to be an array of objects with `x` and `y` values.
|
65
|
+
return Object.entries(series).map(([isoTime, val]) => ({ x: isoTime, y: val }));
|
66
|
+
}
|
67
|
+
|
68
|
+
get chartOptions() {
|
69
|
+
return {
|
70
|
+
...super.chartOptions,
|
71
|
+
aspectRatio: 4,
|
72
|
+
scales: {
|
73
|
+
...super.chartOptions.scales,
|
74
|
+
x: {
|
75
|
+
...super.chartOptions.scales.x,
|
76
|
+
type: "time",
|
77
|
+
min: this.options.starts_at,
|
78
|
+
max: this.options.ends_at,
|
79
|
+
},
|
80
|
+
y: {
|
81
|
+
...super.chartOptions.scales.y,
|
82
|
+
beginAtZero: true,
|
83
|
+
title: {
|
84
|
+
text: this.options.yLabel,
|
85
|
+
display: true,
|
86
|
+
},
|
87
|
+
},
|
88
|
+
},
|
89
|
+
plugins: {
|
90
|
+
...super.chartOptions.plugins,
|
91
|
+
tooltip: {
|
92
|
+
...super.chartOptions.plugins.tooltip,
|
93
|
+
callbacks: {
|
94
|
+
label: (item) =>
|
95
|
+
`${item.dataset.label}: ${item.parsed.y.toFixed(1)} ` +
|
96
|
+
`${this.options.units}`,
|
97
|
+
footer: (items) => {
|
98
|
+
const bucket = items[0].raw.x;
|
99
|
+
const marks = this.options.marks.filter(([b, _]) => b == bucket);
|
100
|
+
return marks.map(
|
101
|
+
([b, msg]) => `${this.options.markLabel}: ${msg}`
|
102
|
+
);
|
103
|
+
},
|
104
|
+
},
|
105
|
+
},
|
106
|
+
},
|
107
|
+
};
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
class HistTotalsChart extends BaseChart {
|
112
|
+
constructor(el, options) {
|
113
|
+
super(el, { ...options, chartType: "bar" });
|
114
|
+
this.init();
|
115
|
+
}
|
116
|
+
|
117
|
+
get datasets() {
|
118
|
+
return [
|
119
|
+
{
|
120
|
+
data: this.options.series,
|
121
|
+
backgroundColor: this.colors.primary,
|
122
|
+
borderWidth: 0,
|
123
|
+
},
|
124
|
+
];
|
125
|
+
}
|
126
|
+
|
127
|
+
get chartOptions() {
|
128
|
+
return {
|
129
|
+
...super.chartOptions,
|
130
|
+
aspectRatio: 6,
|
131
|
+
scales: {
|
132
|
+
...super.chartOptions.scales,
|
133
|
+
y: {
|
134
|
+
...super.chartOptions.scales.y,
|
135
|
+
beginAtZero: true,
|
136
|
+
title: {
|
137
|
+
text: this.options.yLabel,
|
138
|
+
display: true,
|
139
|
+
},
|
140
|
+
},
|
141
|
+
x: {
|
142
|
+
...super.chartOptions.scales.x,
|
143
|
+
title: {
|
144
|
+
text: this.options.xLabel,
|
145
|
+
display: true,
|
146
|
+
},
|
147
|
+
},
|
148
|
+
},
|
149
|
+
plugins: {
|
150
|
+
...super.chartOptions.plugins,
|
151
|
+
tooltip: {
|
152
|
+
...super.chartOptions.plugins.tooltip,
|
153
|
+
callbacks: {
|
154
|
+
label: (item) => `${item.parsed.y} ${this.options.units}`,
|
155
|
+
},
|
156
|
+
},
|
157
|
+
},
|
158
|
+
};
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
class HistBubbleChart extends BaseChart {
|
163
|
+
constructor(el, options) {
|
164
|
+
super(el, { ...options, chartType: "bubble" });
|
165
|
+
this.init();
|
166
|
+
}
|
167
|
+
|
168
|
+
get datasets() {
|
169
|
+
const data = [];
|
170
|
+
let maxCount = 0;
|
171
|
+
|
172
|
+
Object.entries(this.options.hist).forEach(([bucket, hist]) => {
|
173
|
+
hist.forEach((count, histBucket) => {
|
174
|
+
if (count > 0) {
|
175
|
+
// histogram data is ordered fastest to slowest, but this.histIntervals is
|
176
|
+
// slowest to fastest (so it displays correctly on the chart).
|
177
|
+
const index = this.options.histIntervals.length - 1 - histBucket;
|
178
|
+
|
179
|
+
data.push({
|
180
|
+
x: bucket,
|
181
|
+
y: this.options.histIntervals[index] / 1000,
|
182
|
+
count: count,
|
183
|
+
});
|
184
|
+
|
185
|
+
if (count > maxCount) maxCount = count;
|
186
|
+
}
|
187
|
+
});
|
188
|
+
});
|
189
|
+
|
190
|
+
// Chart.js will not calculate the bubble size. We have to do that.
|
191
|
+
const maxRadius = this.el.offsetWidth / 100;
|
192
|
+
const minRadius = 1;
|
193
|
+
const multiplier = (maxRadius / maxCount) * 1.5;
|
194
|
+
data.forEach((entry) => {
|
195
|
+
entry.r = entry.count * multiplier + minRadius;
|
196
|
+
});
|
197
|
+
|
198
|
+
return [
|
199
|
+
{
|
200
|
+
data: data,
|
201
|
+
backgroundColor: this.colors.primary,
|
202
|
+
borderColor: this.colors.primary,
|
203
|
+
},
|
204
|
+
];
|
205
|
+
}
|
206
|
+
|
207
|
+
get chartOptions() {
|
208
|
+
return {
|
209
|
+
...super.chartOptions,
|
210
|
+
aspectRatio: 3,
|
211
|
+
scales: {
|
212
|
+
...super.chartOptions.scales,
|
213
|
+
x: {
|
214
|
+
...super.chartOptions.scales.x,
|
215
|
+
type: "time",
|
216
|
+
min: this.options.starts_at,
|
217
|
+
max: this.options.ends_at,
|
218
|
+
},
|
219
|
+
y: {
|
220
|
+
...super.chartOptions.scales.y,
|
221
|
+
title: {
|
222
|
+
text: this.options.yLabel,
|
223
|
+
display: true,
|
224
|
+
},
|
225
|
+
},
|
226
|
+
},
|
227
|
+
plugins: {
|
228
|
+
...super.chartOptions.plugins,
|
229
|
+
tooltip: {
|
230
|
+
...super.chartOptions.plugins.tooltip,
|
231
|
+
callbacks: {
|
232
|
+
label: (item) =>
|
233
|
+
`${item.parsed.y} ${this.options.yUnits}: ${item.raw.count} ${this.options.zUnits}`,
|
234
|
+
footer: (items) => {
|
235
|
+
const bucket = items[0].raw.x;
|
236
|
+
const marks = this.options.marks.filter(([b, _]) => b == bucket);
|
237
|
+
return marks.map(
|
238
|
+
([b, msg]) => `${this.options.markLabel}: ${msg}`
|
239
|
+
);
|
240
|
+
},
|
241
|
+
},
|
242
|
+
},
|
243
|
+
},
|
244
|
+
};
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
var ch = document.getElementById("job-metrics-overview-chart");
|
249
|
+
if (ch != null) {
|
250
|
+
var jm = new JobMetricsOverviewChart(ch, JSON.parse(ch.textContent));
|
251
|
+
document.querySelectorAll(".metrics-swatch-wrapper > input[type=checkbox]").forEach((imp) => {
|
252
|
+
jm.registerSwatch(imp.id)
|
253
|
+
});
|
254
|
+
window.jobMetricsChart = jm;
|
255
|
+
}
|
256
|
+
|
257
|
+
var htc = document.getElementById("hist-totals-chart");
|
258
|
+
if (htc != null) {
|
259
|
+
var tc = new HistTotalsChart(htc, JSON.parse(htc.textContent));
|
260
|
+
window.histTotalsChart = tc
|
261
|
+
}
|
262
|
+
|
263
|
+
var hbc = document.getElementById("hist-bubble-chart");
|
264
|
+
if (hbc != null) {
|
265
|
+
var bc = new HistBubbleChart(hbc, JSON.parse(hbc.textContent));
|
266
|
+
window.histBubbleChart = bc
|
267
|
+
}
|
268
|
+
|
269
|
+
var form = document.getElementById("metrics-form")
|
270
|
+
document.querySelectorAll("#period-selector").forEach(node => {
|
271
|
+
node.addEventListener("input", debounce(() => form.submit()))
|
272
|
+
})
|
273
|
+
|
274
|
+
function debounce(func, timeout = 300) {
|
275
|
+
let timer;
|
276
|
+
return (...args) => {
|
277
|
+
clearTimeout(timer);
|
278
|
+
timer = setTimeout(() => { func.apply(this, args); }, timeout);
|
279
|
+
};
|
280
|
+
}
|