No commit activity in last 3 years
No release in over 3 years
Shows Resque jobs key performance indciators over time
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.25.1
 Project Readme

resque-analytics¶ ↑

<img src=“https://badge.fury.io/rb/resque-analytics.svg” alt=“Gem Version” />

Resque jobs analytics and key performance indicators over time

This gem keeps statistics per worker for the last 90 days, to be later shown as over time graphs. For each worker, the gem keeps the following key performance indicators:

  • Number of times it executed successfuly per day

  • Number of times is failed per day

  • Total run time per day

  • Total wait time per day, which is the amount of time items for this worker were waiting in the queue

Wait is somewhat tricky, as Resque doesn’t provide the proper hooks to calculate this value. To handle that, I had to replace Resque’s push method, and Job initialization method. These methods now add a timestamp when items are added to queues, and use the timestamp to calculate the total wait time, when an item is taken out of the queue.

Note that wait time calculation changes the Resque object that is placed in the queues. It means that code that relies on object’s exact value will fail. A known conflict is with ts-resque-delta which deletes all queued jobs that have the same key. Adding a timestamp to each key, makes them unique, and conflicts with the keys deletion. See the usage section below for further details.

Installation¶ ↑

Requires resque ‘~> 1.25.1’, and googlecharts ‘~> 1.6.8’

Add the following to your gemfile:

gem 'resque-analytics', require: 'resque-analytics/server'

Usage¶ ↑

Extend Resque workers with:

class Worker
  extend Resque::Plugins::Analytics

  @queue = :queue
  def self.perform(*args)
    # ..
  end
end

On the Resque screens, you will find a new tab called “Analytics”.

If you wish to stop collection wait time for certain classes, add the following to your resque.rb initializer: Resque::Plugins::Analytics.ignore_classes = [‘worker_class’, …]

where worker class represents a job class for which you do not want to collect wait time metrics.

TODO¶ ↑

  • Add tests

Contributing to resque-analytics¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Contributers¶ ↑

Copyright © 2014 Nir Tzur. See LICENSE for further details.