Class: Fluent::GCStatInput
- Inherits:
-
Input
- Object
- Input
- Fluent::GCStatInput
show all
- Defined in:
- lib/fluent/plugin/in_gc_stat.rb
Defined Under Namespace
Classes: TimerWatcher
Constant Summary
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary
Attributes inherited from Input
#router
#log
Instance Method Summary
collapse
included
Methods included from PluginId
#plugin_id
#config, included, lookup_type, register_type
Constructor Details
25
26
27
|
# File 'lib/fluent/plugin/in_gc_stat.rb', line 25
def initialize
super
end
|
Instance Method Details
48
49
50
|
# File 'lib/fluent/plugin/in_gc_stat.rb', line 48
def configure(conf)
super
end
|
#on_timer ⇒ Object
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
|
#run ⇒ Object
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
|
#shutdown ⇒ Object
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
|
#start ⇒ Object
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
|