ixti/sidekiq-throttled

Throttling working but nothing in the web UI

IanVaughan opened this issue · 3 comments

Versions:

Rails 7.0.4
ruby 3.1.3p185
sidekiq (6.5.8)
sidekiq-throttled (0.17.0)

class:

class TestJob
  include Sidekiq::Worker
  include Sidekiq::Throttled::Worker

  sidekiq_throttle(
    threshold: { limit: 100, period: 1.minute }
  )

  def perform; end
end

rails c

main:0> Sidekiq::Throttled::Registry.each_with_static_keys.first
=> nil

main:0> TestJob.perform_async
=> "e757608287200ff9f32eca25"

main:0> Sidekiq::Throttled::Registry.each_with_static_keys.first
=> ["TestJob",
 #<Sidekiq::Throttled::Strategy:0x00000001127eaf78
  @concurrency=#<Sidekiq::Throttled::StrategyCollection:0x00000001127eae88 @strategies=[]>,
  @observer=nil,
  @threshold=
   #<Sidekiq::Throttled::StrategyCollection:0x00000001127eacf8 @strategies=[#<Sidekiq::Throttled::Strategy::Threshold:0x00000001127eabb8 @base_key="throttled:TestJob:threshold", @key_suffix=nil, @limit=100, @period=1 minute>]>>]

sidekiq processed the job

2023-01-06T09:47:50.820Z pid=48639 tid=rd3 INFO: Booting Sidekiq 6.5.8 with Sidekiq::RedisConnection::RedisAdapter options {:id=>"Sidekiq-server-PID-48639"}


               m,
               `$b
          .ss,  $$:         .,d$
          `$$P,d$P'    .,md$P"'
           ,$$$$$b/md$$$P^'
         .d$$$$$$/$$$P'
         $$^' `"/$$$'       ____  _     _      _    _
         $:     ,$$:       / ___|(_) __| | ___| | _(_) __ _
         `b     :$$        \___ \| |/ _` |/ _ \ |/ / |/ _` |
                $$:         ___) | | (_| |  __/   <| | (_| |
                $$         |____/|_|\__,_|\___|_|\_\_|\__, |
              .d$$                                       |_|


2023-01-06T09:47:50.917Z pid=48639 tid=rd3 INFO: Booted Rails 7.0.4 application in development environment
2023-01-06T09:47:50.917Z pid=48639 tid=rd3 INFO: Running in ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
2023-01-06T09:47:50.917Z pid=48639 tid=rd3 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2023-01-06T09:47:50.917Z pid=48639 tid=rd3 INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org
2023-01-06T09:47:50.928Z pid=48639 tid=rd3 INFO: Starting processing, hit Ctrl-C to stop
2023-01-06T09:47:59.036Z pid=48639 tid=1e4n class=TestJob jid=e757608287200ff9f32eca25 INFO: start
2023-01-06T09:47:59.119Z pid=48639 tid=1e4n class=TestJob jid=e757608287200ff9f32eca25 elapsed=0.083 INFO: done

But the web UI shows nothing:

Screenshot 2023-01-06 at 09 48 23

I can see it in redis:

main:0> redis.keys("throttled*")
=> ["throttled:TestJob:threshold"]
# file config/routes.rb

require "sidekiq/web"
require "sidekiq/throttled/web"

Rails.application.routes.draw do
  # ...

  # Replace Sidekiq Queues with enhanced version!
  Sidekiq::Throttled::Web.enhance_queues_tab!

  # Mount Sidekiq Web UI to `/sidekiq` endpoint
  mount Sidekiq::Web => "/sidekiq"

  # ...
end

I've not had to replaced the tab on my other repos and they are working fine.
I'll give it a shot and report back, many thanks.

ixti commented

Sidekiq::Throttled::Web.enhance_queues_tab! was removed in v1.0.0.alpha (pauseable queues was extracted into sidekiq-pauzer gem). Let me know if you still experience the issue with 1.0.0.alpha or later.