class Fluent::Plugin::ObjectSpaceInput
def on_timer
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