sidekiq 5.2.5 → 6.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.circleci/config.yml +82 -0
- data/.gitignore +0 -2
- data/.standard.yml +20 -0
- data/6.0-Upgrade.md +72 -0
- data/COMM-LICENSE +11 -9
- data/Changes.md +136 -0
- data/Ent-2.0-Upgrade.md +37 -0
- data/Ent-Changes.md +32 -1
- data/Gemfile +12 -17
- data/Gemfile.lock +196 -0
- data/Pro-5.0-Upgrade.md +25 -0
- data/Pro-Changes.md +26 -2
- data/README.md +19 -31
- data/Rakefile +5 -4
- data/bin/sidekiqload +33 -25
- data/bin/sidekiqmon +8 -0
- data/lib/generators/sidekiq/templates/worker_test.rb.erb +1 -1
- data/lib/generators/sidekiq/worker_generator.rb +20 -12
- data/lib/sidekiq/api.rb +230 -214
- data/lib/sidekiq/cli.rb +111 -174
- data/lib/sidekiq/client.rb +55 -46
- data/lib/sidekiq/delay.rb +5 -6
- data/lib/sidekiq/exception_handler.rb +10 -12
- data/lib/sidekiq/extensions/action_mailer.rb +10 -20
- data/lib/sidekiq/extensions/active_record.rb +9 -7
- data/lib/sidekiq/extensions/class_methods.rb +9 -7
- data/lib/sidekiq/extensions/generic_proxy.rb +4 -4
- data/lib/sidekiq/fetch.rb +11 -12
- data/lib/sidekiq/job_logger.rb +45 -7
- data/lib/sidekiq/job_retry.rb +71 -60
- data/lib/sidekiq/launcher.rb +57 -51
- data/lib/sidekiq/logger.rb +165 -0
- data/lib/sidekiq/manager.rb +7 -9
- data/lib/sidekiq/middleware/chain.rb +14 -4
- data/lib/sidekiq/middleware/i18n.rb +5 -7
- data/lib/sidekiq/monitor.rb +133 -0
- data/lib/sidekiq/paginator.rb +18 -14
- data/lib/sidekiq/processor.rb +83 -75
- data/lib/sidekiq/rails.rb +23 -29
- data/lib/sidekiq/redis_connection.rb +31 -37
- data/lib/sidekiq/scheduled.rb +28 -29
- data/lib/sidekiq/testing/inline.rb +2 -1
- data/lib/sidekiq/testing.rb +34 -23
- data/lib/sidekiq/util.rb +17 -16
- data/lib/sidekiq/version.rb +2 -1
- data/lib/sidekiq/web/action.rb +14 -10
- data/lib/sidekiq/web/application.rb +64 -66
- data/lib/sidekiq/web/helpers.rb +89 -71
- data/lib/sidekiq/web/router.rb +17 -14
- data/lib/sidekiq/web.rb +41 -49
- data/lib/sidekiq/worker.rb +129 -97
- data/lib/sidekiq.rb +61 -42
- data/sidekiq.gemspec +16 -16
- data/web/assets/javascripts/dashboard.js +4 -23
- data/web/assets/stylesheets/application-dark.css +125 -0
- data/web/assets/stylesheets/application.css +9 -0
- data/web/assets/stylesheets/bootstrap.css +1 -1
- data/web/locales/de.yml +14 -2
- data/web/locales/ja.yml +2 -1
- data/web/views/_job_info.erb +2 -1
- data/web/views/busy.erb +4 -1
- data/web/views/dead.erb +2 -2
- data/web/views/layout.erb +1 -0
- data/web/views/morgue.erb +4 -1
- data/web/views/queue.erb +10 -1
- data/web/views/queues.erb +1 -1
- data/web/views/retries.erb +4 -1
- data/web/views/retry.erb +2 -2
- data/web/views/scheduled.erb +4 -1
- metadata +21 -32
- data/.travis.yml +0 -17
- data/Appraisals +0 -9
- data/bin/sidekiqctl +0 -237
- data/gemfiles/rails_4.gemfile +0 -31
- data/gemfiles/rails_5.gemfile +0 -31
- data/lib/sidekiq/core_ext.rb +0 -1
- data/lib/sidekiq/logging.rb +0 -122
- data/lib/sidekiq/middleware/server/active_record.rb +0 -23
data/lib/sidekiq.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.
|
3
|
+
require "sidekiq/version"
|
4
|
+
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.5.0." if RUBY_PLATFORM != "java" && Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5.0")
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
6
|
+
require "sidekiq/logger"
|
7
|
+
require "sidekiq/client"
|
8
|
+
require "sidekiq/worker"
|
9
|
+
require "sidekiq/redis_connection"
|
10
|
+
require "sidekiq/delay"
|
11
11
|
|
12
|
-
require
|
12
|
+
require "json"
|
13
13
|
|
14
14
|
module Sidekiq
|
15
|
-
NAME =
|
16
|
-
LICENSE =
|
15
|
+
NAME = "Sidekiq"
|
16
|
+
LICENSE = "See LICENSE and the LGPL-3.0 for licensing details."
|
17
17
|
|
18
18
|
DEFAULTS = {
|
19
19
|
queues: [],
|
20
20
|
labels: [],
|
21
21
|
concurrency: 10,
|
22
|
-
require:
|
22
|
+
require: ".",
|
23
23
|
environment: nil,
|
24
|
-
timeout:
|
24
|
+
timeout: 25,
|
25
25
|
poll_interval_average: nil,
|
26
26
|
average_scheduled_poll_interval: 5,
|
27
27
|
error_handlers: [],
|
@@ -38,8 +38,8 @@ module Sidekiq
|
|
38
38
|
}
|
39
39
|
|
40
40
|
DEFAULT_WORKER_OPTIONS = {
|
41
|
-
|
42
|
-
|
41
|
+
"retry" => true,
|
42
|
+
"queue" => "default",
|
43
43
|
}
|
44
44
|
|
45
45
|
FAKE_INFO = {
|
@@ -47,7 +47,7 @@ module Sidekiq
|
|
47
47
|
"uptime_in_days" => "9999",
|
48
48
|
"connected_clients" => "9999",
|
49
49
|
"used_memory_human" => "9P",
|
50
|
-
"used_memory_peak_human" => "9P"
|
50
|
+
"used_memory_peak_human" => "9P",
|
51
51
|
}
|
52
52
|
|
53
53
|
def self.❨╯°□°❩╯︵┻━┻
|
@@ -96,9 +96,13 @@ module Sidekiq
|
|
96
96
|
begin
|
97
97
|
yield conn
|
98
98
|
rescue Redis::CommandError => ex
|
99
|
-
#2550 Failover can cause the server to become a replica, need
|
99
|
+
# 2550 Failover can cause the server to become a replica, need
|
100
100
|
# to disconnect and reopen the socket to get back to the primary.
|
101
|
-
|
101
|
+
if retryable && ex.message =~ /READONLY/
|
102
|
+
conn.disconnect!
|
103
|
+
retryable = false
|
104
|
+
retry
|
105
|
+
end
|
102
106
|
raise
|
103
107
|
end
|
104
108
|
end
|
@@ -106,19 +110,17 @@ module Sidekiq
|
|
106
110
|
|
107
111
|
def self.redis_info
|
108
112
|
redis do |conn|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
conn.info
|
116
|
-
end
|
117
|
-
rescue Redis::CommandError => ex
|
118
|
-
#2850 return fake version when INFO command has (probably) been renamed
|
119
|
-
raise unless ex.message =~ /unknown command/
|
120
|
-
FAKE_INFO
|
113
|
+
# admin commands can't go through redis-namespace starting
|
114
|
+
# in redis-namespace 2.0
|
115
|
+
if conn.respond_to?(:namespace)
|
116
|
+
conn.redis.info
|
117
|
+
else
|
118
|
+
conn.info
|
121
119
|
end
|
120
|
+
rescue Redis::CommandError => ex
|
121
|
+
# 2850 return fake version when INFO command has (probably) been renamed
|
122
|
+
raise unless /unknown command/.match?(ex.message)
|
123
|
+
FAKE_INFO
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
@@ -152,18 +154,13 @@ module Sidekiq
|
|
152
154
|
|
153
155
|
def self.default_worker_options=(hash)
|
154
156
|
# stringify
|
155
|
-
@default_worker_options = default_worker_options.merge(Hash[hash.map{|k, v| [k.to_s, v]}])
|
157
|
+
@default_worker_options = default_worker_options.merge(Hash[hash.map { |k, v| [k.to_s, v] }])
|
156
158
|
end
|
159
|
+
|
157
160
|
def self.default_worker_options
|
158
161
|
defined?(@default_worker_options) ? @default_worker_options : DEFAULT_WORKER_OPTIONS
|
159
162
|
end
|
160
163
|
|
161
|
-
def self.default_retries_exhausted=(prok)
|
162
|
-
logger.info { "default_retries_exhausted is deprecated, please use `config.death_handlers << -> {|job, ex| }`" }
|
163
|
-
return nil unless prok
|
164
|
-
death_handlers << prok
|
165
|
-
end
|
166
|
-
|
167
164
|
##
|
168
165
|
# Death handlers are called when all retries for a job have been exhausted and
|
169
166
|
# the job dies. It's the notification to your application
|
@@ -180,15 +177,37 @@ module Sidekiq
|
|
180
177
|
def self.load_json(string)
|
181
178
|
JSON.parse(string)
|
182
179
|
end
|
180
|
+
|
183
181
|
def self.dump_json(object)
|
184
182
|
JSON.generate(object)
|
185
183
|
end
|
186
184
|
|
185
|
+
def self.log_formatter
|
186
|
+
@log_formatter ||= if ENV["DYNO"]
|
187
|
+
Sidekiq::Logger::Formatters::WithoutTimestamp.new
|
188
|
+
else
|
189
|
+
Sidekiq::Logger::Formatters::Pretty.new
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.log_formatter=(log_formatter)
|
194
|
+
@log_formatter = log_formatter
|
195
|
+
logger.formatter = log_formatter
|
196
|
+
end
|
197
|
+
|
187
198
|
def self.logger
|
188
|
-
Sidekiq::
|
199
|
+
@logger ||= Sidekiq::Logger.new(STDOUT, level: Logger::INFO)
|
189
200
|
end
|
190
|
-
|
191
|
-
|
201
|
+
|
202
|
+
def self.logger=(logger)
|
203
|
+
if logger.nil?
|
204
|
+
self.logger.level = Logger::FATAL
|
205
|
+
return self.logger
|
206
|
+
end
|
207
|
+
|
208
|
+
logger.extend(Sidekiq::LoggingUtils)
|
209
|
+
|
210
|
+
@logger = logger
|
192
211
|
end
|
193
212
|
|
194
213
|
# How frequently Redis should be checked by a random Sidekiq process for
|
@@ -197,7 +216,7 @@ module Sidekiq
|
|
197
216
|
#
|
198
217
|
# See sidekiq/scheduled.rb for an in-depth explanation of this value
|
199
218
|
def self.average_scheduled_poll_interval=(interval)
|
200
|
-
|
219
|
+
options[:average_scheduled_poll_interval] = interval
|
201
220
|
end
|
202
221
|
|
203
222
|
# Register a proc to handle any error which occurs within the Sidekiq process.
|
@@ -208,7 +227,7 @@ module Sidekiq
|
|
208
227
|
#
|
209
228
|
# The default error handler logs errors to Sidekiq.logger.
|
210
229
|
def self.error_handlers
|
211
|
-
|
230
|
+
options[:error_handlers]
|
212
231
|
end
|
213
232
|
|
214
233
|
# Register a block to run at a point in the Sidekiq lifecycle.
|
@@ -234,4 +253,4 @@ module Sidekiq
|
|
234
253
|
class Shutdown < Interrupt; end
|
235
254
|
end
|
236
255
|
|
237
|
-
require
|
256
|
+
require "sidekiq/rails" if defined?(::Rails::Engine)
|
data/sidekiq.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "lib/sidekiq/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors
|
5
|
-
gem.email
|
6
|
-
gem.summary
|
7
|
-
gem.description
|
8
|
-
gem.homepage
|
9
|
-
gem.license
|
4
|
+
gem.authors = ["Mike Perham"]
|
5
|
+
gem.email = ["mperham@gmail.com"]
|
6
|
+
gem.summary = "Simple, efficient background processing for Ruby"
|
7
|
+
gem.description = "Simple, efficient background processing for Ruby."
|
8
|
+
gem.homepage = "http://sidekiq.org"
|
9
|
+
gem.license = "LGPL-3.0"
|
10
10
|
|
11
|
-
gem.executables
|
12
|
-
gem.files
|
13
|
-
gem.name
|
14
|
-
gem.version
|
15
|
-
gem.required_ruby_version = ">= 2.
|
11
|
+
gem.executables = ["sidekiq", "sidekiqmon"]
|
12
|
+
gem.files = `git ls-files | grep -Ev '^(test|myapp|examples)'`.split("\n")
|
13
|
+
gem.name = "sidekiq"
|
14
|
+
gem.version = Sidekiq::VERSION
|
15
|
+
gem.required_ruby_version = ">= 2.5.0"
|
16
16
|
|
17
|
-
gem.add_dependency
|
18
|
-
gem.add_dependency
|
19
|
-
gem.add_dependency
|
20
|
-
gem.add_dependency
|
17
|
+
gem.add_dependency "redis", ">= 4.1.0"
|
18
|
+
gem.add_dependency "connection_pool", ">= 2.2.2"
|
19
|
+
gem.add_dependency "rack", ">= 2.0.0"
|
20
|
+
gem.add_dependency "rack-protection", ">= 2.0.0"
|
21
21
|
end
|
@@ -16,10 +16,8 @@ var gridSize=(this.orientation=="right"?1:-1)*this.graph.width;this.graph.vis.ap
|
|
16
16
|
var nodes=vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:rect").attr("x",function(d){return graph.x(d.x)+barXOffset}).attr("y",function(d){return graph.y(d.y0+Math.abs(d.y))*(d.y<0?-1:1)}).attr("width",seriesBarWidth).attr("height",function(d){return graph.y.magnitude(Math.abs(d.y))}).attr("opacity",series.opacity).attr("transform",transform);Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)});if(this.unstack)barXOffset+=seriesBarWidth},this)},_frequentInterval:function(data){var intervalCounts={};for(var i=0;i<data.length-1;i++){var interval=data[i+1].x-data[i].x;intervalCounts[interval]=intervalCounts[interval]||0;intervalCounts[interval]++}var frequentInterval={count:0,magnitude:1};var keysSorted=Rickshaw.keys(intervalCounts).sort(function asc(a,b){return Number(a)-Number(b)});keysSorted.forEach(function(i){if(frequentInterval.count<intervalCounts[i]){frequentInterval={count:intervalCounts[i],magnitude:i}}});return frequentInterval}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Area");Rickshaw.Graph.Renderer.Area=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"area",defaults:function($super){return Rickshaw.extend($super(),{unstack:false,fill:false,stroke:false})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.area().x(function(d){return graph.x(d.x)}).y0(function(d){return graph.y(d.y0)}).y1(function(d){return graph.y(d.y+d.y0)}).interpolate(graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},seriesStrokeFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y+d.y0)}).interpolate(graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;vis.selectAll("*").remove();var method=this.unstack?"append":"insert";var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var nodes=vis.selectAll("path").data(data).enter()[method]("svg:g","g");nodes.append("svg:path").attr("d",this.seriesPathFactory()).attr("class","area");if(this.stroke){nodes.append("svg:path").attr("d",this.seriesStrokeFactory()).attr("class","line")}var i=0;series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this)},_styleSeries:function(series){if(!series.path)return;d3.select(series.path).select(".area").attr("fill",series.color);if(this.stroke){d3.select(series.path).select(".line").attr("fill","none").attr("stroke",series.stroke||d3.interpolateRgb(series.color,"black")(.125)).attr("stroke-width",this.strokeWidth)}if(series.className){series.path.setAttribute("class",series.className)}}});Rickshaw.namespace("Rickshaw.Graph.Renderer.ScatterPlot");Rickshaw.Graph.Renderer.ScatterPlot=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"scatterplot",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:true,stroke:false,padding:{top:.01,right:.01,bottom:.01,left:.01},dotSize:4})},initialize:function($super,args){$super(args)},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;var dotSize=this.dotSize;vis.selectAll("*").remove();series.forEach(function(series){if(series.disabled)return;var opacity=series.opacity?series.opacity:1;var nodes=vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:circle").attr("cx",function(d){return graph.x(d.x)}).attr("cy",function(d){return graph.y(d.y)}).attr("r",function(d){return"r"in d?d.r:dotSize}).attr("opacity",function(d){return"opacity"in d?d.opacity:opacity});if(series.className){nodes.classed(series.className,true)}Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)})},this)}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Multi");Rickshaw.Graph.Renderer.Multi=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"multi",initialize:function($super,args){$super(args)},defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true})},configure:function($super,args){args=args||{};this.config=args;$super(args)},domain:function($super){this.graph.stackData();var domains=[];var groups=this._groups();this._stack(groups);groups.forEach(function(group){var data=group.series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});if(!data.length)return;var domain=null;if(group.renderer&&group.renderer.domain){domain=group.renderer.domain(data)}else{domain=$super(data)}domains.push(domain)});var xMin=d3.min(domains.map(function(d){return d.x[0]}));var xMax=d3.max(domains.map(function(d){return d.x[1]}));var yMin=d3.min(domains.map(function(d){return d.y[0]}));var yMax=d3.max(domains.map(function(d){return d.y[1]}));return{x:[xMin,xMax],y:[yMin,yMax]}},_groups:function(){var graph=this.graph;var renderGroups={};graph.series.forEach(function(series){if(series.disabled)return;if(!renderGroups[series.renderer]){var ns="http://www.w3.org/2000/svg";var vis=document.createElementNS(ns,"g");graph.vis[0][0].appendChild(vis);var renderer=graph._renderers[series.renderer];var config={};var defaults=[this.defaults(),renderer.defaults(),this.config,this.graph];defaults.forEach(function(d){Rickshaw.extend(config,d)});renderer.configure(config);renderGroups[series.renderer]={renderer:renderer,series:[],vis:d3.select(vis)}}renderGroups[series.renderer].series.push(series)},this);var groups=[];Object.keys(renderGroups).forEach(function(key){var group=renderGroups[key];groups.push(group)});return groups},_stack:function(groups){groups.forEach(function(group){var series=group.series.filter(function(series){return!series.disabled});var data=series.map(function(series){return series.stack});if(!group.renderer.unstack){var layout=d3.layout.stack();var stackedData=Rickshaw.clone(layout(data));series.forEach(function(series,index){series._stack=Rickshaw.clone(stackedData[index])})}},this);return groups},render:function(){this.graph.series.forEach(function(series){if(!series.renderer){throw new Error("Each series needs a renderer for graph 'multi' renderer")}});this.graph.vis.selectAll("*").remove();var groups=this._groups();groups=this._stack(groups);groups.forEach(function(group){var series=group.series.filter(function(series){return!series.disabled});series.active=function(){return series};group.renderer.render({series:series,vis:group.vis});series.forEach(function(s){s.stack=s._stack||s.stack||s.data})})}});Rickshaw.namespace("Rickshaw.Graph.Renderer.LinePlot");Rickshaw.Graph.Renderer.LinePlot=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"lineplot",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true,padding:{top:.01,right:.01,bottom:.01,left:.01},dotSize:3,strokeWidth:2})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;var dotSize=this.dotSize;vis.selectAll("*").remove();var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var nodes=vis.selectAll("path").data(data).enter().append("svg:path").attr("d",this.seriesPathFactory());var i=0;series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this);series.forEach(function(series){if(series.disabled)return;var nodes=vis.selectAll("x").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:circle").attr("cx",function(d){return graph.x(d.x)}).attr("cy",function(d){return graph.y(d.y)}).attr("r",function(d){return"r"in d?d.r:dotSize});Array.prototype.forEach.call(nodes[0],function(n){if(!n)return;n.setAttribute("data-color",series.color);n.setAttribute("fill","white");n.setAttribute("stroke",series.color);n.setAttribute("stroke-width",this.strokeWidth)}.bind(this))},this)}});Rickshaw.namespace("Rickshaw.Graph.Smoother");Rickshaw.Graph.Smoother=Rickshaw.Class.create({initialize:function(args){this.graph=args.graph;this.element=args.element;this.aggregationScale=1;this.build();this.graph.stackData.hooks.data.push({name:"smoother",orderPosition:50,f:this.transformer.bind(this)})},build:function(){var self=this;var $=jQuery;if(this.element){$(function(){$(self.element).slider({min:1,max:100,slide:function(event,ui){self.setScale(ui.value)}})})}},setScale:function(scale){if(scale<1){throw"scale out of range: "+scale}this.aggregationScale=scale;this.graph.update()},transformer:function(data){if(this.aggregationScale==1)return data;var aggregatedData=[];data.forEach(function(seriesData){var aggregatedSeriesData=[];while(seriesData.length){var avgX=0,avgY=0;var slice=seriesData.splice(0,this.aggregationScale);slice.forEach(function(d){avgX+=d.x/slice.length;avgY+=d.y/slice.length});aggregatedSeriesData.push({x:avgX,y:avgY})}aggregatedData.push(aggregatedSeriesData)}.bind(this));return aggregatedData}});Rickshaw.namespace("Rickshaw.Graph.Socketio");Rickshaw.Graph.Socketio=Rickshaw.Class.create(Rickshaw.Graph.Ajax,{request:function(){var socket=io.connect(this.dataURL);var self=this;socket.on("rickshaw",function(data){self.success(data)})}});Rickshaw.namespace("Rickshaw.Series");Rickshaw.Series=Rickshaw.Class.create(Array,{initialize:function(data,palette,options){options=options||{};this.palette=new Rickshaw.Color.Palette(palette);this.timeBase=typeof options.timeBase==="undefined"?Math.floor((new Date).getTime()/1e3):options.timeBase;var timeInterval=typeof options.timeInterval=="undefined"?1e3:options.timeInterval;this.setTimeInterval(timeInterval);if(data&&typeof data=="object"&&Array.isArray(data)){data.forEach(function(item){this.addItem(item)},this)}},addItem:function(item){if(typeof item.name==="undefined"){throw"addItem() needs a name"}item.color=item.color||this.palette.color(item.name);item.data=item.data||[];if(item.data.length===0&&this.length&&this.getIndex()>0){this[0].data.forEach(function(plot){item.data.push({x:plot.x,y:0})})}else if(item.data.length===0){item.data.push({x:this.timeBase-(this.timeInterval||0),y:0})}this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},addData:function(data,x){var index=this.getIndex();Rickshaw.keys(data).forEach(function(name){if(!this.itemByName(name)){this.addItem({name:name})}},this);this.forEach(function(item){item.data.push({x:x||(index*this.timeInterval||1)+this.timeBase,y:data[item.name]||0})},this)},getIndex:function(){return this[0]&&this[0].data&&this[0].data.length?this[0].data.length:0},itemByName:function(name){for(var i=0;i<this.length;i++){if(this[i].name==name)return this[i]}},setTimeInterval:function(iv){this.timeInterval=iv/1e3},setTimeBase:function(t){this.timeBase=t},dump:function(){var data={timeBase:this.timeBase,timeInterval:this.timeInterval,items:[]};this.forEach(function(item){var newItem={color:item.color,name:item.name,data:[]};item.data.forEach(function(plot){newItem.data.push({x:plot.x,y:plot.y})});data.items.push(newItem)});return data},load:function(data){if(data.timeInterval){this.timeInterval=data.timeInterval}if(data.timeBase){this.timeBase=data.timeBase}if(data.items){data.items.forEach(function(item){this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},this)}}});Rickshaw.Series.zeroFill=function(series){Rickshaw.Series.fill(series,0)};Rickshaw.Series.fill=function(series,fill){var x;var i=0;var data=series.map(function(s){return s.data});while(i<Math.max.apply(null,data.map(function(d){return d.length}))){x=Math.min.apply(null,data.filter(function(d){return d[i]}).map(function(d){return d[i].x}));data.forEach(function(d){if(!d[i]||d[i].x!=x){d.splice(i,0,{x:x,y:fill})}});i++}};Rickshaw.namespace("Rickshaw.Series.FixedDuration");Rickshaw.Series.FixedDuration=Rickshaw.Class.create(Rickshaw.Series,{initialize:function(data,palette,options){options=options||{};if(typeof options.timeInterval==="undefined"){throw new Error("FixedDuration series requires timeInterval")}if(typeof options.maxDataPoints==="undefined"){throw new Error("FixedDuration series requires maxDataPoints")}this.palette=new Rickshaw.Color.Palette(palette);this.timeBase=typeof options.timeBase==="undefined"?Math.floor((new Date).getTime()/1e3):options.timeBase;this.setTimeInterval(options.timeInterval);if(this[0]&&this[0].data&&this[0].data.length){this.currentSize=this[0].data.length;this.currentIndex=this[0].data.length}else{this.currentSize=0;this.currentIndex=0}this.maxDataPoints=options.maxDataPoints;if(data&&typeof data=="object"&&Array.isArray(data)){data.forEach(function(item){this.addItem(item)},this);this.currentSize+=1;this.currentIndex+=1}this.timeBase-=(this.maxDataPoints-this.currentSize)*this.timeInterval;if(typeof this.maxDataPoints!=="undefined"&&this.currentSize<this.maxDataPoints){for(var i=this.maxDataPoints-this.currentSize-1;i>1;i--){this.currentSize+=1;this.currentIndex+=1;this.forEach(function(item){item.data.unshift({x:((i-1)*this.timeInterval||1)+this.timeBase,y:0,i:i})},this)}}},addData:function($super,data,x){$super(data,x);this.currentSize+=1;this.currentIndex+=1;if(this.maxDataPoints!==undefined){while(this.currentSize>this.maxDataPoints){this.dropData()}}},dropData:function(){this.forEach(function(item){item.data.splice(0,1)});this.currentSize-=1},getIndex:function(){return this.currentIndex}});return Rickshaw});
|
17
17
|
|
18
18
|
var poller;
|
19
|
-
|
20
19
|
var realtimeGraph = function(updatePath) {
|
21
20
|
var timeInterval = parseInt(localStorage.timeInterval || '5000');
|
22
|
-
|
23
21
|
var graphElement = document.getElementById("realtime");
|
24
22
|
|
25
23
|
var graph = new Rickshaw.Graph( {
|
@@ -29,9 +27,9 @@ var realtimeGraph = function(updatePath) {
|
|
29
27
|
renderer: 'line',
|
30
28
|
interpolation: 'linear',
|
31
29
|
|
32
|
-
series: new Rickshaw.Series.FixedDuration([{ name: graphElement.dataset.failedLabel, color: '#
|
33
|
-
|
34
|
-
|
30
|
+
series: new Rickshaw.Series.FixedDuration([{ name: graphElement.dataset.failedLabel, color: '#af0014' }, { name: graphElement.dataset.processedLabel, color: '#006f68' }], undefined, {
|
31
|
+
timeInterval: timeInterval,
|
32
|
+
maxDataPoints: 100,
|
35
33
|
})
|
36
34
|
});
|
37
35
|
|
@@ -46,7 +44,6 @@ var realtimeGraph = function(updatePath) {
|
|
46
44
|
var legend = document.querySelector('#realtime-legend');
|
47
45
|
var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, {
|
48
46
|
render: function(args) {
|
49
|
-
|
50
47
|
legend.innerHTML = "";
|
51
48
|
|
52
49
|
var timestamp = document.createElement('div');
|
@@ -68,7 +65,6 @@ var realtimeGraph = function(updatePath) {
|
|
68
65
|
|
69
66
|
line.appendChild(swatch);
|
70
67
|
line.appendChild(label);
|
71
|
-
|
72
68
|
legend.appendChild(line);
|
73
69
|
|
74
70
|
var dot = document.createElement('div');
|
@@ -77,11 +73,8 @@ var realtimeGraph = function(updatePath) {
|
|
77
73
|
dot.style.borderColor = d.series.color;
|
78
74
|
|
79
75
|
this.element.appendChild(dot);
|
80
|
-
|
81
76
|
dot.className = 'dot active';
|
82
|
-
|
83
77
|
this.show();
|
84
|
-
|
85
78
|
}, this );
|
86
79
|
}
|
87
80
|
});
|
@@ -90,7 +83,6 @@ var realtimeGraph = function(updatePath) {
|
|
90
83
|
var i = 0;
|
91
84
|
poller = setInterval(function() {
|
92
85
|
$.getJSON($("#history").data("update-url"), function(data) {
|
93
|
-
|
94
86
|
if (i === 0) {
|
95
87
|
var processed = data.sidekiq.processed;
|
96
88
|
var failed = data.sidekiq.failed;
|
@@ -133,7 +125,7 @@ var historyGraph = function() {
|
|
133
125
|
interpolation: 'linear',
|
134
126
|
series: [
|
135
127
|
{
|
136
|
-
color: "#
|
128
|
+
color: "#af0014",
|
137
129
|
data: failed,
|
138
130
|
name: graphElement.dataset.failedLabel
|
139
131
|
}, {
|
@@ -144,7 +136,6 @@ var historyGraph = function() {
|
|
144
136
|
]
|
145
137
|
} );
|
146
138
|
var x_axis = new Rickshaw.Graph.Axis.Time( { graph: graph } );
|
147
|
-
|
148
139
|
var y_axis = new Rickshaw.Graph.Axis.Y({
|
149
140
|
graph: graph,
|
150
141
|
tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
|
@@ -156,7 +147,6 @@ var historyGraph = function() {
|
|
156
147
|
var legend = document.querySelector('#history-legend');
|
157
148
|
var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, {
|
158
149
|
render: function(args) {
|
159
|
-
|
160
150
|
legend.innerHTML = "";
|
161
151
|
|
162
152
|
var timestamp = document.createElement('div');
|
@@ -178,7 +168,6 @@ var historyGraph = function() {
|
|
178
168
|
|
179
169
|
line.appendChild(swatch);
|
180
170
|
line.appendChild(label);
|
181
|
-
|
182
171
|
legend.appendChild(line);
|
183
172
|
|
184
173
|
var dot = document.createElement('div');
|
@@ -187,11 +176,8 @@ var historyGraph = function() {
|
|
187
176
|
dot.style.borderColor = d.series.color;
|
188
177
|
|
189
178
|
this.element.appendChild(dot);
|
190
|
-
|
191
179
|
dot.className = 'dot active';
|
192
|
-
|
193
180
|
this.show();
|
194
|
-
|
195
181
|
}, this );
|
196
182
|
}
|
197
183
|
});
|
@@ -216,7 +202,6 @@ var updateStatsSummary = function(data) {
|
|
216
202
|
$('ul.summary li.retries span.count').html(data.retries.numberWithDelimiter())
|
217
203
|
$('ul.summary li.enqueued span.count').html(data.enqueued.numberWithDelimiter())
|
218
204
|
$('ul.summary li.dead span.count').html(data.dead.numberWithDelimiter())
|
219
|
-
|
220
205
|
}
|
221
206
|
|
222
207
|
var updateRedisStats = function(data) {
|
@@ -277,7 +262,6 @@ $(function(){
|
|
277
262
|
$(document).on('mousemove', 'div.interval-slider input', function(){
|
278
263
|
setSliderLabel($(this).val());
|
279
264
|
});
|
280
|
-
|
281
265
|
});
|
282
266
|
|
283
267
|
// Reset graphs
|
@@ -300,13 +284,10 @@ var debounce = function(fn, timeout)
|
|
300
284
|
|
301
285
|
window.onresize = function() {
|
302
286
|
var prevWidth = window.innerWidth;
|
303
|
-
|
304
287
|
return debounce(function () {
|
305
288
|
var currWidth = window.innerWidth;
|
306
|
-
|
307
289
|
if (prevWidth !== currWidth) {
|
308
290
|
prevWidth = currWidth;
|
309
|
-
|
310
291
|
clearInterval(poller);
|
311
292
|
resetGraphs();
|
312
293
|
renderGraphs();
|
@@ -0,0 +1,125 @@
|
|
1
|
+
@media (prefers-color-scheme: dark) {
|
2
|
+
|
3
|
+
body {
|
4
|
+
background-color: #000;
|
5
|
+
color: #ccc;
|
6
|
+
}
|
7
|
+
|
8
|
+
a,
|
9
|
+
.title,
|
10
|
+
.summary_bar ul .count,
|
11
|
+
.navbar .navbar-brand {
|
12
|
+
color: #af0014;
|
13
|
+
}
|
14
|
+
|
15
|
+
.navbar .navbar-brand:hover {
|
16
|
+
color: #ccc;
|
17
|
+
}
|
18
|
+
|
19
|
+
.navbar .navbar-brand .status {
|
20
|
+
color: #ccc;
|
21
|
+
}
|
22
|
+
|
23
|
+
.navbar-inverse {
|
24
|
+
background-color: #000;
|
25
|
+
border-color: #333;
|
26
|
+
}
|
27
|
+
|
28
|
+
table.table-white {
|
29
|
+
background-color: #111;
|
30
|
+
}
|
31
|
+
|
32
|
+
.table-striped > tbody > tr:nth-of-type(odd) {
|
33
|
+
background-color: #222;
|
34
|
+
}
|
35
|
+
|
36
|
+
.table-bordered,
|
37
|
+
.table-bordered > tbody > tr > td,
|
38
|
+
.table-bordered > tbody > tr > th,
|
39
|
+
.table-bordered > tfoot > tr > td,
|
40
|
+
.table-bordered > tfoot > tr > th,
|
41
|
+
.table-bordered > thead > tr > td,
|
42
|
+
.table-bordered > thead > tr > th {
|
43
|
+
border: 1px solid #333;
|
44
|
+
}
|
45
|
+
|
46
|
+
.table-hover > tbody > tr:hover {
|
47
|
+
background-color: #333;
|
48
|
+
}
|
49
|
+
|
50
|
+
.alert {
|
51
|
+
border: none;
|
52
|
+
color: #ccc;
|
53
|
+
}
|
54
|
+
|
55
|
+
.alert-success {
|
56
|
+
background-color: #000;
|
57
|
+
}
|
58
|
+
|
59
|
+
a:link,
|
60
|
+
a:active,
|
61
|
+
a:hover,
|
62
|
+
a:visited {
|
63
|
+
color: #63798c;
|
64
|
+
}
|
65
|
+
|
66
|
+
a.btn {
|
67
|
+
color: #000;
|
68
|
+
}
|
69
|
+
|
70
|
+
.summary_bar .summary {
|
71
|
+
background-color: #000;
|
72
|
+
border: 1px solid #333;
|
73
|
+
}
|
74
|
+
|
75
|
+
.navbar-default {
|
76
|
+
background-color: #000;
|
77
|
+
border-color: #3d3d3d;
|
78
|
+
}
|
79
|
+
|
80
|
+
.navbar-default .navbar-nav > .active > a,
|
81
|
+
.navbar-default .navbar-nav > .active > a:focus,
|
82
|
+
.navbar-default .navbar-nav > .active > a:hover {
|
83
|
+
color: #ccc;
|
84
|
+
background-color: #282828;
|
85
|
+
}
|
86
|
+
|
87
|
+
.navbar-default .navbar-nav > li > a:hover {
|
88
|
+
color: #ccc;
|
89
|
+
}
|
90
|
+
|
91
|
+
.pagination > li > a,
|
92
|
+
.pagination > li > a:hover,
|
93
|
+
.pagination > li > span {
|
94
|
+
color: #ccc;
|
95
|
+
background-color: #282828;
|
96
|
+
border-color: #353535;
|
97
|
+
}
|
98
|
+
.pagination > .disabled > a,
|
99
|
+
.pagination > .disabled > a:focus,
|
100
|
+
.pagination > .disabled > a:hover,
|
101
|
+
.pagination > .disabled > span,
|
102
|
+
.pagination > .disabled > span:focus,
|
103
|
+
.pagination > .disabled > span:hover {
|
104
|
+
color: #a5a5a5;
|
105
|
+
background-color: #282828;
|
106
|
+
border-color: #353535;
|
107
|
+
}
|
108
|
+
|
109
|
+
.stat {
|
110
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
111
|
+
}
|
112
|
+
|
113
|
+
#live-poll {
|
114
|
+
color: #ccc;
|
115
|
+
}
|
116
|
+
|
117
|
+
.btn-warn {
|
118
|
+
color: #333;
|
119
|
+
}
|
120
|
+
|
121
|
+
.rickshaw_graph .y_ticks.glow text {
|
122
|
+
fill: #ccc;
|
123
|
+
color: #ccc;
|
124
|
+
}
|
125
|
+
}
|