Sha256: 550040a7f3aafa1dfa480b940df811c57f3143dc71919c32599ef7867b474a82
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
# frozen_string_literal: true module ElasticAPM module Transport module Serializers # @api private class ErrorSerializer < Serializer def context_serializer @context_serializer ||= ContextSerializer.new(config) end # rubocop:disable Metrics/MethodLength def build(error) base = { id: error.id, transaction_id: error.transaction_id, transaction: error.transaction, trace_id: error.trace_id, parent_id: error.parent_id, culprit: error.culprit, timestamp: error.timestamp, context: context_serializer.build(error.context) } if (exception = error.exception) base[:exception] = build_exception exception end if (log = error.log) base[:log] = build_log log end { error: base } end # rubocop:enable Metrics/MethodLength private def build_exception(exception) { message: exception.message, type: keyword_field(exception.type), module: keyword_field(exception.module), code: keyword_field(exception.code), attributes: exception.attributes, stacktrace: exception.stacktrace.to_a, handled: exception.handled } end def build_log(log) { message: log.message, level: keyword_field(log.level), logger_name: keyword_field(log.logger_name), param_message: keyword_field(log.param_message), stacktrace: log.stacktrace.to_a } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems