Skip to content

[WHIT-3127] Add rake task to get sidekiq stats#11205

Merged
lauraghiorghisor-tw merged 1 commit intomainfrom
add-rake-task-for-sidekiq-queues
Mar 9, 2026
Merged

[WHIT-3127] Add rake task to get sidekiq stats#11205
lauraghiorghisor-tw merged 1 commit intomainfrom
add-rake-task-for-sidekiq-queues

Conversation

@lauraghiorghisor-tw
Copy link
Copy Markdown
Contributor

This is to be used for future work on removing some aliased workers, but it is a handy task to have in general.

Jira

@lauraghiorghisor-tw lauraghiorghisor-tw changed the title Add rake task to get sidekiq stats [WHIT-3127] Add rake task to get sidekiq stats Mar 4, 2026
@lauraghiorghisor-tw lauraghiorghisor-tw force-pushed the add-rake-task-for-sidekiq-queues branch from 9a2f0d2 to be4d9e7 Compare March 4, 2026 17:33
Comment thread lib/tasks/sidekiq_queues_stats.rb Outdated
Comment thread lib/tasks/sidekiq_queues_stats.rb Outdated
Comment thread lib/tasks/sidekiq_queues_stats.rb Outdated
Comment thread lib/tasks/sidekiq_queues_stats.rb Outdated
Comment thread lib/tasks/sidekiq_queues_stats.rake Outdated

puts "\nTotal Jobs Across All Sets"
puts "--------------------------"
puts "Enqueued (All Queues): #{total_enqueued}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth also giving this a breakdown by class as well?

Copy link
Copy Markdown
Contributor Author

@lauraghiorghisor-tw lauraghiorghisor-tw Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean here, the breakdown by class is below.

Copy link
Copy Markdown
Contributor

@TonyGDS TonyGDS Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there enqueued jobs that make up the total other than scheduled, retried, dead? Just wondering if its worth seeing those as well.

Copy link
Copy Markdown
Contributor Author

@lauraghiorghisor-tw lauraghiorghisor-tw Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm

whitehall(prod):353> Sidekiq::Stats.new
=>
#<Sidekiq::Stats:0x0000ffff68ff7860
 @stats=
  {:processed=>xxxx,
   :failed=>xxxxx,
   :scheduled_size=>xxxx,
   :retry_size=>xxx,
   :dead_size=>xxxx,
   :processes_size=>xxx,
   :default_queue_latency=>xxx}>

Only failed and processed, which I don't think we care about too much. Nonetheless it got me thinking what enqueued means, and, TIL, enqueued is a separate stat in sidekiq, reading the actual queues, and that's different from the retry and schedule set. The difference is between calling perform_async (goes to queue) vs perform_at (go to scheduled set). I think it's useful to see a breakdown of the active enqueued jobs per queue so I added that too.

Comment thread lib/tasks/sidekiq_queues_stats.rb Outdated
@lauraghiorghisor-tw lauraghiorghisor-tw force-pushed the add-rake-task-for-sidekiq-queues branch from be4d9e7 to a5b891f Compare March 9, 2026 10:49
Copy link
Copy Markdown
Contributor

@TonyGDS TonyGDS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lauraghiorghisor-tw lauraghiorghisor-tw force-pushed the add-rake-task-for-sidekiq-queues branch 4 times, most recently from 3117818 to ac6e98c Compare March 9, 2026 11:37
This is to be used for future work on removing some aliased workers, but it is a handy task to have in general.
@lauraghiorghisor-tw lauraghiorghisor-tw force-pushed the add-rake-task-for-sidekiq-queues branch from ac6e98c to 63e7900 Compare March 9, 2026 11:40
@lauraghiorghisor-tw lauraghiorghisor-tw merged commit cac32e7 into main Mar 9, 2026
25 checks passed
@lauraghiorghisor-tw lauraghiorghisor-tw deleted the add-rake-task-for-sidekiq-queues branch March 9, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants