Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_network_error_at_init option to forward output. fix #731 #735

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/fluent/plugin/out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def initialize
config_param :phi_threshold, :integer, :default => 16
desc 'Use the "Phi accrual failure detector" to detect server failure.'
config_param :phi_failure_detector, :bool, :default => true
desc 'Skip network related error, e.g. DNS error, during plugin setup'
config_param :skip_network_error_at_init, :bool, :default => false

# if any options added that requires extended forward api, fix @extend_internal_protocol

Expand Down Expand Up @@ -131,7 +133,8 @@ def configure(conf)
failure = FailureDetector.new(@heartbeat_interval, @hard_timeout, Time.now.to_i.to_f)

node_conf = NodeConfig.new(name, host, port, weight, standby, failure,
@phi_threshold, recover_sample_size, @expire_dns_cache, @phi_failure_detector, @dns_round_robin)
@phi_threshold, recover_sample_size, @expire_dns_cache,
@phi_failure_detector, @dns_round_robin, @skip_network_error_at_init)

if @heartbeat_type == :none
@nodes << NoneHeartbeatNode.new(log, node_conf)
Expand Down Expand Up @@ -439,7 +442,8 @@ def on_heartbeat(sockaddr, msg)
end

NodeConfig = Struct.new("NodeConfig", :name, :host, :port, :weight, :standby, :failure,
:phi_threshold, :recover_sample_size, :expire_dns_cache, :phi_failure_detector, :dns_round_robin)
:phi_threshold, :recover_sample_size, :expire_dns_cache,
:phi_failure_detector, :dns_round_robin, :skip_network_error)

class Node
def initialize(log, conf)
Expand All @@ -454,7 +458,15 @@ def initialize(log, conf)

@resolved_host = nil
@resolved_time = 0
resolved_host # check dns
begin
resolved_host # check dns
rescue => e
if @conf.skip_network_error
log.warn "#{@name} got network error during setup. Resolve host later", :error => e, :error_class => e.class
else
raise
end
end
end

attr_reader :conf
Expand Down