fluent-plugin-kafka-enchanced 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb34d3f0443785e60ce856eadb669dc792b57361
4
- data.tar.gz: 3beac44b51f83fb27402decd2f8d7f967a650966
3
+ metadata.gz: 4a798dba21caaa8ac5fb099baf13b5fd08897b5c
4
+ data.tar.gz: cb40184d340175e0c9cc1758c2a523f0c9967f74
5
5
  SHA512:
6
- metadata.gz: 52e92c7c25b9484c2d8ef863610df34d8244b94f38a527d58ae27fd37bdeea9a19288ac07bd0ff273d96c3b7d1831e2c7879baf87eac0fe0be74d2c321ac7f9d
7
- data.tar.gz: 37074e95f5f24aeb4e23a9c412525a38b97528725f094a1740a0b148f5e23eecf498fcb2d9b252b51c09d8bf85cfd697b5126abbdff88f9ac6b77e77ed257bcb
6
+ metadata.gz: f23f912de694240a799d3f80d6c3047a267bec9dd6731a174f6507dbe5928e49afd38db9ce7214ef8a6889d90b873b98086876e352c430badca996b0dfc2afaf
7
+ data.tar.gz: 00d03a2a336e8361b92c8622c86be9dc959c4d041af1903104e0d914cc69e81857b6cdaae65549ddaeec8099d33a34513a9e1f181777e62854efbcc48ca10979
@@ -12,12 +12,13 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "fluent-plugin-kafka-enchanced"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = '0.5.5'
15
+ gem.version = '0.5.6'
16
16
  gem.required_ruby_version = ">= 2.1.0"
17
17
 
18
18
  gem.add_dependency "fluentd", [">= 0.10.58", "< 2"]
19
19
  gem.add_dependency 'ltsv'
20
20
  gem.add_dependency 'avro-builder'
21
+ gem.add_dependency 'avro-schema-registry'
21
22
  gem.add_dependency 'avro_turf'
22
23
  gem.add_dependency 'ruby-kafka', '= 0.3.16.beta2'
23
24
  gem.add_development_dependency "rake", ">= 0.9.2"
@@ -1,5 +1,6 @@
1
1
  require 'fluent/output'
2
2
  require 'fluent/plugin/kafka_plugin_util'
3
+ require 'pry'
3
4
 
4
5
  class Fluent::KafkaOutput < Fluent::Output
5
6
  Fluent::Plugin.register_output('kafka', self)
@@ -12,6 +13,8 @@ Note that you can choose to use either brokers or zookeeper.
12
13
  DESC
13
14
  config_param :zookeeper, :string, :default => nil,
14
15
  :desc => "Set brokers via Zookeeper: <zookeeper_host>:<zookeeper_port>"
16
+ config_param :schema_registry, :string, :default => nil,
17
+ :desc => "Set Avro Schema Registry: <schema_registry_host>:<schema_registry_port>"
15
18
  config_param :zookeeper_path, :string, :default => '/brokers/ids',
16
19
  :desc => "Path in path for Broker id. Default to /brokers/ids"
17
20
  config_param :default_topic, :string, :default => nil,
@@ -21,7 +24,7 @@ DESC
21
24
  config_param :default_partition, :integer, :default => nil
22
25
  config_param :client_id, :string, :default => 'kafka'
23
26
  config_param :output_data_type, :string, :default => 'json',
24
- :desc => "Supported format: (json|ltsv|msgpack|attr:<record name>|<formatter name>)"
27
+ :desc => "Supported format: (json|avro|ltsv|msgpack|attr:<record name>|<formatter name>)"
25
28
  config_param :output_include_tag, :bool, :default => false
26
29
  config_param :output_include_time, :bool, :default => false
27
30
  config_param :exclude_partition_key, :bool, :default => false,
@@ -68,7 +71,8 @@ DESC
68
71
 
69
72
  require 'kafka'
70
73
  require "avro_turf"
71
- require "avro-builder"
74
+ require "avro/builder"
75
+ require 'avro-schema-registry'
72
76
 
73
77
  @kafka = nil
74
78
  end
@@ -140,6 +144,15 @@ DESC
140
144
  if @output_data_type == 'json'
141
145
  require 'yajl'
142
146
  Proc.new { |tag, time, record| Yajl::Encoder.encode(record) }
147
+ elsif @output_data_type == 'avro'
148
+ fields = JSON.parse(value).keys.map{|key| {'name' => key, 'type' => 'string'}}.to_s.gsub('=>', ':')
149
+ schema_json =
150
+ <<-JSON
151
+ {"type": "record",
152
+ "name": "#{topic}_value",
153
+ "fields": #{fields}}
154
+ JSON
155
+ schema = Avro::Schema.parse(schema_json)
143
156
  elsif @output_data_type == 'ltsv'
144
157
  require 'ltsv'
145
158
  Proc.new { |tag, time, record| LTSV.dump(record) }
@@ -200,3 +213,4 @@ DESC
200
213
  end
201
214
 
202
215
  end
216
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kafka-enchanced
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paschenko Konstantin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-15 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: avro-schema-registry
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: avro_turf
63
77
  requirement: !ruby/object:Gem::Requirement