Class: Fluent::GCStatInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_gc_stat.rb

Defined Under Namespace

Classes: TimerWatcher

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary

Attributes inherited from Input

#router

Attributes included from PluginLoggerMixin

#log

Instance Method Summary collapse

Methods included from PluginLoggerMixin

included

Methods included from PluginId

#plugin_id

Methods included from Configurable

#config, included, lookup_type, register_type

Constructor Details

#initializeGCStatInput



25
26
27
# File 'lib/fluent/plugin/in_gc_stat.rb', line 25

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



48
49
50
# File 'lib/fluent/plugin/in_gc_stat.rb', line 48

def configure(conf)
  super
end

#on_timerObject



72
73
74
75
76
# File 'lib/fluent/plugin/in_gc_stat.rb', line 72

def on_timer
  now = Engine.now
  record = GC.stat
  router.emit(@tag, now, record)
end

#runObject



65
66
67
68
69
70
# File 'lib/fluent/plugin/in_gc_stat.rb', line 65

def run
  @loop.run
rescue
  log.error "unexpected error", error: $!.to_s
  log.error_backtrace
end

#shutdownObject



59
60
61
62
63
# File 'lib/fluent/plugin/in_gc_stat.rb', line 59

def shutdown
  @loop.watchers.each {|w| w.detach }
  @loop.stop
  @thread.join
end

#startObject



52
53
54
55
56
57
# File 'lib/fluent/plugin/in_gc_stat.rb', line 52

def start
  @loop = Coolio::Loop.new
  @timer = TimerWatcher.new(@emit_interval, true, log, &method(:on_timer))
  @loop.attach(@timer)
  @thread = Thread.new(&method(:run))
end