fluent-plugin-kafka 0.3.4 → 0.3.5
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/README.md +5 -0
- data/fluent-plugin-kafka.gemspec +1 -1
- data/lib/fluent/plugin/out_kafka.rb +8 -2
- data/lib/fluent/plugin/out_kafka_buffered.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c58f69838db9786bbbe80d9fdf6a0c055f11bddd
|
4
|
+
data.tar.gz: 7cafa5f21b85071af41c44570c27fe11518c3f09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2ec6b3299fcf850de52ad759e88528a493428e4a16d1404c9618bd59ef15aec53e5bd58ff4205c085f16a5ee6c3d6408caa74d5a9dee6bb0979e3129113985
|
7
|
+
data.tar.gz: 0684e0e9659879d7e84d2342637e7d0b0e079783351de7ad7188e0783e63ee439fac20a6d1731903e4fab58c864843379c930d3c9ccc9472a72f53df6a481c52
|
data/README.md
CHANGED
@@ -113,6 +113,7 @@ This plugin uses ruby-kafka producer for writing data. For performance and relia
|
|
113
113
|
|
114
114
|
default_topic (string) :default => nil
|
115
115
|
default_partition_key (string) :default => nil
|
116
|
+
default_message_key (string) :default => nil
|
116
117
|
output_data_type (json|ltsv|msgpack|attr:<record name>|<formatter name>) :default => json
|
117
118
|
output_include_tag (bool) :default => false
|
118
119
|
output_include_time (bool) :default => false
|
@@ -158,6 +159,9 @@ If key name `partition_key` exists in a message, this plugin set its value of pa
|
|
158
159
|
|Set| Exists | Messages which have partition_key record are assigned to the specific partition with parition_key, others are assigned to the specific partition with default_parition_key |
|
159
160
|
|
160
161
|
|
162
|
+
If key name `message_key` exists in a message, this plugin publishes the value of message_key to kafka and can be read by consumers. Same message key will be assigned to all messages by setting `default_message_key` in config file. If message_key exists and if partition_key is not set explicitly, messsage_key will be used for partitioning.
|
163
|
+
|
164
|
+
|
161
165
|
### Buffered output plugin
|
162
166
|
|
163
167
|
This plugin uses ruby-kafka producer for writing data. This plugin works with recent kafka versions.
|
@@ -172,6 +176,7 @@ This plugin uses ruby-kafka producer for writing data. This plugin works with re
|
|
172
176
|
|
173
177
|
default_topic (string) :default => nil
|
174
178
|
default_partition_key (string) :default => nil
|
179
|
+
default_message_key (string) :default => nil
|
175
180
|
output_data_type (json|ltsv|msgpack|attr:<record name>|<formatter name>) :default => json
|
176
181
|
output_include_tag (bool) :default => false
|
177
182
|
output_include_time (bool) :default => false
|
data/fluent-plugin-kafka.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "fluent-plugin-kafka"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = '0.3.
|
15
|
+
gem.version = '0.3.5'
|
16
16
|
gem.required_ruby_version = ">= 2.1.0"
|
17
17
|
|
18
18
|
gem.add_dependency "fluentd", [">= 0.10.58", "< 2"]
|
@@ -16,6 +16,7 @@ DESC
|
|
16
16
|
:desc => "Path in path for Broker id. Default to /brokers/ids"
|
17
17
|
config_param :default_topic, :string, :default => nil,
|
18
18
|
:desc => "Output topic."
|
19
|
+
config_param :default_message_key, :string, :default => nil
|
19
20
|
config_param :default_partition_key, :string, :default => nil
|
20
21
|
config_param :client_id, :string, :default => 'kafka'
|
21
22
|
config_param :output_data_type, :string, :default => 'json',
|
@@ -25,6 +26,10 @@ DESC
|
|
25
26
|
config_param :exclude_partition_key, :bool, :default => false,
|
26
27
|
:desc => <<-DESC
|
27
28
|
Set true to remove partition key from data
|
29
|
+
DESC
|
30
|
+
config_param :exclude_message_key, :bool, :default => false,
|
31
|
+
:desc => <<-DESC
|
32
|
+
Set true to remove message key from data
|
28
33
|
DESC
|
29
34
|
config_param :exclude_topic_key, :bool, :default => false,
|
30
35
|
:desc => <<-DESC
|
@@ -167,11 +172,12 @@ DESC
|
|
167
172
|
record['tag'] = tag if @output_include_tag
|
168
173
|
topic = (@exclude_topic_key ? record.delete('topic') : record['topic']) || @default_topic || tag
|
169
174
|
partition_key = (@exclude_partition_key ? record.delete('partition_key') : record['partition_key']) || @default_partition_key
|
175
|
+
message_key = (@exclude_message_key ? record.delete('message_key') : record['message_key']) || @default_message_key
|
170
176
|
|
171
177
|
value = @formatter_proc.call(tag, time, record)
|
172
178
|
|
173
|
-
log.on_trace { log.trace("message send to #{topic} with
|
174
|
-
producer.produce(value, topic: topic, partition_key: partition_key)
|
179
|
+
log.on_trace { log.trace("message send to #{topic} with partition_key: #{partition_key}, message_key: #{message_key} and value: #{value}.") }
|
180
|
+
producer.produce(value, topic: topic, key: message_key, partition_key: partition_key)
|
175
181
|
end
|
176
182
|
|
177
183
|
producer.deliver_messages
|
@@ -20,6 +20,7 @@ DESC
|
|
20
20
|
:desc => "Path in path for Broker id. Default to /brokers/ids"
|
21
21
|
config_param :default_topic, :string, :default => nil,
|
22
22
|
:desc => "Output topic"
|
23
|
+
config_param :default_message_key, :string, :default => nil
|
23
24
|
config_param :default_partition_key, :string, :default => nil
|
24
25
|
config_param :client_id, :string, :default => 'kafka'
|
25
26
|
config_param :output_data_type, :string, :default => 'json',
|
@@ -31,6 +32,10 @@ DESC
|
|
31
32
|
config_param :exclude_partition_key, :bool, :default => false,
|
32
33
|
:desc => <<-DESC
|
33
34
|
Set true to remove partition key from data
|
35
|
+
DESC
|
36
|
+
config_param :exclude_message_key, :bool, :default => false,
|
37
|
+
:desc => <<-DESC
|
38
|
+
Set true to remove partition key from data
|
34
39
|
DESC
|
35
40
|
config_param :exclude_topic_key, :bool, :default => false,
|
36
41
|
:desc => <<-DESC
|
@@ -224,6 +229,7 @@ DESC
|
|
224
229
|
record['tag'] = tag if @output_include_tag
|
225
230
|
topic = (@exclude_topic_key ? record.delete('topic'.freeze) : record['topic'.freeze]) || def_topic
|
226
231
|
partition_key = (@exclude_partition_key ? record.delete('partition_key'.freeze) : record['partition_key'.freeze]) || @default_partition_key
|
232
|
+
message_key = (@exclude_message_key ? record.delete('message_key'.freeze) : record['message_key'.freeze]) || @default_message_key
|
227
233
|
|
228
234
|
records_by_topic[topic] ||= 0
|
229
235
|
bytes_by_topic[topic] ||= 0
|
@@ -241,9 +247,9 @@ DESC
|
|
241
247
|
messages = 0
|
242
248
|
messages_bytes = 0
|
243
249
|
end
|
244
|
-
log.on_trace { log.trace("message will send to #{topic} with
|
250
|
+
log.on_trace { log.trace("message will send to #{topic} with partition_key: #{partition_key}, message_key: #{message_key} and value: #{record_buf}.") }
|
245
251
|
messages += 1
|
246
|
-
producer.produce2(record_buf, topic: topic, partition_key: partition_key)
|
252
|
+
producer.produce2(record_buf, topic: topic, key: message_key, partition_key: partition_key)
|
247
253
|
messages_bytes += record_buf_bytes
|
248
254
|
|
249
255
|
records_by_topic[topic] += 1
|
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.3.
|
4
|
+
version: 0.3.5
|
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: 2016-10-
|
12
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|