mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 07:59:08 +01:00
admin/dashboard: add basic sidekiq stats and warn if sidekiq is not running
This commit is contained in:
parent
b53538ccb8
commit
cf88da111c
2 changed files with 35 additions and 2 deletions
|
@ -1,7 +1,14 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "sidekiq/api"
|
||||||
|
|
||||||
class Admin::DashboardController < ApplicationController
|
class Admin::DashboardController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
def index; end
|
def index
|
||||||
|
@sidekiq = {
|
||||||
|
processes: Sidekiq::ProcessSet.new,
|
||||||
|
stats: Sidekiq::Stats.new
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,31 @@
|
||||||
.card
|
.card
|
||||||
.card-body
|
.card-body
|
||||||
No dashboard content yet!
|
%h2
|
||||||
|
Sidekiq
|
||||||
|
|
||||||
|
%a{ href: sidekiq_web_path } View dashboard
|
||||||
|
|
||||||
|
- unless @sidekiq[:processes].count.positive?
|
||||||
|
.alert.alert-danger{ role: :alert }
|
||||||
|
%strong There are no Sidekiq processes running.
|
||||||
|
Background jobs will not be processed.
|
||||||
|
%br
|
||||||
|
To fix this, run
|
||||||
|
%tt RAILS_ENV=#{Rails.env} bundle exec sidekiq
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
%tbody
|
||||||
|
%tr
|
||||||
|
%th Processes
|
||||||
|
%td= @sidekiq[:processes].count
|
||||||
|
%tr
|
||||||
|
%th Enqueued
|
||||||
|
%td= @sidekiq[:stats].enqueued
|
||||||
|
%tr
|
||||||
|
%th Retries
|
||||||
|
%td= @sidekiq[:stats].retry_size
|
||||||
|
%tr
|
||||||
|
%th Dead
|
||||||
|
%td= @sidekiq[:stats].dead_size
|
||||||
|
|
||||||
- parent_layout "admin"
|
- parent_layout "admin"
|
||||||
|
|
Loading…
Reference in a new issue