Module: Fluent::PluginHelper::Counter

Defined in:
lib/fluent/plugin_helper/counter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_counter_clientObject (readonly)

Returns the value of attribute _counter_client.



33
34
35
# File 'lib/fluent/plugin_helper/counter.rb', line 33

def _counter_client
  @_counter_client
end

Instance Method Details

#counter_client_create(scope:, loop: Coolio::Loop.new) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/fluent/plugin_helper/counter.rb', line 23

def counter_client_create(scope:, loop: Coolio::Loop.new)
  client_conf = system_config.counter_client
  raise Fluent::ConfigError, '<counter_client> is required in <system>' unless client_conf
  counter_client = Fluent::Counter::Client.new(loop, port: client_conf.port, host: client_conf.host, log: log, timeout: client_conf.timeout)
  counter_client.start
  counter_client.establish(scope)
  @_counter_client = counter_client
  counter_client
end

#initializeObject



35
36
37
38
# File 'lib/fluent/plugin_helper/counter.rb', line 35

def initialize
  super
  @_counter_client = nil
end

#stopObject



40
41
42
43
# File 'lib/fluent/plugin_helper/counter.rb', line 40

def stop
  super
  @_counter_client.stop
end

#terminateObject



45
46
47
48
# File 'lib/fluent/plugin_helper/counter.rb', line 45

def terminate
  @_counter_client = nil
  super
end