Class: Fluent::Plugin::RoundRobinOutput

Inherits:
MultiOutput show all
Defined in:
lib/fluent/plugin/out_roundrobin.rb

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary collapse

Attributes inherited from MultiOutput

#outputs, #outputs_statically_created

Attributes included from Fluent::PluginLoggerMixin

#log

Attributes inherited from Base

#under_plugin_development

Instance Method Summary collapse

Methods inherited from MultiOutput

#after_shutdown, #after_start, #before_shutdown, #call_lifecycle_method, #close, #emit_count, #emit_records, #emit_size, #emit_sync, #multi_output?, #num_errors, #shutdown, #static_outputs, #statistics, #stop, #terminate

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

#initializeRoundRobinOutput

Returns a new instance of RoundRobinOutput.



28
29
30
31
# File 'lib/fluent/plugin/out_roundrobin.rb', line 28

def initialize
  super
  @weights = []
end

Instance Attribute Details

#weightsObject (readonly)

Returns the value of attribute weights.



33
34
35
# File 'lib/fluent/plugin/out_roundrobin.rb', line 33

def weights
  @weights
end

Instance Method Details

#configure(conf) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/fluent/plugin/out_roundrobin.rb', line 35

def configure(conf)
  super

  @stores.each do |store|
    @weights << store.weight
  end
  @rr = -1  # starts from @output[0]
  @rand_seed = Random.new.seed
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fluent/plugin/out_roundrobin.rb', line 45

def multi_workers_ready?
  true
end

#process(tag, es) ⇒ Object



54
55
56
# File 'lib/fluent/plugin/out_roundrobin.rb', line 54

def process(tag, es)
  next_output.emit_events(tag, es)
end

#startObject



49
50
51
52
# File 'lib/fluent/plugin/out_roundrobin.rb', line 49

def start
  super
  rebuild_weight_array
end