Class: Fluent::Plugin::BareOutput
- Defined in:
- lib/fluent/plugin/bare_output.rb
Direct Known Subclasses
Constant Summary
Constants included from Configurable
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary collapse
-
#emit_count ⇒ Object
readonly
Returns the value of attribute emit_count.
-
#emit_records ⇒ Object
readonly
Returns the value of attribute emit_records.
-
#num_errors ⇒ Object
readonly
Returns the value of attribute num_errors.
Attributes included from Fluent::PluginLoggerMixin
Attributes inherited from Base
Instance Method Summary collapse
- #emit_sync(tag, es) ⇒ Object (also: #emit_events)
-
#initialize ⇒ BareOutput
constructor
A new instance of BareOutput.
- #process(tag, es) ⇒ Object
Methods included from Fluent::PluginHelper::Mixin
Methods included from Fluent::PluginLoggerMixin
#configure, included, #terminate
Methods included from Fluent::PluginId
#configure, #plugin_id, #plugin_id_configured?, #plugin_id_for_test?, #plugin_root_dir, #stop
Methods inherited from Base
#after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #called_in_test?, #close, #closed?, #configure, #configured?, #context_router, #context_router=, #fluentd_worker_id, #has_router?, #inspect, #multi_workers_ready?, #plugin_root_dir, #reloadable_plugin?, #shutdown, #shutdown?, #start, #started?, #stop, #stopped?, #string_safe_encoding, #terminate, #terminated?
Methods included from SystemConfig::Mixin
#system_config, #system_config_override
Methods included from Configurable
#config, #configure, #configure_proxy_generate, #configured_section_create, included, lookup_type, register_type
Constructor Details
#initialize ⇒ BareOutput
Returns a new instance of BareOutput.
41 42 43 44 45 46 47 48 |
# File 'lib/fluent/plugin/bare_output.rb', line 41 def initialize super @counter_mutex = Mutex.new # TODO: well organized counters @num_errors = 0 @emit_count = 0 @emit_records = 0 end |
Instance Attribute Details
#emit_count ⇒ Object (readonly)
Returns the value of attribute emit_count.
35 36 37 |
# File 'lib/fluent/plugin/bare_output.rb', line 35 def emit_count @emit_count end |
#emit_records ⇒ Object (readonly)
Returns the value of attribute emit_records.
35 36 37 |
# File 'lib/fluent/plugin/bare_output.rb', line 35 def emit_records @emit_records end |
#num_errors ⇒ Object (readonly)
Returns the value of attribute num_errors.
35 36 37 |
# File 'lib/fluent/plugin/bare_output.rb', line 35 def num_errors @num_errors end |
Instance Method Details
#emit_sync(tag, es) ⇒ Object Also known as: emit_events
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fluent/plugin/bare_output.rb', line 50 def emit_sync(tag, es) @counter_mutex.synchronize{ @emit_count += 1 } begin process(tag, es) @counter_mutex.synchronize{ @emit_records += es.size } rescue @counter_mutex.synchronize{ @num_errors += 1 } raise end end |
#process(tag, es) ⇒ Object
37 38 39 |
# File 'lib/fluent/plugin/bare_output.rb', line 37 def process(tag, es) raise NotImplementedError, "BUG: output plugins MUST implement this method" end |