Merge pull request #869 from Retrospring/feature/sidekiq-info-in-admin-dashboard
admin/dashboard: add basic sidekiq stats and warn if sidekiq is not running
This commit is contained in:
commit
fda6d261de
|
@ -1,7 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "sidekiq/api"
|
||||
|
||||
class Admin::DashboardController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index; end
|
||||
def index
|
||||
@sidekiq = {
|
||||
processes: Sidekiq::ProcessSet.new,
|
||||
stats: Sidekiq::Stats.new
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
.card
|
||||
.card-header
|
||||
%a.d-flex{ href: sidekiq_web_path }
|
||||
%strong= t(".title")
|
||||
%i.fa.fa-chevron-right.ml-auto.align-self-center
|
||||
- unless @sidekiq[:processes].count.positive?
|
||||
.card-body.bg-danger.text-light
|
||||
= t(".error_html", env: Rails.env)
|
||||
|
||||
.list-group
|
||||
.list-group-item.d-flex
|
||||
%span= t(".processes")
|
||||
%span.ml-auto= @sidekiq[:processes].count
|
||||
.list-group-item.d-flex
|
||||
%span= t(".enqueued")
|
||||
%span.ml-auto= @sidekiq[:stats].enqueued
|
||||
.list-group-item.d-flex
|
||||
%span= t(".retries")
|
||||
%span.ml-auto= @sidekiq[:stats].retry_size
|
||||
.list-group-item.d-flex
|
||||
%span= t(".dead")
|
||||
%span.ml-auto= @sidekiq[:stats].dead_size
|
|
@ -1,5 +1,5 @@
|
|||
.card
|
||||
.card-body
|
||||
No dashboard content yet!
|
||||
.row
|
||||
.col-sm-6
|
||||
= render "admin/dashboard/sidekiq"
|
||||
|
||||
- parent_layout "admin"
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
.card
|
||||
.list-group
|
||||
= list_group_item t(".rails"), rails_admin_path
|
||||
= list_group_item t(".sidekiq"), sidekiq_web_path
|
||||
= list_group_item t(".pghero"), pghero_path
|
||||
|
|
|
@ -88,6 +88,19 @@ en:
|
|||
title: "Create Announcement"
|
||||
edit:
|
||||
title: "Edit Announcement"
|
||||
dashboard:
|
||||
sidekiq:
|
||||
title: "Sidekiq"
|
||||
error_html: |
|
||||
<strong>There are no Sidekiq processes running.</strong>
|
||||
Background jobs will not be processed.
|
||||
<br/>
|
||||
To fix this, run
|
||||
<tt>RAILS_ENV=%{env} bundle exec sidekiq</tt>
|
||||
processes: "Processes"
|
||||
enqueued: "Enqueued"
|
||||
retries: "Retries"
|
||||
dead: "Dead"
|
||||
answerbox:
|
||||
header:
|
||||
anon_hint: :inbox.entry.anon_hint
|
||||
|
|
Loading…
Reference in New Issue