class Fluent::Plugin::ObjectSpaceInput
Public Class Methods
new()
click to toggle source
Calls superclass method
Fluent::PluginLoggerMixin::new
# File lib/fluent/plugin/in_object_space.rb, line 27 def initialize super end
Public Instance Methods
multi_workers_ready?()
click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 35 def multi_workers_ready? true end
on_timer()
click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 62 def on_timer now = Fluent::EventTime.now array = [] map = {} ObjectSpace.each_object {|obj| klass = obj.class rescue Object if c = map[klass] c.incr! else c = Counter.new(klass, 1) array << c map[klass] = c end } array.sort_by! {|c| -c.count } record = {} array.each_with_index {|c,i| break if i >= @top record[c.name] = c.count } router.emit(@tag, now, record) rescue => e log.error "object space failed to emit", error: e, tag: @tag, record: Yajl.dump(record) log.error_backtrace end
start()
click to toggle source
Calls superclass method
Fluent::Plugin::Base#start
# File lib/fluent/plugin/in_object_space.rb, line 39 def start super timer_execute(:object_space_input, @emit_interval, &method(:on_timer)) end