fluent-plugin-kafka 0.12.0 → 0.12.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 +4 -0
- data/fluent-plugin-kafka.gemspec +1 -1
- data/lib/fluent/plugin/in_kafka.rb +18 -6
- data/lib/fluent/plugin/in_kafka_group.rb +15 -5
- 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: 497c5a450bc4f55ddaf1b46454ed80f028c283775666e2a38ee0d91f16d391ef
|
4
|
+
data.tar.gz: 5f40c26e75f06e4ee73cc0b3ba32ef8438da48bea465549fb95f4bcb89e98819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcac3281832905427ad5799b6b1d7c9dab9b13562c19ba8283fa4eaf2ea1b88e7c782714be7cec9546878e26ab223725b0cbc06259bc8e375eff5e407575bb3f
|
7
|
+
data.tar.gz: deef97208222254e9fc4b0279f0dd9045c177354fa1a8dcca3a304d3b2a5d1090e1e7970b5cd9066d7ff917e8020b798d4dd674623285c52041c173fe37d48f5
|
data/ChangeLog
CHANGED
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.12.
|
16
|
+
gem.version = '0.12.1'
|
17
17
|
gem.required_ruby_version = ">= 2.1.0"
|
18
18
|
|
19
19
|
gem.add_dependency "fluentd", [">= 0.10.58", "< 2"]
|
@@ -35,10 +35,13 @@ class Fluent::KafkaInput < Fluent::Input
|
|
35
35
|
config_param :offset_zookeeper, :string, :default => nil
|
36
36
|
config_param :offset_zk_root_node, :string, :default => '/fluent-plugin-kafka'
|
37
37
|
config_param :use_record_time, :bool, :default => false,
|
38
|
-
:desc => "Replace message timestamp with contents of 'time' field."
|
38
|
+
:desc => "Replace message timestamp with contents of 'time' field.",
|
39
|
+
:deprecated => "Use 'time_source record' instead."
|
40
|
+
config_param :time_source, :enum, :list => [:now, :kafka, :record], :default => :now,
|
41
|
+
:desc => "Source for message timestamp."
|
39
42
|
config_param :get_kafka_client_log, :bool, :default => false
|
40
43
|
config_param :time_format, :string, :default => nil,
|
41
|
-
:desc => "Time format to be used to parse 'time'
|
44
|
+
:desc => "Time format to be used to parse 'time' field."
|
42
45
|
config_param :kafka_message_key, :string, :default => nil,
|
43
46
|
:desc => "Set kafka's message key to this field"
|
44
47
|
|
@@ -110,7 +113,9 @@ class Fluent::KafkaInput < Fluent::Input
|
|
110
113
|
|
111
114
|
@parser_proc = setup_parser
|
112
115
|
|
113
|
-
if @use_record_time
|
116
|
+
@time_source = :record if @use_record_time
|
117
|
+
|
118
|
+
if @time_source == :record and @time_format
|
114
119
|
if defined?(Fluent::TimeParser)
|
115
120
|
@time_parser = Fluent::TimeParser.new(@time_format)
|
116
121
|
else
|
@@ -206,6 +211,7 @@ class Fluent::KafkaInput < Fluent::Input
|
|
206
211
|
offset_manager,
|
207
212
|
router,
|
208
213
|
@kafka_message_key,
|
214
|
+
@time_source,
|
209
215
|
opt)
|
210
216
|
}
|
211
217
|
@topic_watchers.each {|tw|
|
@@ -230,7 +236,7 @@ class Fluent::KafkaInput < Fluent::Input
|
|
230
236
|
end
|
231
237
|
|
232
238
|
class TopicWatcher < Coolio::TimerWatcher
|
233
|
-
def initialize(topic_entry, kafka, interval, parser, add_prefix, add_suffix, offset_manager, router, kafka_message_key, options={})
|
239
|
+
def initialize(topic_entry, kafka, interval, parser, add_prefix, add_suffix, offset_manager, router, kafka_message_key, time_source, options={})
|
234
240
|
@topic_entry = topic_entry
|
235
241
|
@kafka = kafka
|
236
242
|
@callback = method(:consume)
|
@@ -241,6 +247,7 @@ class Fluent::KafkaInput < Fluent::Input
|
|
241
247
|
@offset_manager = offset_manager
|
242
248
|
@router = router
|
243
249
|
@kafka_message_key = kafka_message_key
|
250
|
+
@time_source = time_source
|
244
251
|
|
245
252
|
@next_offset = @topic_entry.offset
|
246
253
|
if @topic_entry.offset == -1 && offset_manager
|
@@ -277,14 +284,19 @@ class Fluent::KafkaInput < Fluent::Input
|
|
277
284
|
messages.each { |msg|
|
278
285
|
begin
|
279
286
|
record = @parser.call(msg, @topic_entry)
|
280
|
-
|
287
|
+
case @time_source
|
288
|
+
when :kafka
|
289
|
+
record_time = Fluent::EventTime.from_time(msg.create_time)
|
290
|
+
when :now
|
291
|
+
record_time = Fluent::Engine.now
|
292
|
+
when :record
|
281
293
|
if @time_format
|
282
294
|
record_time = @time_parser.parse(record['time'])
|
283
295
|
else
|
284
296
|
record_time = record['time']
|
285
297
|
end
|
286
298
|
else
|
287
|
-
|
299
|
+
$log.fatal "BUG: invalid time_source: #{@time_source}"
|
288
300
|
end
|
289
301
|
if @kafka_message_key
|
290
302
|
record[@kafka_message_key] = msg.key
|
@@ -25,10 +25,13 @@ class Fluent::KafkaGroupInput < Fluent::Input
|
|
25
25
|
config_param :retry_emit_limit, :integer, :default => nil,
|
26
26
|
:desc => "How long to stop event consuming when BufferQueueLimitError happens. Wait retry_emit_limit x 1s. The default is waiting until BufferQueueLimitError is resolved"
|
27
27
|
config_param :use_record_time, :bool, :default => false,
|
28
|
-
:desc => "Replace message timestamp with contents of 'time' field."
|
28
|
+
:desc => "Replace message timestamp with contents of 'time' field.",
|
29
|
+
:deprecated => "Use 'time_source record' instead."
|
30
|
+
config_param :time_source, :enum, :list => [:now, :kafka, :record], :default => :now,
|
31
|
+
:desc => "Source for message timestamp."
|
29
32
|
config_param :get_kafka_client_log, :bool, :default => false
|
30
33
|
config_param :time_format, :string, :default => nil,
|
31
|
-
:desc => "Time format to be used to parse 'time'
|
34
|
+
:desc => "Time format to be used to parse 'time' field."
|
32
35
|
config_param :kafka_message_key, :string, :default => nil,
|
33
36
|
:desc => "Set kafka's message key to this field"
|
34
37
|
config_param :connect_timeout, :integer, :default => nil,
|
@@ -122,7 +125,9 @@ class Fluent::KafkaGroupInput < Fluent::Input
|
|
122
125
|
@fetch_opts[:max_wait_time] = @max_wait_time if @max_wait_time
|
123
126
|
@fetch_opts[:min_bytes] = @min_bytes if @min_bytes
|
124
127
|
|
125
|
-
if @use_record_time
|
128
|
+
@time_source = :record if @use_record_time
|
129
|
+
|
130
|
+
if @time_source == :record and @time_format
|
126
131
|
if defined?(Fluent::TimeParser)
|
127
132
|
@time_parser = Fluent::TimeParser.new(@time_format)
|
128
133
|
else
|
@@ -230,14 +235,19 @@ class Fluent::KafkaGroupInput < Fluent::Input
|
|
230
235
|
batch.messages.each { |msg|
|
231
236
|
begin
|
232
237
|
record = @parser_proc.call(msg)
|
233
|
-
|
238
|
+
case @time_source
|
239
|
+
when :kafka
|
240
|
+
record_time = Fluent::EventTime.from_time(msg.create_time)
|
241
|
+
when :now
|
242
|
+
record_time = Fluent::Engine.now
|
243
|
+
when :record
|
234
244
|
if @time_format
|
235
245
|
record_time = @time_parser.parse(record['time'].to_s)
|
236
246
|
else
|
237
247
|
record_time = record['time']
|
238
248
|
end
|
239
249
|
else
|
240
|
-
|
250
|
+
log.fatal "BUG: invalid time_source: #{@time_source}"
|
241
251
|
end
|
242
252
|
if @kafka_message_key
|
243
253
|
record[@kafka_message_key] = msg.key
|
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.12.
|
4
|
+
version: 0.12.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: 2019-
|
12
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|