Module: GCStats::GCLogger::ClassMethods

Defined in:
lib/gc_stats/gc_logger.rb

Instance Method Summary collapse

Instance Method Details

#log_process_action(payload) ⇒ Object

ActionController hook to add the process ID and GC info on to the info message to be logged as part of the request event.

Parameters:

  • payload (Hash)

    hash containing additional info to be logged



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gc_stats/gc_logger.rb', line 13

def log_process_action(payload)
  messages = super
  messages << "PID: #{Process.pid}"

  gc_time = GC::Profiler.total_time
  if gc_time > 0
    messages << "GC: [total_gc_time: #{gc_time*1000} ms |" \
      " num_events: #{GC::Profiler.raw_data.count} | major/minor/count:" \
      " #{GC.stat[:major_gc_count]}/#{GC.stat[:minor_gc_count]}/#{GC.count}]"
  end

  messages
end