module Resque::Plugins::Oink

Public Instance Methods

after_perform_with_oink_instrumentation(*args) click to toggle source
# File lib/resque/plugins/oink.rb, line 21
def after_perform_with_oink_instrumentation(*args)
  job_class = if self.kind_of?(Class)
                self.name
              else
                self.class.name
              end
  oink_logger.info "Oink Action: #{job_class}#perform"
  memory = ::Oink::Instrumentation::MemorySnapshot.memory
  oink_logger.info "Memory usage: #{memory} | PID: #{$$}"

  sorted_list = ::Oink::HashUtils.to_sorted_array(ActiveRecord::Base.instantiated_hash)
  sorted_list.unshift("Total: #{ActiveRecord::Base.total_objects_instantiated}")

  oink_logger.info "Instantiation Breakdown: #{sorted_list.join(' | ')}"

  oink_logger.info("Oink Log Entry Complete")

end
before_perform_with_oink_instrumentation(*args) click to toggle source
# File lib/resque/plugins/oink.rb, line 17
def before_perform_with_oink_instrumentation(*args)
  ActiveRecord::Base.reset_instance_type_count
end
oink_logger() click to toggle source
# File lib/resque/plugins/oink.rb, line 12
def oink_logger
  @oink_logger ||= Hodel3000CompliantLogger.new("log/resque-oink.log")
end