lib/fluent/plugin/out_kafka_buffered.rb in fluent-plugin-kafka-enchanced-0.5.21 vs lib/fluent/plugin/out_kafka_buffered.rb in fluent-plugin-kafka-enchanced-0.5.23
- old
+ new
@@ -198,10 +198,10 @@
elsif @output_data_type == 'avro'
require "avro_turf"
require 'avro_turf/messaging'
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 = record.select{|key, value| !key.nil? && !key.empty?}.map{|k, v| [k.tr('[]-', '_').delete('$'), v.to_s.force_encoding("UTF-8")]}.to_h
timestamp = Time.new
record['enchilada_timestamp'] = timestamp.strftime('%s%3N')
record['enchilada_time_with_format'] = timestamp.strftime("%Y-%m-%dT%H:%M:%S.%LZ")
fields = record.keys.map{|key| {'name' => key, 'type' => 'string'}}
@topic_name = schema_name = "#{tag.to_s.tr('.$:', '_')}_#{Digest::MD5.new.hexdigest(fields.to_s)[0..5]}"