Class: RoundhouseUi::DashboardController

Inherits:
ApplicationController show all
Defined in:
app/controllers/roundhouse_ui/dashboard_controller.rb

Overview

The dashboard reads straight from Sidekiq's API — no database, no models. Everything here comes out of Redis via Sidekiq::Stats / Sidekiq::Queue.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::AUDIT_VERBS

Instance Method Summary collapse

Methods inherited from ApplicationController

#redirect_to

Instance Method Details

#showObject



5
6
7
8
# File 'app/controllers/roundhouse_ui/dashboard_controller.rb', line 5

def show
  @stats  = Sidekiq::Stats.new
  @queues = Sidekiq::Queue.all
end

#statsObject

Polled by the dashboard for live counts (same approach Sidekiq Web uses — cheap JSON, no WebSocket/build step required).



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/roundhouse_ui/dashboard_controller.rb', line 12

def stats
  s = Sidekiq::Stats.new
  render json: {
    processed: s.processed,
    failed:    s.failed,
    enqueued:  s.enqueued,
    busy:      s.workers_size,
    scheduled: s.scheduled_size,
    retries:   s.retry_size,
    dead:      s.dead_size,
    queues:    Sidekiq::Queue.all.size
  }
end