in lib/aws-xray-sdk/model/entity.rb [134:169]
def to_h
h = {
name: name,
id: id,
start_time: start_time
}
if closed?
h[:end_time] = end_time
else
h[:in_progress] = true
end
h[:subsegments] = subsegments.map(&:to_h) unless subsegments.empty?
h[:aws] = aws if aws
if http_request || http_response
h[:http] = {}
h[:http][:request] = http_request if http_request
h[:http][:response] = http_response if http_response
end
if (a = annotations.to_h) && !a.empty?
h[:annotations] = a
end
if (m = @metadata) && !m.to_h.empty?
h[:metadata] = m.to_h
end
h[:parent_id] = parent.id if parent
h[:fault] = !!fault if fault
h[:error] = !!error if error
h[:throttle] = !!throttle if throttle
h[:cause] = cause.to_h if cause
h
end