Parent

Class/Module Index [+]

Quicksearch

Fluent::ObjectSpaceInput

Public Class Methods

new() click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 24
def initialize
  super
end

Public Instance Methods

configure(conf) click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 47
def configure(conf)
  super
end
on_timer() click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 88
def on_timer
  now = Engine.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
  }

  Engine.emit(@tag, now, record)
end
run() click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 64
def run
  @loop.run
rescue
  $log.error "unexpected error", :error=>$!.to_s
  $log.error_backtrace
end
shutdown() click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 58
def shutdown
  @loop.watchers.each {|w| w.detach }
  @loop.stop
  @thread.join
end
start() click to toggle source
# File lib/fluent/plugin/in_object_space.rb, line 51
def start
  @loop = Coolio::Loop.new
  @timer = TimerWatcher.new(@emit_interval, true, &method(:on_timer))
  @loop.attach(@timer)
  @thread = Thread.new(&method(:run))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.