fluent-plugin-kafka 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/README.md +2 -0
- data/fluent-plugin-kafka.gemspec +1 -1
- data/lib/fluent/plugin/out_rdkafka2.rb +34 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 342b66e96b3175aed8f7fe9bc0f29bb03f2737924229eaa63d7ffd408f5209cf
|
4
|
+
data.tar.gz: 89a9361a2c599eca1419668136ecb722c6eaa95e9ebc55f2e2a2be3f1346cafc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0172977463edc0ff6085588bcded5bf3d33412e088422bf48954672507d7661bda68735d1415fcc9dcaebd132eff355cc714be619c15a107962e12dc69eba4e1'
|
7
|
+
data.tar.gz: 00054cf6be46a6041fd6f8712f3159f832f91deffcf34feef45fff919d2301b2e04b5ec0493a2d9086af87c3ce9ec37ca0f004a9fac006ee4e3c17d20b372984
|
data/ChangeLog
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
Release 0.19.1 - 2023/09/20
|
2
|
+
* out_rdkafka2: Add `use_default_for_unknown_topic` & `use_default_for_unknown_partition_error`
|
3
|
+
|
1
4
|
Release 0.19.0 - 2023/04/26
|
2
5
|
* out_kafka2: Add support for AWS IAM authentication
|
3
6
|
* in_kafka, in_kafka_group, out_kafka2: Add support for ssl client cert key password
|
data/README.md
CHANGED
@@ -510,6 +510,8 @@ You need to install rdkafka gem.
|
|
510
510
|
partition_key_key (string) :default => 'partition_key'
|
511
511
|
message_key_key (string) :default => 'message_key'
|
512
512
|
default_topic (string) :default => nil
|
513
|
+
use_default_for_unknown_topic (bool) :default => false
|
514
|
+
use_default_for_unknown_partition_error (bool) :default => false
|
513
515
|
default_partition_key (string) :default => nil
|
514
516
|
default_message_key (string) :default => nil
|
515
517
|
exclude_topic_key (bool) :default => false
|
data/fluent-plugin-kafka.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = "fluent-plugin-kafka"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = '0.19.
|
16
|
+
gem.version = '0.19.1'
|
17
17
|
gem.required_ruby_version = ">= 2.1.0"
|
18
18
|
|
19
19
|
gem.add_dependency "fluentd", [">= 0.10.58", "< 2"]
|
@@ -65,6 +65,8 @@ DESC
|
|
65
65
|
config_param :topic_key, :string, :default => 'topic', :desc => "Field for kafka topic"
|
66
66
|
config_param :default_topic, :string, :default => nil,
|
67
67
|
:desc => "Default output topic when record doesn't have topic field"
|
68
|
+
config_param :use_default_for_unknown_topic, :bool, :default => false, :desc => "If true, default_topic is used when topic not found"
|
69
|
+
config_param :use_default_for_unknown_partition_error, :bool, :default => false, :desc => "If true, default_topic is used when received unknown_partition error"
|
68
70
|
config_param :message_key_key, :string, :default => 'message_key', :desc => "Field for kafka message key"
|
69
71
|
config_param :default_message_key, :string, :default => nil
|
70
72
|
config_param :partition_key, :string, :default => 'partition', :desc => "Field for kafka partition"
|
@@ -233,6 +235,9 @@ DESC
|
|
233
235
|
@rdkafka = Rdkafka::Config.new(config)
|
234
236
|
|
235
237
|
if @default_topic.nil?
|
238
|
+
if @use_default_for_unknown_topic || @use_default_for_unknown_partition_error
|
239
|
+
raise Fluent::ConfigError, "default_topic must be set when use_default_for_unknown_topic or use_default_for_unknown_partition_error is true"
|
240
|
+
end
|
236
241
|
if @chunk_keys.include?(@topic_key) && !@chunk_key_tag
|
237
242
|
log.warn "Use '#{@topic_key}' field of event record for topic but no fallback. Recommend to set default_topic or set 'tag' in buffer chunk keys like <buffer #{@topic_key},tag>"
|
238
243
|
end
|
@@ -466,17 +471,25 @@ DESC
|
|
466
471
|
|
467
472
|
def enqueue_with_retry(producer, topic, record_buf, message_key, partition, headers, time)
|
468
473
|
attempt = 0
|
474
|
+
actual_topic = topic
|
475
|
+
|
469
476
|
loop do
|
470
477
|
begin
|
471
478
|
@enqueue_rate.raise_if_limit_exceeded(record_buf.bytesize) if @enqueue_rate
|
472
|
-
return producer.produce(topic:
|
479
|
+
return producer.produce(topic: actual_topic, payload: record_buf, key: message_key, partition: partition, headers: headers, timestamp: @use_event_time ? Time.at(time) : nil)
|
473
480
|
rescue EnqueueRate::LimitExceeded => e
|
474
481
|
@enqueue_rate.revert if @enqueue_rate
|
475
482
|
duration = e.next_retry_clock - Fluent::Clock.now
|
476
483
|
sleep(duration) if duration > 0.0
|
477
484
|
rescue Exception => e
|
478
485
|
@enqueue_rate.revert if @enqueue_rate
|
479
|
-
|
486
|
+
|
487
|
+
if !e.respond_to?(:code)
|
488
|
+
raise e
|
489
|
+
end
|
490
|
+
|
491
|
+
case e.code
|
492
|
+
when :queue_full
|
480
493
|
if attempt <= @max_enqueue_retries
|
481
494
|
log.warn "Failed to enqueue message; attempting retry #{attempt} of #{@max_enqueue_retries} after #{@enqueue_retry_backoff}s"
|
482
495
|
sleep @enqueue_retry_backoff
|
@@ -484,6 +497,25 @@ DESC
|
|
484
497
|
else
|
485
498
|
raise "Failed to enqueue message although tried retry #{@max_enqueue_retries} times"
|
486
499
|
end
|
500
|
+
# https://github.com/confluentinc/librdkafka/blob/c282ba2423b2694052393c8edb0399a5ef471b3f/src/rdkafka.h#LL309C9-L309C41
|
501
|
+
# RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC
|
502
|
+
when :unknown_topic
|
503
|
+
if @use_default_for_unknown_topic && actual_topic != @default_topic
|
504
|
+
log.debug "'#{actual_topic}' topic not found. Retry with '#{@default_topic}' topic"
|
505
|
+
actual_topic = @default_topic
|
506
|
+
retry
|
507
|
+
end
|
508
|
+
raise e
|
509
|
+
# https://github.com/confluentinc/librdkafka/blob/c282ba2423b2694052393c8edb0399a5ef471b3f/src/rdkafka.h#L305
|
510
|
+
# RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION
|
511
|
+
when :unknown_partition
|
512
|
+
if @use_default_for_unknown_partition_error && actual_topic != @default_topic
|
513
|
+
log.debug "failed writing to topic '#{actual_topic}' with error '#{e.to_s}'. Writing message to topic '#{@default_topic}'"
|
514
|
+
actual_topic = @default_topic
|
515
|
+
retry
|
516
|
+
end
|
517
|
+
|
518
|
+
raise e
|
487
519
|
else
|
488
520
|
raise e
|
489
521
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-kafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hidemasa Togashi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|