Class: Fluent::StatusInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_status.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

#initializeStatusInput

Returns a new instance of StatusInput.



21
22
23
# File 'lib/fluent/plugin/in_status.rb', line 21

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



44
45
46
47
# File 'lib/fluent/plugin/in_status.rb', line 44

def configure(conf)
  super
  $log.warn "in_status plugin will be removed v0.14 or later. Use in_monitor_agent instead"
end

#on_timerObject



69
70
71
72
73
74
# File 'lib/fluent/plugin/in_status.rb', line 69

def on_timer
  now = Engine.now
  Status.each {|record|
    router.emit(@tag, now, record)
  }
end

#runObject



62
63
64
65
66
67
# File 'lib/fluent/plugin/in_status.rb', line 62

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

#shutdownObject



56
57
58
59
60
# File 'lib/fluent/plugin/in_status.rb', line 56

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

#startObject



49
50
51
52
53
54
# File 'lib/fluent/plugin/in_status.rb', line 49

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