Module: Fluent::PluginHelper::ServiceDiscovery

Includes:
Timer
Defined in:
lib/fluent/plugin_helper/service_discovery.rb,
lib/fluent/plugin_helper/service_discovery/manager.rb,
lib/fluent/plugin_helper/service_discovery/round_robin_balancer.rb

Defined Under Namespace

Modules: ServiceDiscoveryParams Classes: Manager, RoundRobinBalancer

Constant Summary

Constants included from EventLoop

EventLoop::EVENT_LOOP_RUN_DEFAULT_TIMEOUT, EventLoop::EVENT_LOOP_SHUTDOWN_TIMEOUT

Constants included from Thread

Thread::THREAD_DEFAULT_WAIT_SECONDS, Thread::THREAD_SHUTDOWN_HARD_TIMEOUT_IN_TESTS

Instance Attribute Summary collapse

Attributes included from Timer

#_timers

Attributes included from EventLoop

#_event_loop

Attributes included from Thread

#_threads

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Timer

#initialize, #stop, #terminate, #timer_execute, #timer_running?

Methods included from EventLoop

#after_shutdown, #close, #event_loop_attach, #event_loop_detach, #event_loop_running?, #event_loop_wait_until_start, #event_loop_wait_until_stop, #initialize, #shutdown, #terminate

Methods included from Thread

#after_shutdown, #close, #initialize, #stop, #terminate, #thread_create, #thread_current_running?, #thread_exist?, #thread_running?, #thread_started?, #thread_wait_until_start, #thread_wait_until_stop

Instance Attribute Details

#service_discoveryObject (readonly)

For the compatibility with older versions without ‘param_name: :service_discovery_configs`



26
27
28
# File 'lib/fluent/plugin_helper/service_discovery.rb', line 26

def service_discovery
  @service_discovery
end

Class Method Details

.included(mod) ⇒ Object



28
29
30
# File 'lib/fluent/plugin_helper/service_discovery.rb', line 28

def self.included(mod)
  mod.include ServiceDiscoveryParams
end

Instance Method Details

#configure(conf) ⇒ Object



32
33
34
35
36
# File 'lib/fluent/plugin_helper/service_discovery.rb', line 32

def configure(conf)
  super
  # For the compatibility with older versions without `param_name: :service_discovery_configs`
  @service_discovery = @service_discovery_configs
end

#startObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fluent/plugin_helper/service_discovery.rb', line 38

def start
  unless @discovery_manager
    log.warn('There is no discovery_manager. skip start them')
    super
    return
  end

  @discovery_manager.start
  unless @discovery_manager.static_config?
    timer_execute(@_plugin_helper_service_discovery_title, @_plugin_helper_service_discovery_interval) do
      @discovery_manager.run_once
    end
  end

  super
end