diff --git a/Changes.md b/Changes.md index e46be3a5..99d8d5a7 100644 --- a/Changes.md +++ b/Changes.md @@ -29,6 +29,7 @@ If this is a bare Rack app, use a session middleware before Sidekiq::Web: use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400 run Sidekiq::Web ``` +- Add process/thread count summary to Busy page [#4806] 6.1.3 --------- diff --git a/lib/sidekiq/api.rb b/lib/sidekiq/api.rb index fbaf0cb0..05ab5f5b 100644 --- a/lib/sidekiq/api.rb +++ b/lib/sidekiq/api.rb @@ -806,7 +806,7 @@ module Sidekiq yield Process.new(hash.merge("busy" => busy.to_i, "beat" => at_s.to_f, "quiet" => quiet, - "rss" => rss)) + "rss" => rss.to_i)) end end @@ -818,6 +818,17 @@ module Sidekiq Sidekiq.redis { |conn| conn.scard("processes") } end + # Total number of threads available to execute jobs. + # For Sidekiq Enterprise customers this number (in production) must be + # less than or equal to your licensed concurrency. + def total_concurrency + sum { |x| x["concurrency"] } + end + + def total_rss + sum { |x| x["rss"] || 0 } + end + # Returns the identity of the current cluster leader or "" if no leader. # This is a Sidekiq Enterprise feature, will always return "" in Sidekiq # or Sidekiq Pro. diff --git a/lib/sidekiq/web/helpers.rb b/lib/sidekiq/web/helpers.rb index 71a279bc..ef272abb 100644 --- a/lib/sidekiq/web/helpers.rb +++ b/lib/sidekiq/web/helpers.rb @@ -22,6 +22,14 @@ module Sidekiq end end + def singularize(str, count) + if count == 1 && str.respond_to?(:singularize) # rails + str.singularize + else + str + end + end + def clear_caches @strings = nil @locale_files = nil @@ -263,8 +271,10 @@ module Sidekiq if rss_kb < 100_000 "#{number_with_delimiter(rss_kb)} KB" - else + elsif rss_kb < 10_000_000 "#{number_with_delimiter((rss_kb / 1024.0).to_i)} MB" + else + "#{number_with_delimiter((rss_kb / (1024.0 * 1024.0)).round(1))} GB" end end diff --git a/web/assets/stylesheets/application.css b/web/assets/stylesheets/application.css index ceff1dbf..b935e369 100644 --- a/web/assets/stylesheets/application.css +++ b/web/assets/stylesheets/application.css @@ -186,7 +186,7 @@ form .btn { } form .btn-group .btn { - margin-right: 1px; + margin-right: 4px; } td form { diff --git a/web/views/busy.erb b/web/views/busy.erb index c1487cff..2c2bc905 100644 --- a/web/views/busy.erb +++ b/web/views/busy.erb @@ -1,8 +1,39 @@
<%= t('Processes') %>
+<%= t('Threads') %>
+<%= t('Busy') %>
+<%= t('Utilization') %>
+<%= t('RSS') %>
+