Class: Fluent::Plugin::BareOutput

Inherits:
Base
  • Object
show all
Includes:
Fluent::PluginHelper::Mixin, Fluent::PluginId, Fluent::PluginLoggerMixin
Defined in:
lib/fluent/plugin/bare_output.rb

Direct Known Subclasses

Compat::MultiOutput

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary collapse

Attributes included from Fluent::PluginLoggerMixin

#log

Attributes inherited from Base

#under_plugin_development

Instance Method Summary collapse

Methods included from Fluent::PluginHelper::Mixin

included

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

#initializeBareOutput

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_countObject (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_recordsObject (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_errorsObject (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

Raises:

  • (NotImplementedError)


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