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

out_rdkafka2: Handle some of the exceptions as unrecoverable errors #510

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ You need to install rdkafka gem.
# load of both Fluentd and Kafka when excessive messages are attempted
# to send. Default is no limit.
max_enqueue_bytes_per_second (integer) :default => nil
unrecoverable_error_codes (array) :default => ["topic_authorization_failed", "msg_size_too_large"]

</match>

`rdkafka2` supports `discard_kafka_delivery_failed_regex` parameter:
Expand Down
9 changes: 8 additions & 1 deletion lib/fluent/plugin/out_rdkafka2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class Fluent::Rdkafka2Output < Output
config_param :max_enqueue_bytes_per_second, :size, :default => nil, :desc => 'The maximum number of enqueueing bytes per second'

config_param :service_name, :string, :default => nil, :desc => 'Used for sasl.kerberos.service.name'
config_param :unrecoverable_error_codes, :array, :default => ["topic_authorization_failed", "msg_size_too_large"],
:desc => 'Handle some of the error codes should be unrecoverable if specified'

config_section :buffer do
config_set_default :chunk_keys, ["topic"]
Expand Down Expand Up @@ -522,7 +524,12 @@ def enqueue_with_retry(producer, topic, record_buf, message_key, partition, head

raise e
else
raise e
if unrecoverable_error_codes.include?(e.code.to_s)
# some of the errors should be handled as an unrecoverable error
raise Fluent::UnrecoverableError, "Rejected due to #{e}"
else
raise e
end
end
end
end
Expand Down
Loading