class Fluent::TextParser::RabbitMQJSONTraceParser
Public Instance Methods
parse(text) { |time, record| ... }
click to toggle source
# File lib/fluent/plugin/parser_rabbitmq_json_trace.rb, line 12 def parse(text) record = Yajl.load(text) record['payload'] = ::Base64.decode64(record['payload']) if @payload_type == :json record['payload'] = Yajl.load(record['payload']) end time = get_time(record) if block_given? yield time, record else return time, record end rescue Yajl::ParseError if block_given? yield nil, nil else return nil, nil end end
Private Instance Methods
get_time(record)
click to toggle source
# File lib/fluent/plugin/parser_rabbitmq_json_trace.rb, line 38 def get_time(record) value = @keep_time_key ? record[@time_key] : record.delete(@time_key) if value if @time_format @mutex.synchronize { @time_parser.parse(value) } else begin value.to_i rescue => e raise ParserError, "invalid time value: value = #{value}, error_class = #{e.class.name}, error = #{e.message}" end end elsif @estimate_current_event Engine.now end end