lib/fluent/plugin/out_kafka.rb in fluent-plugin-kafka-enchanced-0.5.27 vs lib/fluent/plugin/out_kafka.rb in fluent-plugin-kafka-enchanced-0.5.28
- old
+ new
@@ -145,10 +145,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.is_a?(String) || v.nil? || v.empty?) ? v.to_s.force_encoding("UTF-8") : v)]}.to_h
+ record = record.select{|key, value| !key.nil? && !key.empty?}.map{|k, v| [k.tr('[]-', '_').delete('$'), ((v.is_a?(String) || v.nil? || v.to_s.empty?) ? v.to_s.force_encoding("UTF-8") : v)]}.to_h
timestamp = Time.new
record['enchilada_time_with_format'] = timestamp.strftime("%Y-%m-%dT%H:%M:%S.%LZ")
fields = record.map{|key, value| {'name' => key, 'type' => (value.is_a?(Fixnum) ? 'int' : (value.is_a?(Float) ? 'float' : 'string'))}}
record['enchilada_timestamp'] = timestamp.strftime('%s%3N').to_i