Search code examples
ruby-on-railssidekiqsidekiq-monitor

Monitoring a particular sidekiq queue in a rails application


As per the documentation for sidekiq monitoring at https://github.com/mperham/sidekiq/wiki/Monitoring if we need to monitor the queue backlog we add the following to config/routes.rb

require 'sidekiq/api'
match "queue-status" => proc { [200, {"Content-Type" => "text/plain"}, [Sidekiq::Queue.new.size < 100 ? "OK" : "UHOH" ]] }, via: :get

To monitor the latency

match "queue-latency" => proc { [200, {"Content-Type" => "text/plain"}, [Sidekiq::Queue.new.latency < 30 ? "OK" : "UHOH" ]] }, via: :get

Q1. I have multiple queues in my application called order_submission, mailers, critical and default. If i want to monitor the backlog or latency for a particular queue say 'order_submission' how can i do that ?

Q2. The documentation also says that We have a Pingdom check every minute which fires off an email if the response == 'UHOH' for the following

match "queue-status" => proc { [200, {"Content-Type" => "text/plain"}, [Sidekiq::Queue.new.size < 100 ? "OK" : "UHOH" ]] }, via: :get

I know the Pingdom service is used to hit urls for testing performance and availability but its not clear to me what it means that there is already a pingdom check that runs every minute and sends the email . Would like to have clarification on this.

Thanks


Solution

  • A1 You may pass queue name:

    Sidekiq::Queue.new('my_queue').size
    

    A2 I didn't work with Pingdom, so I can just advise to:

    1. Check their docs, whether they can parse response or not.
    2. Change responce status when queque status is not OK, choose one from the list.