Class: Fluent::Plugin::DebugAgentInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_debug_agent.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 inherited from Input

#emit_records, #emit_size, #metric_callback, #statistics

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

#initializeDebugAgentInput

Returns a new instance of DebugAgentInput.



23
24
25
26
27
# File 'lib/fluent/plugin/in_debug_agent.rb', line 23

def initialize
  require 'drb/drb'
  require 'fluent/plugin/file_util'
  super
end

Instance Method Details

#configure(conf) ⇒ Object



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

def configure(conf)
  super
  if system_config.workers > 1
    @port += fluentd_worker_id
  end
  if @unix_path
    unless ::Fluent::FileUtil.writable?(@unix_path)
      raise Fluent::ConfigError, "in_debug_agent: `#{@unix_path}` is not writable"
    end
  end
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/fluent/plugin/in_debug_agent.rb', line 47

def multi_workers_ready?
  @unix_path.nil?
end

#shutdownObject



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

def shutdown
  @server.stop_service if @server

  super
end

#startObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fluent/plugin/in_debug_agent.rb', line 51

def start
  super

  if @unix_path
    require 'drb/unix'
    uri = "drbunix:#{@unix_path}"
  else
    uri = "druby://#{@bind}:#{@port}"
  end
  log.info "listening dRuby", uri: uri, object: @object, worker: fluentd_worker_id
  obj = eval(@object)
  @server = DRb::DRbServer.new(uri, obj)
end