Class: Fluent::Plugin::Input

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

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary

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

included, #terminate

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, #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

#initializeInput

Returns a new instance of Input.



32
33
34
35
36
37
38
# File 'lib/fluent/plugin/input.rb', line 32

def initialize
  super
  @emit_records_metrics = nil
  @emit_size_metrics = nil
  @counter_mutex = Mutex.new
  @enable_size_metrics = false
end

Instance Method Details

#configure(conf) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/fluent/plugin/input.rb', line 48

def configure(conf)
  super

  @emit_records_metrics = metrics_create(namespace: "fluentd", subsystem: "input", name: "emit_records", help_text: "Number of count emit records")
  @emit_size_metrics = metrics_create(namespace: "fluentd", subsystem: "input", name: "emit_size", help_text: "Total size of emit events")
  @enable_size_metrics = !!system_config.enable_size_metrics
end

#emit_recordsObject



40
41
42
# File 'lib/fluent/plugin/input.rb', line 40

def emit_records
  @emit_records_metrics.get
end

#emit_sizeObject



44
45
46
# File 'lib/fluent/plugin/input.rb', line 44

def emit_size
  @emit_size_metrics.get
end

#metric_callback(es) ⇒ Object



65
66
67
68
# File 'lib/fluent/plugin/input.rb', line 65

def metric_callback(es)
  @emit_records_metrics.add(es.size)
  @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/fluent/plugin/input.rb', line 70

def multi_workers_ready?
  false
end

#statisticsObject



56
57
58
59
60
61
62
63
# File 'lib/fluent/plugin/input.rb', line 56

def statistics
  stats = {
    'emit_records' => @emit_records_metrics.get,
    'emit_size' => @emit_size_metrics.get,
  }

  { 'input' => stats }
end