Class: Rabbitek::Server::Hooks::TimeTracker

Inherits:
Rabbitek::ServerHook show all
Includes:
Loggable
Defined in:
lib/rabbitek/server/hooks/time_tracker.rb

Overview

Hook to keep track of time used for processing single job

Instance Method Summary collapse

Methods included from Loggable

#debug, #error, #info, #logger, logger, #warn

Instance Method Details

#call(consumer, message) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rabbitek/server/hooks/time_tracker.rb', line 13

def call(consumer, message)
  log_started(consumer, message)

  start = current_time

  super
ensure
  total_time = current_time - start

  log_finished(consumer, message, total_time)
  metrics_measure_time(consumer, total_time)
end