class ActiveAdmin::SidekiqStats

Constants

CONTAINER_STYLE
VALUE_STYLE

Public Instance Methods

build(attributes = {}) click to toggle source
Calls superclass method
# File lib/active_admin/sidekiq_stats.rb, line 8
def build(attributes = {})
  super(attributes)

  panel('Sidekiq Stats') do
    div(style: CONTAINER_STYLE) do
      begin
        build_fields
      rescue Redis::CannotConnectError
        h1 'Redis Connection Failed'
      end
    end
  end
end

Private Instance Methods

build_fields() click to toggle source
# File lib/active_admin/sidekiq_stats.rb, line 24
def build_fields
  JSON.parse(Sidekiq::Stats.new.to_json).fetch('stats', Hash.new).yield_self do |stats|
    stats.each do |name, value|
      div style: VALUE_STYLE do
        h1 value.round
        span name.titleize
      end
    end
  end
rescue => e
  div { h3 e.message }
end