class Fluent::ObjectSpaceDumpInput
Dump out all live objects to json files. Each file is a snapshot of the Ruby heap at that time. See tmm1.net/ruby21-objspace/ for more details.
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_object_space_dump.rb, line 25 def initialize super ObjectSpace.trace_object_allocations_start end
Public Instance Methods
multi_workers_ready?()
click to toggle source
# File lib/fluent/plugin/in_object_space_dump.rb, line 35 def multi_workers_ready? true end
on_timer()
click to toggle source
# File lib/fluent/plugin/in_object_space_dump.rb, line 48 def on_timer GC.start # Use Tempfile.create to open the file, in order to preserve the file. file = Tempfile.create(["heap-#{fluentd_worker_id}-", '.json']) begin log.info 'dumping object space to', filepath: file.path, worker: fluentd_worker_id ObjectSpace.dump_all(output: file) ensure file.close end end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_object_space_dump.rb, line 39 def start super # Dump during startup. The timer only fires after @emit_interval. on_timer timer_execute(:object_space_dump_input, @emit_interval, &method(:on_timer)) end