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
Attributes included from Fluent::PluginLoggerMixin
Attributes inherited from Base
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #emit_sync(tag, es) ⇒ Object (also: #emit_events)
-
#initialize ⇒ BareOutput
constructor
A new instance of BareOutput.
- #process(tag, es) ⇒ Object
- #statistics ⇒ Object
Methods included from Fluent::PluginLoggerMixin
Methods included from Fluent::PluginId
#plugin_id, #plugin_id_configured?, #plugin_id_for_test?, #plugin_root_dir, #stop
Methods included from Fluent::PluginHelper::Mixin
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, #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_proxy_generate, #configured_section_create, included, lookup_type, register_type
Constructor Details
#initialize ⇒ BareOutput
Returns a new instance of BareOutput.
43 44 45 46 47 48 49 50 51 |
# File 'lib/fluent/plugin/bare_output.rb', line 43 def initialize super @counter_mutex = Mutex.new # TODO: well organized counters @num_errors_metrics = nil @emit_count_metrics = nil @emit_records_metrics = nil @emit_size_metrics = nil end |
Instance Method Details
#configure(conf) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/fluent/plugin/bare_output.rb', line 53 def configure(conf) super @num_errors_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "num_errors", help_text: "Number of count num errors") @emit_count_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "emit_count", help_text: "Number of count emits") @emit_records_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "emit_records", help_text: "Number of emit records") @emit_size_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "emit_size", help_text: "Total size of emit events") @enable_size_metrics = !!system_config.enable_size_metrics end |
#emit_sync(tag, es) ⇒ Object Also known as: emit_events
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/fluent/plugin/bare_output.rb', line 74 def emit_sync(tag, es) @emit_count_metrics.inc begin process(tag, es) @emit_records_metrics.add(es.size) @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics rescue @num_errors_metrics.inc raise end end |
#process(tag, es) ⇒ Object
39 40 41 |
# File 'lib/fluent/plugin/bare_output.rb', line 39 def process(tag, es) raise NotImplementedError, "BUG: output plugins MUST implement this method" end |
#statistics ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fluent/plugin/bare_output.rb', line 63 def statistics stats = { 'num_errors' => @num_errors_metrics.get, 'emit_records' => @emit_records_metrics.get, 'emit_count' => @emit_count_metrics.get, 'emit_size' => @emit_size_metrics.get, } { 'bare_output' => stats } end |