class Fluent::Plugin::BareOutput
Public Class Methods
new()
click to toggle source
Calls superclass method
Fluent::PluginLoggerMixin::new
# File lib/fluent/plugin/bare_output.rb, line 59 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
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
Fluent::PluginLoggerMixin#configure
# File lib/fluent/plugin/bare_output.rb, line 69 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_records", 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_count()
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 47 def emit_count @emit_count_metrics.get end
emit_records()
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 55 def emit_records @emit_records_metrics.get end
emit_size()
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 51 def emit_size @emit_size_metrics.get end
emit_sync(tag, es)
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 90 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
Also aliased as: emit_events
num_errors()
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 43 def num_errors @num_errors_metrics.get end
process(tag, es)
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 39 def process(tag, es) raise NotImplementedError, "BUG: output plugins MUST implement this method" end
statistics()
click to toggle source
# File lib/fluent/plugin/bare_output.rb, line 79 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