Module: Resque::Plugins::Oink
- Defined in:
- lib/resque/plugins/oink.rb
Instance Method Summary collapse
- #after_perform_with_oink_instrumentation(*args) ⇒ Object
- #before_perform_with_oink_instrumentation(*args) ⇒ Object
- #oink_logger ⇒ Object
Instance Method Details
#after_perform_with_oink_instrumentation(*args) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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) ⇒ Object
17 18 19 |
# File 'lib/resque/plugins/oink.rb', line 17 def before_perform_with_oink_instrumentation(*args) ActiveRecord::Base.reset_instance_type_count end |
#oink_logger ⇒ Object
12 13 14 |
# File 'lib/resque/plugins/oink.rb', line 12 def oink_logger @oink_logger ||= Hodel3000CompliantLogger.new("log/resque-oink.log") end |