lib/fluent/plugin/out_kafka.rb in fluent-plugin-kafka-enchanced-0.5.16 vs lib/fluent/plugin/out_kafka.rb in fluent-plugin-kafka-enchanced-0.5.17
- old
+ new
@@ -147,11 +147,10 @@
require "avro/builder"
Proc.new do |tag, time, record|
record = record.select{|key, value| !key.nil? && !key.empty?}.map{|k, v| [k.tr('[]-', '_').delete('$'), v.to_s]}.to_h
record['enchilada_timestamp'] = (Time.new).strftime('%s%3N')
fields = record.keys.map{|key| {'name' => key, 'type' => 'string'}}
- @topic_name = schema_name = "#{tag.to_s.tr('.$:', '_')}_#{fields.to_s.hash.abs}"
- schema_json = {
+ @topic_name = schema_name = "#{tag.to_s.tr('.$:', '_')}_#{fields.to_s.hash.abs.to_s.first(6)}" schema_json = {
"type": "record",
"name": schema_name,
"fields": fields
}.to_json
schema = Avro::Schema.parse(schema_json)