Class: Fluent::Plugin::GCStatInput
- Defined in:
- lib/fluent/plugin/in_gc_stat.rb
Constant Summary
Constants included from Configurable
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary
Attributes included from Fluent::PluginLoggerMixin
Attributes inherited from Base
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ GCStatInput
constructor
A new instance of GCStatInput.
- #multi_workers_ready? ⇒ Boolean
- #on_timer ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Methods inherited from Input
#emit_records, #emit_size, #metric_callback, #statistics
Methods included from Fluent::PluginHelper::Mixin
Methods included from Fluent::PluginLoggerMixin
Methods included from Fluent::PluginId
#plugin_id, #plugin_id_configured?, #plugin_id_for_test?, #plugin_root_dir, #stop
Methods inherited from Base
#acquire_worker_lock, #after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #called_in_test?, #close, #closed?, #configured?, #context_router, #context_router=, #fluentd_worker_id, #get_lock_path, #has_router?, #inspect, #plugin_root_dir, #reloadable_plugin?, #shutdown?, #started?, #stop, #stopped?, #string_safe_encoding, #terminate, #terminated?
Methods included from SystemConfig::Mixin
#system_config, #system_config_override
Methods included from Configurable
#config, #configure_proxy_generate, #configured_section_create, included, lookup_type, register_type
Constructor Details
#initialize ⇒ GCStatInput
Returns a new instance of GCStatInput.
25 26 27 28 |
# File 'lib/fluent/plugin/in_gc_stat.rb', line 25 def initialize super @key_map = nil end |
Instance Method Details
#configure(conf) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fluent/plugin/in_gc_stat.rb', line 34 def configure(conf) super unless @use_symbol_keys @key_map = {} GC.stat.each_key { |key| @key_map[key] = key.to_s } end end |
#multi_workers_ready? ⇒ Boolean
45 46 47 |
# File 'lib/fluent/plugin/in_gc_stat.rb', line 45 def multi_workers_ready? true end |
#on_timer ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fluent/plugin/in_gc_stat.rb', line 59 def on_timer now = Fluent::EventTime.now record = GC.stat unless @use_symbol_keys new_record = {} record.each_pair { |k, v| new_record[@key_map[k]] = v } record = new_record end router.emit(@tag, now, record) end |
#shutdown ⇒ Object
55 56 57 |
# File 'lib/fluent/plugin/in_gc_stat.rb', line 55 def shutdown super end |
#start ⇒ Object
49 50 51 52 53 |
# File 'lib/fluent/plugin/in_gc_stat.rb', line 49 def start super timer_execute(:in_gc_stat, @emit_interval, &method(:on_timer)) end |