Skip to content

Pro Web UI

Mike Perham edited this page Feb 1, 2022 · 12 revisions

See the Monitoring page for basics on setting up Sidekiq's Web UI. To activate the Sidekiq Pro web features, you must require it in your config/routes.rb:

require 'sidekiq/pro/web'

Your::Application.routes.draw do
  mount Sidekiq::Web => '/sidekiq'
end

Filtering

Sidekiq's retry set is very handy to diagnose and fix bugs in your code but it can fill up with hundreds or thousands of jobs, making it difficult at times to find the jobs you want to focus on.

Sidekiq Pro allows you to filter the jobs in the Dead, Retry and Scheduled sets to see only the jobs you care about:

filtering

Type any substring that can be found in the job data: the worker class, a snippet of the arguments, etc.

Redis does not allow filtering on queues because they are implemented via lists, not a data structure that can be scanned. See Redis SCAN Notes.

Sharding

Sidekiq Pro can monitor multiple Sidekiq shards in a single web process. You must create a different connection pool for each shard and mount a different copy of the Web UI for each shard:

require 'sidekiq-pro'
require 'sidekiq/pro/web'

POOL1 = ConnectionPool.new { Redis.new(:url => "redis://localhost:6379/0") }
POOL2 = ConnectionPool.new { Redis.new(:url => "redis://localhost:6378/0") }

mount Sidekiq::Web => '/sidekiq' # default
mount Sidekiq::Pro::Web.with(redis_pool: POOL1), at: '/sidekiq1', as: 'sidekiq1' # shard1
mount Sidekiq::Pro::Web.with(redis_pool: POOL2), at: '/sidekiq2', as: 'sidekiq2' # shard2

Rack example, in app.ru, then run with bundle exec rackup app.ru:

require 'sidekiq-pro'
require 'sidekiq/pro/web'
require 'securerandom'
require 'rack/urlmap'
require 'pry'

POOL1 = ConnectionPool.new(size: 5, timeout: 5) { Redis.new(url: 'redis://redis_2:6379/0') }
POOL2 = ConnectionPool.new(size: 5, timeout: 5) { Redis.new(url: 'redis://redis_3:6379/0') }
use Rack::Session::Cookie, secret: SecureRandom.hex(32), same_site: true, max_age: 86_400
run Rack::URLMap.new(
  '/sidekiq' => Sidekiq::Web,
  '/sidekiq1' => Sidekiq::Pro::Web.with(redis_pool: POOL1),
  '/sidekiq2' => Sidekiq::Pro::Web.with(redis_pool: POOL2),
)